(20S, 21S) N-Queens Benchmark - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (20S, 21S) N-Queens Benchmark (/thread-18065.html) |
(20S, 21S) N-Queens Benchmark - Dave Britten - 02-22-2022 09:05 PM Another pair of calculators with no indirect addressing that you would think can't handle the N-Queens solver. The "chopping block" algorithm featured in "Mathematical Recreations for the Programmable Calculator" is suitable for both of these models, although it does require some finesse to fit the program into the 99 available steps of memory while also coping with the algebraic input and two available comparison tests (x=0, x<=y). To run this program, enter the board size (e.g. 8 for 8x8), and press XEQ A. For an 8x8 board, the program will stop with the first solution in approximately 5m12s on a 20S (the 21S is probably the same speed, but I haven't tested it). You can press R/S to continue finding more solutions, and the program will stop with -1 in the display when no more solutions can be found. The program can handle board sizes up to 9x9. Code: LBL 0 |