Post Reply 
Thread for 67FUN2 game rom program development
11-22-2016, 08:02 PM
Post: #1
Thread for 67FUN2 game rom program development
No, I'm not suggesting a "jump right in" approach to this, but I'm posting a candidate or two for the next effort. As time permits, optimizing these can move ahead.


Robert has a version of a game of Bowling. Not a bowling scorekeeper program, but one that allows you to bowl. Post it in this thread when you can.

Here is a game I have hastily rewritten from a HP 67 User's Library program: Paper, Rock, Scissors.

Goal: Choose paper, rock or scissors and try to beat the calculator. Get to a score of 10 wins first to beat it. Each win is +1. Each loss is -1. Paper is A, Rock is B and CUT (scissors is too long) is C.

Obviously, the Seed? and RN routine would be modified as we did in 67FUN previously.

.raw file: PRS

Original program PDF - note that this has been modified already, but for reference purposes: PDF

And text listing of program here:

Code:
 01 LBL "PRS" 
 02 "SEED?" 
 03 PROMPT 
 04 STO 00 
 05 FIX 00 
 06 CLX 
 07 STO 01 
 08 RTN 
 09 LBL A 
 10 SF 01 
 11 1 
 12 GTO 00 
 13 LBL B 
 14 SF 02 
 15 2 
 16 GTO 00 
 17 LBL C 
 18 SF 03 
 19 3 
 20 LBL 00 
 21 XEQ 01 
 22 3 
 23 * 
 24 1 
 25 + 
 26 INT 
 27 STO 02 
 28 X=Y? 
 29 GTO 05 
 30 1 
 31 - 
 32 X=0? 
 33 GTO 02 
 34 1 
 35 - 
 36 X=0? 
 37 GTO 03 
 38 FS? 02 
 39 GTO 06 
 40 LBL 07 
 41 1 
 42 ST- 01 
 43 "LOSE" 
 44 GTO 08 
 45 LBL 02 
 46 FS? 02 
 47 GTO 07 
 48 GTO 06 
 49 LBL 03 
 50 FS? 03 
 51 GTO 07 
 52 LBL 06 
 53 1 
 54 ST+ 01 
 55 "WIN" 
 56 LBL 08 
 57 >" " 
 58 ARCL 01 
 59 AVIEW 
 60 PSE 
 61 PSE 
 62 PSE 
 63 "Y:" 
 64 FS?C 01 
 65 >"PAP" 
 66 FS?C 02 
 67 >"ROCK" 
 68 FS?C 03 
 69 >"CUT" 
 70 >" HP:" 
 71 RCL 02 
 72 1 
 73 - 
 74 X=0? 
 75 >"PAP" 
 76 1 
 77 - 
 78 X=0? 
 79 >"ROCK" 
 80 X!=0? 
 81 >"CUT" 
 82 PROMPT 
 83 RTN 
 84 LBL 05 
 85 "TIE" 
 86 GTO 08 
 87 LBL 01 
 88 RCL 00 
 89 R-D 
 90 FRC 
 91 STO 00 
 92 END
Find all posts by this user
Quote this message in a reply
11-22-2016, 10:37 PM (This post was last modified: 11-22-2016 11:21 PM by Dieter.)
Post: #2
RE: Thread for 67FUN2 game rom program development
(11-22-2016 08:02 PM)Gene Wrote:  Here is a game I have hastily rewritten from a HP 67 User's Library program: Paper, Rock, Scissors.

Goal: Choose paper, rock or scissors and try to beat the calculator. Get to a score of 10 wins first to beat it. Each win is +1. Each loss is -1. Paper is A, Rock is B and CUT (scissors is too long) is C.

How do you like the attached version?
The program uses a very compact evaluation routine – no flags, no elaborate tests, and the XROM version does it in 157 bytes.

PRS2a has its own seed prompt and RNG, while PRS2_XROM uses the two XROM functions of the Games ROM.

Code:
XEQ "PRS"        SEED?
0,12345 [R/S]    SCORE: 0

  [A]            YOU-PAPER
                  HP-ROCK
                 YOU WIN
                 SCORE: 1

  [B]            YOU-ROCK
                  HP-SCISSORS
                 YOU WIN
                 SCORE: 2

  [C]            YOU-SCISSORS
                  HP-SCISSORS
                 A TIE
                 SCORE: 2

  [B]            YOU-ROCK
                  HP-PAPER
                 YOU LOSE
                 SCORE: 1
  ...            ...

The program uses a synthetic RCL d/STO d to save/restore the display setting.

BTW, there also is an alternate version that displays both players in one line:
Code:
  [B]            ROCK
                 ROCK : SCISS
                 YOU WIN
                 SCORE: 2

Dieter


Attached File(s)
.zip  PRS2.zip (Size: 1.52 KB / Downloads: 5)
Find all posts by this user
Quote this message in a reply
11-23-2016, 01:21 AM
Post: #3
RE: Thread for 67FUN2 game rom program development
Great, thank you.

