100 doors: Difference between revisions
→{{header|Fōrmulæ}}
Basicgames (talk | contribs) |
|||
Line 6,190:
{{FormulaeEntry|page=https://formulae.org/?script=examples/100_doors}}
The solution consists in having a 100 element array, initialized with FALSE values. In each of the 100 rounds (controlled by a simple FOR-FROM-TO cycle), the values are flipped using a FOR-FROM-TO-STEP cycle. Finally the array is shown, using green colors for open doors, and red for closed ones. The resulting matrix is transposed in order to be shown horizontally.
[[File:Fōrmulæ - 100 doors 01.png]]
The result of calling the function is:
[[File:Fōrmulæ - 100 doors 02.png]]
Improvement: Graphic output, in order to show evolution in time, and an arbitrary number of doors.
[[File:Fōrmulæ - 100 doors 03.png]]
100 doors, each door is 3x3 pixel:
[[File:Fōrmulæ - 100 doors 04.png]]
[[File:Fōrmulæ - 100 doors 05.png]]
=={{header|Gambas}}==
|