HP Articles Forum
[Return to the Index ]
[ Previous | Next ]
Find the hidden path game for HP-32sii
Posted by Don Shepherd on 27 Sept 2011, 9:41 p.m.
This game is a keystroke program that runs on the HP-32sii calculator.
The object of the game is to discover the calculator-generated hidden path location in an 8-by-8 grid by making the fewest number of guesses. The path goes from left to right, beginning in column 1 and ending in column 8. There are exactly 8 points in the path, one in each column, and each point touches the previous and next points in the path. Once you have discovered a point in the path, the next point to the right will be in one of three places: to its upper right, directly to its right, or to its lower right.
Use the printed template to keep track of your guesses. The columns are identified as 1 through 8, and the rows are also 1 through 8. When you enter a guess, it must be in the format of row.column, like 5.1 for row 5 column 1, or 3.7 for row 3 column 7. Enter your guess when you see the N? prompt. In response to your guess, the calculator will give you feedback (feedback appears with a PSE, so pay attention):
If you get a response of 99, put a dot in the cell on the included sheet corresponding to your guess, that is a point on the path, and there is no other point on the path in that column. If the response is 0 through 3, write that number in the corresponding cell on the sheet, and you will use that information as a basis for making your next guess.
“Adjacent to your guess” means one of the eight cells touching the cell you guessed: above, below, to the left, to the right, or one of the the four corners. When you have correctly guessed all eight points in the path, the calculator displays how many guesses it took. The minimum would be 8, of course, and the closer your number of guesses is to 8, the better your score.
The challenge of the game is to make intelligent guesses based upon the feedback you get after each guess. Sometimes that feedback will tell you where a point has to be, and it may tell you that a given point cannot be on the path. You’ve got to think. And thinking is good.
By the way, I also developed a solver equation for playing this game on the HP-17bii. Contact me if you are interested.
Here is a listing of the 32sii program:
Find the Hidden Path program for HP-32sii:
A - 8 row numbers of actual path (12345678) I - loop index at first, then # guesses J - row # of previous column at first, then # points found so far K - row number in your guess (decoded from IP(N)) L - col number in your guess (decoded from FP(N)) N - checking adjacency of prev/next column (and other things) R - feedback from your guess
Feedback from your guess: 0 - no points adjacent to your guess are on the path 1 - 1 point adjacent to your guess is on the path 2 - 2 points adjacent to your guess are on the path 3 - 3 points adjacent to your guess are on the path 99 - your guess is on the path
LBL A entry point, XEQ A 8 get random 1-8 for row of path in col 1 XEQ M gets the random number STO J store in J for use in next loop iteration 10 multiply to store in first column position in register A 7 Y^X X STO A sets first column path row#, now determine path of cols 2-8 2.008 loop from cols 2 to 8, create the path STO I loop index LBL B begin loop 1 if previous col row# was 1 or 8, handle differently RCL J X=Y GOTO C then this col row# must be 1 or 2 only 8 X=Y GOTO E then this col row# must be 7 or 8 only 3 XEQ M otherwise this col row# can be 3 possible choices RCL+J add to previous col row# 2 - subtract 2 to make it correct LBL D set this column row# (common code for labels C and E also) STO J first, save current column row# for next loop iteration 10 8 this code stores the path row numbers of columns 2-8 in variable A RCL I IP - Y^X X STO+A adds row# to register A ISG I iterate loop GOTO B calc the next column row# 0 initialize two variables to 0 STO I num guesses STO J num points found LBL G begin loop to input your guess and give feedback INPUT N enter row.col of guess IP STO K row of guess LASTX FP 10 X STO L col of guess 1 STO+I increment guess count 0 STO R initialize response to 0 RCL L guess col STO N so subroutine J doesn't have to get it from the stack XEQ J get path row# of guess col RCL K get guess row# X=/=Y it wrong, check prev and next cols GOTO H 99 otherwise return 99 as repsonse STO R 1 increment num of points found STO+J GOTO K and exit to display response LBL H check adjacency of previous, next, and guess column -1 check previous column STO N 1 unless you are checking column 1 (no previous col) XEQ L 1 check next column STO N 8 unless you are checking column 8 (no next col) XEQ L RCL L check current column for adjacency XEQ N LBL K display response R VIEW R 99=point on path else # of adjacent cells on the path PSE so it will continue without R/S 8 if found all 8 points on path, display total guesses and stop RCL J X=/=Y GOTO G get next guess RCL I total guesses RTN stop LBL M routine to get a random number from 1 to x-register RAND 100 X IP X<->Y flip so you get y mod x 0 ENTER Katie's routine COMPLEX+ / IP X - this gives the mod 1 + add 1 to it so get the right number RTN LBL L check columns for adjacent points and increment R if found RCL L guess column X=Y if guess col=1, don't check previous column RTN if guess col=8, don't check next column RCL N will be +/-1 to check next or prev column + LBL N STO N so subroutine J doesn't have to get it from the stack XEQ J get actual path row# RCL-K subtract guess row from actual path row# ABS 1 X>=Y diff greater than 1 means guess is not adjacent STO+R else increment R response RTN LBL J get actual path row# from variable A RCL A register A holds all the path row numbers 10 going to raise 10 to a power based on register N 9 need to subtract N from 9 to get correct power RCL-N Y^X raise 10 to power / and divide it into register A FP 10 X IP this returns the path row# RTN LBL C this col row# must be 1 or 2 only 2 XEQ M GOTO D LBL E this col row# must be 7 or 8 only 2 XEQ M 6 + GOTO D
Edited: 22 Dec 2011, 6:37 a.m.
[ Return to the Message Index ]
Go back to the main exhibit hall