Find the hidden path solver equation for 17b/19b/27s
|
06-30-2014, 11:34 PM
(This post was last modified: 07-21-2014 12:07 AM by Don Shepherd.)
Post: #1
|
|||
|
|||
Find the hidden path solver equation for 17b/19b/27s
I've always wanted to write a program that requires the user to actually think to achieve a goal. This program does that. The calculator creates a path from left to right in an 8-by-8 grid. Your goal is to determine the location of the path in that grid by making guesses and recording and analyzing the feedback that you receive after each guess. The fewer number of guesses you make to determine the position of the path, the better. Eight guesses would, of course, be a perfect score, because each column contains exactly one point in the path. Each point in the path "touches" the point on the path in the preceding and following column.
The game is sort of like Battleship, with the addition of feedback. The feedback tells you how many points in the path are adjacent to your guess. You record the feedback on a template, listed below. By analyzing the feedback, you can sometimes determine where the next point has to be, or where the next point cannot be. That is the "thinking" part. I first wrote the game for the Radio Shack PC-2 in BASIC, then for the HP-71b in BASIC, then for the HP-32sii in RPN keystroke, and finally for the 17b/19b/27s series solvers. The 17b version requires extra code to generate a random number; the 19b and 27s versions use the RAN# solver function for this. I have attached information files to this article for the PC-2, HP-71b, and HP-32sii versions of this program. There are slight differences between these versions and the 17b version. The PC-2 information file contains only a code listing. I am reasonably sure that these versions work correctly on the corresponding machines, although I don't have a PC-2 or HP-71b to verify that since I trimmed back my calculator collection last year. Note on entering solver equations: Entering long solver equations can easily be very frustrating. Just take your time. These equations as listed will work, but it takes time to enter them. It helps greatly to do it in stages. For instance, begin by entering this: IF(S(INIT):1-INIT:2-EVAL) Then CALC the equation to make sure it is right. Then, replace the 1 with everything under section A. Then CALC again to make sure everything has been entered correctly. At this point, do a little testing. When you press INIT, variable A will contain 8 digits, the row numbers of the generated path. But you won't see A in the menu, so how can you check? You can add this code at the beginning of the equation: 0XA+ (X means times) That will cause variable A to appear on the menu, and after you press INIT you can RCL A to verify that it contains a valid path. The 8 digits should be between 1 and 8 and each successive digit should be either the same as the previous digit or 1 greater or less. For example, these are valid values for A: 55,676,778, 22,334,565, 32,112,323, and so on. Don't forget to remove 0XA+ unless you want to be able to get a perfect score every time, but that's not much fun frankly. Once you verify that the equation is generating a valid path in variable A, then enter the B section part in place of the 2, then CALC the equation again to make sure it is correct. The only spaces required in the equation are around the two OR operators toward the end of the equation; ANDs and ORs require spaces around them, but all other spaces are ignored. I suggest not entering any formatting spaces on the actual calculator, it will just increase the size of the equation unnecessarily. To get a space, in ALPHA mode press the rightmost menu key (WXYZ) and then the menu key after Z (with a blank space above it). That will add a space. To delete a character, press the left arrow key under the EXIT key. That will delete the character to the left of the flashing cursor. If you get frustrated, take a break, or if you get stumped, post a message in the forum. Lots of people know lots about how the solver works. Here is the solver equation for the 17b/17bii: Code:
Here is the solver equation for the 19b/19bii/27s (using RAN# solver function) Code:
|
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Find the hidden path solver equation for 17b/19b/27s - Don Shepherd - 06-30-2014 11:34 PM
|
User(s) browsing this thread: 3 Guest(s)