N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
05-10-2023, 02:38 PM
Post: #1
 Dave Britten Senior Member Posts: 2,237 Joined: Dec 2013
N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
The "chopping block" n-queens algorithm from "Mathematical Recreations for the Programmable Calculator" has been used to good effect on other calculators that lack indirect addressing (see here, here, and here), so here's a few more for the pile.

This is a quick conversion of the Sharp EL-5120 version I wrote. Not only do these solar-powered programmable Casios lack any sort of indirect addressing or subroutines, they also lack int/frac functions! Fortunately they do have a rounding function that can be substituted here without much hassle.

The fx-3650PII and fx-50FH are nearly identical in terms of programming functionality, and share the exact same program, but the fx-3650 has some substantial differences (or more accurately, omissions). It is lacking an absolute value function, but this is easily worked around in this program as it is used in only one place. Curiously, it's also lacking < and <=, but a simple rearrangement allows for using > instead. The biggest difference for this program is that the rounding function is used differently on this model. Thus there are two separate programs here: one for the fx-50FH and fx-3650PII, and one for the fx-3650P.

Note that I've used line breaks to separate the program statements for better readability, but you will of course use colons to separate the statements when entering them into the calculator. Functionally, it makes no difference which of the four program areas you use, but for the purposes of timing, I entered them into P1, in case that somehow affects speed.

When running the program, you will be prompted to enter the board size. Enter a value between 4 and 9 and press EXE to start (e.g. enter 8 for an 8x8 board). The program will stop and display the first solution found. Press EXE to continue finding additional solutions.

fx-50FH, fx-3650P II:

Code:
?→M Fix 0 0→A 0→C Lbl 1 A=M⇒Goto 6 1→B Lbl 3 C→D 0→Y Lbl 7 Y+1→Y D=0⇒Goto 8 .1D→D 10(D-Rnd(D-.5))→X Rnd(D-.5)→D X=B⇒Goto 4 Abs(X-B)=Y⇒Goto 4 Goto 7 Lbl 8 10C+B→C A+1→A Goto 1 Lbl 6 C◢ Lbl 4 B=M⇒Goto 5 B+1→B Goto 3 Lbl 5 A-1→A A<0⇒Goto 9 .1C→C 10(C-Rnd(C-.5))→B Rnd(C-.5)→C Goto 4 Lbl 9 Norm 1

fx-3650P:

Code:
?→M Fix 0 0→A 0→C Lbl 1 A=M⇒Goto 6 1→B Lbl 3 C→D 0→Y Lbl 7 Y+1→Y D=0⇒Goto 8 .1D→D D-.5 Rnd 10(D-Ans)→X D-.5 Rnd Ans→D X=B⇒Goto 4 X-B=Y⇒Goto 4 B-X=Y⇒Goto 4 Goto 7 Lbl 8 10C+B→C A+1→A Goto 1 Lbl 6 C◢ Lbl 4 B=M⇒Goto 5 B+1→B Goto 3 Lbl 5 A-1→A 0>A⇒Goto 9 .1C→C C-.5 Rnd 10(C-Ans)→B C-.5 Rnd Ans→C Goto 4 Lbl 9 Norm 1

Timings for an 8x8 board:

fx-3650P - 0:24:49
fx-3650PII - 0:05:49
fx-50FH - 0:06:42

