Post Reply 
N-Queens results on Casio calculators
08-14-2024, 10:23 AM (This post was last modified: 08-14-2024 03:48 PM by Hlib.)
Post: #7
RE: N-Queens results on Casio calculators
A few comments about the "8-queens benchmark" program for CASIO calculators, a variant with Goto and Lbl. It is necessary to delete the useless Deg (or Rad) command and swap the two operators. The speed of calculations will not change at all, but the program code will look better.
Code:

8➝R : R➝Dim A
0➝S : 0➝X
Lbl 0 : X=R⇒Goto 4
Isz X : R➝A[X]
Lbl 1 : Isz S : X➝Y
Lbl 2 : Dsz Y : A[X]-A[Y]➝T
Y=0⇒Goto 0 : T=0⇒Goto 3
(X-Y)≠Abs T⇒Goto 2
Lbl 3 : Dsz A[X] : Goto 1
Dsz X : Goto 3
Lbl 4 : S
Note that in CBASIC, the (X-Y)≠Abs T⇒Goto 2 command must have parentheses. Sentaro21 (the author of CBASIC) pointed out a long time ago that parentheses here provide compilation of elementary arithmetic expressions.
Here are the results for comparison.
FX-9860GII-2, integer mode (CBASIC ver.2.45):
t=0.661_sec without parentheses
t=0.481_sec with parentheses (×1.4 times faster).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: N-Queens results on Casio calculators - Hlib - 08-14-2024 10:23 AM



User(s) browsing this thread: 5 Guest(s)