I think "cycle" means "loop", not "label". The fx-3600P doesn't have labels. Anyway, the entire program (double loop) fits in an fx-3600P, that's why I requested the correction from Sergei.
Yes, of course you are right with the lack of labels. What I meant was that there
is only one "pseudo label" at the beginning of each programm area that makes it a
bit tricky to have nested loops. Sorry for the unclear statement.
Re: a "more challenging problem" - you know, nothing is a problem for the powerful Casio fx-201 with its 127 steps of program memory and extensive portfolio of transcendental, numerical and logical functions, as long as it doesn't have to work for more than 8 hours, the batteries will be empty and I don't have an AC adapter. Bring it on !
I have used the n-queens problem to test the speed of programmable calculators
and pocket computers. It's a test for the basic programming elements and not a
mathematical test. It's an iterative backtracking algorithm.
This is the version for the FX-4500P:
Mcl
Fixm
R=8 (8 queens)
Lbl 0
X=R=>Goto 4_
X=X+1
A[X]=R
Lbl 1
S=S+1
Y=X
Lbl 2
Y=Y-1
Y=0=>Goto 0_
T=A[X]-A[Y]
T=0=>Goto 3_
X-Y<>Abs T=>Goto 2_
Lbl 3
A[X]=A[X]-1
Ans<>0=>Goto 1_
X=X-1
X<>0=>Goto 3_
Lbl 4
S
And this is my first try to translate the algorithm to the
unusual language of the FX-201P:
MAC
ST#0: IF 0=K6:5:4:4: (6 queens)
ST#5: 0=0+K1:
I=0:
IM=K6: (6 queens)
ST#1: 8=8+K1:
9=0:
ST#2: 9=9-K1:
IF 9=K0:0:0:6:
ST#6: I=0:
7=IM:
I=9:
7=7-IM:
IF 7=K0:7:3:8:
ST#7: 7=7+/-:
ST#8: 7=7+9-0:
IF 7=K0:2:3:2
ST#3: I=0:
IM=IM-K1:
IF IM=K0:1:9:1:
ST#9: 0=0-K1:
IF 0=K0:3:4:3:
ST#4: Ans8:
This version is for 6 queens because the FX-201P dosn't have enough variables.
If the program works correctly the output has to be 171 nodes.
For testing the correctness of the program on very slow calculators, I use 4 queens
with 26 nodes.
Does the program fit in to the 127 steps? If no, have you any suggestions to
make it possible? If it works, can you please measure the execution speed for 6 queens?
I guess it will take about 20-40 minutes.
Please let me know, if you need more information or have a look at the link
in my signature. Thank you.