Here are a few more to have on file here as time permits for anyone to convert to the HP 41. I'm well aware this is a LONG term effort, but just in case - :-)

HP-33E Time Traveler

HP-67 Catch me

HP-67 Mine Field

HP-67 Pegs

HP-67 Othello from the museum posting

HP-67 Shooting Gallery

Then some .raw files we had seen before but deferred:

HP-67 Wari

HP-67 Roulette

Bell Fruit Slot machine - another good one


Here is a link to a 50MB .zip file of some HP-67 programs - some from PPC and some from the User's Library: Worth downloading... .zip of HP-67 programs
Find all posts by this user
Quote this message in a reply
11-23-2016, 01:58 PM (This post was last modified: 11-23-2016 02:07 PM by Dieter.)
Post: #4
RE: Thread for 67FUN2 game rom program development
(11-22-2016 10:37 PM)I Wrote:  The program uses a very compact evaluation routine – no flags, no elaborate tests

Maybe I should explain how this works.

Let Paper=3, Rock=2 and Scissors=1. If a and b are the moves of the two players, then (a–b) mod 3 returns 1 or 2 if the first resp. second player wins. Zero represents a tie. This works if –2 mod 3 is evaluated as 1, like the 41 does it (on the 34s use MOD, not RMDR). On calculators without mod function you simply add 3 if a–b is negative. You can even go one step further and calculate 2x this minus 3 to get –1 or +1 for the score counter (a tie has to be handled separately).

If you prefer Paper=1, Rock=2 and Scissors=3, as in the original program, simply replace a–b with b–a. Or change the logic (1 = player 1 loses, 2 = player 2 loses).

So the score evaluation in PRS2a can be done in just three steps (51...53): Y and X hold the player's and HP's move, and "– 3 MOD" yields 1 (player wins) or 2 (HP wins) or 0 (a tie). In the latter case the program jumps to LBL 04, else the test whether X is 1 or 2 is done with a DSE X. This yields 0 or 1, and if it's 1, DSE tests true and jumps to LBL 05 (HP wins), else the player wins.

Another elegant option could be a simple indirect jump. This method is used in the following variation of the game. Here also the original definition Paper=1, Rock=2 and Scissors=3 was used and the both players' moves are displayed in one line. Here is the listing:

Code:
 01 LBL "PRS"
 02 RCL 00
 03 "SEED?"
 04 PROMPT
 05 ABS
 06 FRC
 07 STO 00
 08 SF 27
 09 LBL E
 10 CLX
 11 STO 01
 12 LBL 10
 13 RCL d
 14 FIX 0
 15 CF 29
 16 "SCORE: "
 17 ARCL 01
 18 STO d
 19 RDN
 20 RCL 01
 21 AVIEW
 22 RTN
 23 LBL A
 24 1
 25 GTO 00
 26 LBL B
 27 2
 28 GTO 00
 29 LBL C
 30 3
 31 LBL 00
 32 CLA
 33 XEQ IND X
 34 AVIEW
 35 PSE
 36 RCL 00
 37 PI
 38 +
 39 X^2
 40 FRC
 41 STO 00
 42 3
 43 *
 44 1
 45 +
 46 INT
 47 >" : "
 48 XEQ IND X
 49 AVIEW
 50 PSE
 51 -
 52 3
 53 MOD
 54 4
 55 +
 56 XEQ IND X
 57 ST+ 01
 58 AVIEW
 59 PSE
 60 PSE
 61 GTO 10
 62 LBL 04
 63 "A TIE"
 64 CLX
 65 RTN
 66 LBL 05
 67 "YOU LOSE"
 68 -1
 69 RTN
 70 LBL 06
 71 "YOU WIN"
 72 1
 73 RTN
 74 LBL 01
 75 >"PAPER"
 76 RTN
 77 LBL 02
 78 >"ROCK"
 79 RTN
 80 LBL 03
 81 >"SCISS"
 82 END

That's 161 Bytes including seed prompt, RNG and an additional restart label E.

If you don't know how to enter the synthetic RCL d and STO d commands, simply replace line 18/19 with FIX 4  SF 29 and omit the RCL d in line 13.

Dieter
Find all posts by this user
Quote this message in a reply
11-23-2016, 09:18 PM (This post was last modified: 11-24-2016 07:30 AM by Dieter.)
Post: #5
RE: Thread for 67FUN2 game rom program development
(11-22-2016 10:37 PM)Dieter Wrote:  BTW, there also is an alternate version that displays both players in one line:

Code:
  [B]            ROCK
                 ROCK : SCISS
                 YOU WIN
                 SCORE: 2

The one-line display of course works best if the three symbols do not have more than six, perferably five characters so that they fit the 12-character display of the 41. I tried this with a localized version in German (with "Stein", "Papier", "Schere" – all with 5 or 6 characters) which at least fits with a colon as a separator. How would you do this in English? Maybe replace the rock with a stone and the scissors with a knife ?-) This would fit the display perfectly.

BTW, in Germany this game is called "Schnick-Schnack-Schnuck". I think this sounds much more charming than "Stein, Schere, Papier". ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




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