Thread for 67FUN2 game rom program development
|
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" 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 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Thread for 67FUN2 game rom program development - Gene - 11-22-2016, 08:02 PM
RE: Thread for 67FUN2 game rom program development - Dieter - 11-22-2016, 10:37 PM
RE: Thread for 67FUN2 game rom program development - Dieter - 11-23-2016 01:58 PM
RE: Thread for 67FUN2 game rom program development - Dieter - 11-23-2016, 09:18 PM
RE: Thread for 67FUN2 game rom program development - Gene - 11-23-2016, 01:21 AM
|
User(s) browsing this thread: 1 Guest(s)