I don't have an fx-50FHII (yet), so if anybody would like to do the honors, be my guest!
05-10-2023, 08:42 PM
Post: #2
 Hollerith Junior Member Posts: 25 Joined: Feb 2021
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
I have the FX-50 PLUS which appears to be the same as the FX-50FH (see old Casio catalogs here https://www.javys.biz/casio/ec_cata.htm)

It runs the FX-50FH program without change in 0:06:30

Brian M
05-11-2023, 06:54 AM
Post: #3
 klesl Member Posts: 118 Joined: Mar 2016
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
M=8:
fx-5800P: 00:05:16
fx-50F Plus: 00:06:37
05-11-2023, 08:32 AM
Post: #4
 Hollerith Junior Member Posts: 25 Joined: Feb 2021
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
Typo. I have a FX-50F PLUS not a FX-50 PLUS (doesn't exist).

Brian M
05-11-2023, 12:34 PM
Post: #5
 Dave Britten Senior Member Posts: 2,237 Joined: Dec 2013
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
Thanks for the extra data points. Interesting that the fx-50F variations are all very close but not exactly the same times. I wonder if that's due to manufacturing differences, design differences, or different execution speeds depending on battery voltage and/or amount of light.
05-11-2023, 09:44 PM
Post: #6
 xerxes Member Posts: 156 Joined: Jun 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
Thank you Dave for your effort and the explanations.

(05-11-2023 12:34 PM)Dave Britten Wrote:  Interesting that the fx-50F variations are all very close but not exactly the same times. I wonder if that's due to manufacturing differences, design differences, or different execution speeds depending on battery voltage and/or amount of light.

I think the main reason is the inaccuracy of the RC circuit and battery voltage. I've updated the list with the average timing of the FX-50F Plus.

Calculator Benchmark
05-12-2023, 09:17 PM
Post: #7
 klesl Member Posts: 118 Joined: Mar 2016
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
another results
fx-8700G 0:05:09
fx-9700GE 0:01:56
fx-7400GII 0:00:54
fx-9860G Slim 0:00:29
-------------------------
sencor sec-103 0:01:08

the sencor seems to be similar to fx-3650P, at least according to the keybord layout
Som casio calculators have RndFix function together with Rnd function, so terms
10(D-Rnd(D-.5)) [on some calcs this syntax gives syntax error]
or
D-.5
Rnd
10(D-Ans)→B
can be rewritten as 10(D-RndFix(D-.5,0))
RndFix rounds off the value to specified digits (from built-in help, fx-9860G Slim)
05-14-2023, 09:19 PM
Post: #8
 xerxes Member Posts: 156 Joined: Jun 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
(05-12-2023 09:17 PM)klesl Wrote:  the sencor seems to be similar to fx-3650P, at least according to the keybord layout

Yes, it seems to be a very fast copy of the FX-3650P. Thank you for testing.

Calculator Benchmark
05-14-2023, 09:47 PM
Post: #9
 Dave Britten Senior Member Posts: 2,237 Joined: Dec 2013
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
I've never even heard of the Sencor, but I'm not the least bit surprised to learn of yet another Casio clone. What's a little surprising, though, is that it's quite a bit faster than the original.
05-15-2023, 06:50 PM
Post: #10
 Csaba Tizedes Senior Member Posts: 592 Joined: May 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
Another more faster clone is here:

05-15-2023, 06:51 PM
Post: #11
 Csaba Tizedes Senior Member Posts: 592 Joined: May 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
... and an accuracy test:

05-15-2023, 07:33 PM
Post: #12
 Dave Britten Senior Member Posts: 2,237 Joined: Dec 2013
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
(05-15-2023 06:50 PM)Csaba Tizedes Wrote:  Another more faster clone is here:

Wow, big difference on that one. Very interesting.
05-15-2023, 08:23 PM
Post: #13
 EdS2 Senior Member Posts: 541 Joined: Apr 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
(05-15-2023 06:51 PM)Csaba Tizedes Wrote:  ... and an accuracy test:
I checked against Free42 in decimal and in binary modes, and from this result one cannot tell the difference - and yet, between those modes, there is a big difference in precision!

Perhaps try
3*(4/3-1)-1
and
or better yet
sin(3.14159265358)
?
05-23-2023, 02:18 PM
Post: #14
 Dave Britten Senior Member Posts: 2,237 Joined: Dec 2013
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
I recently got an fx-50FHII, and ran the 8x8 benchmark. That one comes in at 00:05:49, which, interestingly, is exactly the same as what I measured on the fx-3650PII. Seems like maybe they use identical CPUs, with just software differences.
05-24-2023, 01:29 PM
Post: #15
 xerxes Member Posts: 156 Joined: Jun 2014
RE: N-queens for Casio fx-3650P, fx-3650PII, fx-50FH
(05-23-2023 02:18 PM)Dave Britten Wrote:  I recently got an fx-50FHII, and ran the 8x8 benchmark.

I've added the result to the list. Thank you for testing.

Yes, some Truly calculators are very fast, like the TG-202 or the second version of the SC-185.
The TG-202 is similar to the FX-7000G with a strange limitation of 111 steps for a program arae,
sold under different brands like Sagitta or Lexibook.

Calculator Benchmark
 « Next Oldest | Next Newest »

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