A simple algorithm for simulating the spinner used to play Twister. Of course, you don't *have* to use dice. Anything with an even number of sides will work, like coins or other types of polyhedral dice.
Gakken GMC-4 implementation:
(Instruction address) (Assembly mnemonic); (Machine code)
00 TIY 0 ; A0
02 AIA 1 ; 91
04 AM ; 4
05 KA ; 0
06 JUMP 02 ; F02
09 MA ; 5
0A CAL SIFT; E6
0C JUMP 11 ; F11
0F CAL SETR; E1
11 AIY 1 ; B1
13 CIY 4 ; D4
15 JUMP 0A ; F0A
18 KA ; 0
19 JUMP 1F ; F1F
1C JUMP 18 ; F18
1F TIY 0 ; A0
21 CAL RSTR; E2
23 AIY 1 ; B1
25 CIY 4 ; D4
27 JUMP 21 ; F21
2A JUMP 00 ; F00
Link to this comment:
All Comments (0)