Post Reply 
Newbie Question: HP-55 Conditional Tests
07-12-2019, 06:24 PM
Post: #1
Newbie Question: HP-55 Conditional Tests
Hey everyone, I have some questions. I am very new to the world of HP calculators and RPN and I'm trying to make some simple games to get myself started. On rskey.org there is are two games for the HP-55 (my current calculator) and one of those is Nimb, or Nim. The version there is for one player and is against a computer opponent, so I thought I would make a two player version that I could play with a friend. For those who don't know how the game works, basically you draw from a pile of 15 sticks and try to make your opponent draw the last one. Okay, with that out of the way, here was my first piece of code:

1. FIX
2. 0
3. 1
4. 5
5. R/S
6. -
7. GTO 05

Pretty basic right? All this code does is display 15 and allow me to subtract however much I want from it by keying in a number and hitting R/S. This technically could be the game, but I wanted to polish it a bit. The biggest problem with this little program is that the game never ends, and you can keep subtracting sticks past 0. I thought that I would make the screen say "lose" or something when the game was over, and from there it could be reset. This was the part I was stuck on though, because it requires a conditional test and thats not a concept I completely get yet. This was my next piece of code; before making it run, I key in STO 3507 1 (or "Lose" upside down). All I have are a few examples to go off of, and I clearly didn't seem to understand why they work there but not here.
1. FIX
2. 0
3. 1
4. 5
5. R/S
6. -
7. 0
8. f
9. X < = Y (-12)
10. RDN
11. GTO 05
12. RCL
13. 1
14. GTO 00

I thought that this would act like the previous program did, allowing me to subtract from 15, but that when the number of sticks became less than or equal to 0 the "lose" message would be displayed. That's not the case; usually it lets me hit a number but then goes straight to "lose." Any advice? How exactly do the conditional tests work? How are X and Y even established to begin with? Hopefully I don't sound too dumb with this, but hey, we all gotta start somewhere.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Newbie Question: HP-55 Conditional Tests - snoman003 - 07-12-2019 06:24 PM



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