THREE DICE
(Back)
Email the author:Paolo Bonzini
Usage: The program shows twenty-two numbers
(1234567890123456789012). You have to combine the result of throwing
three dice to obtain all the twenty-two numbers, without obtaining the
same number twice.
After the numbers, the program shows you the three dies, for example
{1 5 3}, and prompts you for two numbers between 1 and 5; each number
corresponds to an arithmetic sign between the three dies. For example
if you type 1 and 2 (respectively, + and -), you clear 1+5-3=3 and if
you type 5 and 3 (respectively, nothing and *), you clear both 1 and
5*3=15.
It is an error to enter divides which give a reminder and to obtain
results which are <1 or >22.
You can swap two numbers to make the puzzle easier. Just enter "A" or
"B" when the program asks you "A="; A swaps the first two numbers, B
swaps the last two
The program:
ClrG
23=>dim(L2)
fill(1,L2)
0=>N
0=>W
Label LOOP
22=>I
1+W=>W
Text(0,0, "1234567890123456789012")
Label ITEM
I-1=>I
If I<0 Goto ENTER
If L2(I+1)=1 Goto ITEM
Text(I,1,"X")
Goto ITEM
Label ENTER
Wait 1
ipart (1+6random (3))=>L3
ClrG
Label ENTA
ClrT
Print L3
Print " A B"
Print ""
Print "1+ 2- 3* 4/ 5, AB=>SWAP"
7=>A
8=>B
Input A
If A<6 Goto ENTB
L3(A-5)=>C
L3(A-6)=>L3(A-5)
C=>L3(A-6)
Goto ENTA
Label ENTB
Input B
2=>G
23=>C
23=>D
L3(2)=>E
If A=5 Goto E1
{L3(1)+E,L3(1)-E,EL3(1),L3(1)/E}=>L1
L1(A)=>E
If B=5 Goto E3
1=>G
Label E23
{E+L3(3),E-L3(3),EL3(3),E/L3(3)}=>L1
L1(B)=>E
Goto CHECK
Label E1
L3(1)=>D
If B<>5 Goto E23
3=>G
Label E3
L3(3)=>C
Label CHECK
If E<1 Goto ERR
If E>22 Goto ERR
If fpart E<>0 Goto ERR
If L2(C)+L2(D)+L2(E)<3 Goto ERR
N+G=>N
0=>L2(C)
0=>L2(D)
0=>L2(E)
1=>L2(23)
If N<22 Goto LOOP
Print "TRIES"
Print W
End
Label ERR
Text(0,5,"NO!!")
Goto LOOP