Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python, write a program that will simulate a special physics demonstration that would otherwise be difficult to set up. (Python 3.6) COSC 1306 Spring

Using python, write a program that will simulate a special physics demonstration that would otherwise be difficult to set up. (Python 3.6)

image text in transcribedimage text in transcribed

COSC 1306 Spring 2018 Homework 3 Objective: Write a program that makes use of the lists to solve a problem and file output to save the results. Problem: Using python, write a program that will simulate a special physics demonstration that would otherwise be difficult to set up. Imaging a number of wooden matches are arranged upright on a grid. The matches are positioned at the same level and at integer locations (inches) on an X-Y grid. A special laser is placed at the origin that projects a fan of laser light onto the field of matches. Consider "L: as the laser position and "." as the matches, from above: From the side a row looks like: Looo o When the laser fires, it will ignite the matches that it can "see", with some of the matches blocking the view from to the matches behind them. For example, along a given line, only the first match will ignite. 0 0 Lit Unlit Unlit Unlit We would like to know which (or how many) matches in the field are ignited and which (or how many) are not. Deadline: Friday, November 9, 2018, 11:59 PM Requirements: Submit to Blackboard a single python file named "homework3.". Include in the header your name, PSID, and the homework number. Use meaningful variable and function names in order to: 1. Request the name for the output file to be used to save the results. Request the width and height of the field of matches as positive whole numbers. Determine the matches which are ignited and which are not. If both the sizes are below 80, display grid with the results to the screen and write this result into a file with the specified name. If either size value is above 80, simply display and record to the file the number of lit and unlit matches without drawing the grid 2. 3. 4. Use the program to answer the question: How many matches are unlit for a 1000x1000 field? Submit the answer as a comment on Blackboard along with your code. Use good functional style and suitable variable names. 5. COSC 1306 Spring 2018 Homework 3 Objective: Write a program that makes use of the lists to solve a problem and file output to save the results. Problem: Using python, write a program that will simulate a special physics demonstration that would otherwise be difficult to set up. Imaging a number of wooden matches are arranged upright on a grid. The matches are positioned at the same level and at integer locations (inches) on an X-Y grid. A special laser is placed at the origin that projects a fan of laser light onto the field of matches. Consider "L: as the laser position and "." as the matches, from above: From the side a row looks like: Looo o When the laser fires, it will ignite the matches that it can "see", with some of the matches blocking the view from to the matches behind them. For example, along a given line, only the first match will ignite. 0 0 Lit Unlit Unlit Unlit We would like to know which (or how many) matches in the field are ignited and which (or how many) are not. Deadline: Friday, November 9, 2018, 11:59 PM Requirements: Submit to Blackboard a single python file named "homework3.". Include in the header your name, PSID, and the homework number. Use meaningful variable and function names in order to: 1. Request the name for the output file to be used to save the results. Request the width and height of the field of matches as positive whole numbers. Determine the matches which are ignited and which are not. If both the sizes are below 80, display grid with the results to the screen and write this result into a file with the specified name. If either size value is above 80, simply display and record to the file the number of lit and unlit matches without drawing the grid 2. 3. 4. Use the program to answer the question: How many matches are unlit for a 1000x1000 field? Submit the answer as a comment on Blackboard along with your code. Use good functional style and suitable variable names. 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions