Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3.6. Write a program that makes use of the lists to solve a problem and file output to save the results. COSC 1306 Spring
Python 3.6. Write a program that makes use of the lists to solve a problem and file output to save the results.
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: Loo o 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 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. 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. 2. 3. 4. 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: Loo o 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 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. 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. 2. 3. 4. 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started