Simulated optics experiment/Simulator: Difference between revisions

Added "coroutines".
(New draft task about a science simulation.)
 
(Added "coroutines".)
Line 27:
* On the right, the first angle is 22.5° and the second is 67.5°.
 
The simulation is run by having the light source emit some number of pulses and letting the other devices do their work. How you arrange this to work is up to you. The [[#Python|Python]] example, for instance, runs each device as a separate process, connected to each other by queues. But you can instead have, for instance, an event loop, coroutines, or even just ordinary, procedural calculation of the numbers. (The last method is simplest, and perfectly correct. However, simulating the devices as independent processes, objects in an event loop, etc., has a psychological advantage, which may be important if you are trying to convince someone of your point.)
 
The program must output its "raw data" results in the format shown here by example:
1,448

edits