Post Reply 
(17B) Fifty Game
07-14-2014, 12:17 AM (This post was last modified: 06-15-2017 01:18 PM by Gene.)
Post: #1
(17B) Fifty Game
This game is a takeoff on the game of NIM. You are playing against the calculator. You go first, selecting a number from 1 to 6. Then the calculator selects a number from 1 to 6. The running total is maintained and can be checked via RCL SCORE. If you are able to reach the score of exactly 50 on your turn, you win and the calculator beeps its congratulations. Conversely, if the calculator is able to reach the score of exactly 50 on its turn, you lose and the display says COMP=3507. Turn the calculator upside down and observe that you LOSE.

Playing the game:
  1. Press INIT to reset the score to 0.
  2. Enter your guess (1-6) and press ME.
  3. Press COMP and the calculator makes its guess.
  4. Optionally, press RCL SCORE to see the current running score.
  5. Repeat steps 2 and 3 until either you or the calculator wins.
  6. If the calculator beeps, you won, congratulations (ignore the SOLUTION NOT FOUND message).
  7. If the response is COMP=3507, you lost.


Strategy

There is a strategy for winning the game every time (since you go first). See if you can figure it out. If you make a mistake, the calculator will win. Every time.

Below is the 17b solver code. The game also works on the 17bii, 19b, 19bii, and 27s (although the 19b, 19bii, and 27s have a random number function that could make the code simpler).

In the code, X means multiply. 0X means zero times.

Code:

50GAME:
IF(S(INIT):L(SCORE:0)-INIT:

0XL(SCORE:SCORE+ME)+
IF(SCORE=50:LOG(0):0)+

IF(L(A:MOD(SCORE-1:7))<>0:
    0XL(SCORE:SCORE+7-G(A))+
    IF(SCORE=50:3507:7-G(A)):
    L(A:MOD(IP(100XFP(SQRT(1E4XFP(CTIME)))):6)+1)
    +0XL(SCORE:SCORE+G(A))

   )

-COMP)
Find all posts by this user
Quote this message in a reply
07-14-2014, 05:58 AM
Post: #2
RE: (HP-17B) Fifty Game
Attachment:
The zip-file contains a state-file for Emu42.


Attached File(s)
.zip  50game.zip (Size: 2.72 KB / Downloads: 6)
Find all posts by this user
Quote this message in a reply
Post Reply 




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