hp41programs

Template

Solitaire for the HP-41CX


Overview
 

 1°)  Game n°1
 2°)  Game n°2


-We use a deck of an infinite number of one-suit cards.
-In other words, the probability of each card is 1/13


1°)  Game n°1


-The HP41 deals 10 cards.

-According to your own rules, you discard 2 cards.
-You win 1 point each time, and when it becomes impossible to continue, the HP41 displays your score.

-Initialize register R00 with a pseudo-random seed.


Data Registers:   • R00 = random number     R01 thru R12: temp    R11 = your score
Flags: /
Subroutines: /



 01 LBL "PAT"
 02 FIX 0
 03 CF 29
 04 10
 05 STO 12          
 06 LBL 01
 07 XEQ 04
 08 X<> Z
 09 DSE X
 10 GTO 01
 11 STO 11
 12 LBL 02
 13 RCL 12
 14 " "
 15 LBL 03
 16 ARCL IND X
 17 DSE X
 18 GTO 03
 19 AVIEW
 20 59
 21 GETKEYX
 22 X=0?
 23 GTO 05
 24 LASTX          
 25 ST- Y
 26 GETKEYX
 27 LASTX
 28 X<>Y
 29 -
 30 RCL 12
 31 X#Y?
 32 MOD
 33 R^
 34 XEQ 04
 35 R^
 36 XEQ 04
 37 ST+ 11
 38 GTO 02
 39 LBL 04
 40 RCL 00          
 41 R-D
 42 FRC
 43 STO 00
 44 13
 45 *
 46 INT
 47 CLA
 48 DSE X
 49 ARCL X
 50 X<0?
 51 "K"
 52 X=0?
 53 "Q"
 54 RCL 12          
 55 X<Y?
 56 "J"
 57 X=Y?
 58 "T"
 59 SIGN
 60 X=Y?
 61 "A"
 62 ASTO IND Z
 63 RTN
 64 LBL 05          
 65 " "
 66 ARCL 11
 67 >" PTS"
 68 FIX 4
 69 AVIEW
 70 END

     
         ( 118 bytes / SIZE 013 )


          STACK            INPUT         OUTPUT
              X                /                /


Example:
  If you choose 1 as the random seed

  1  STO 00  XEQ "PAT"   >>>>>                  2J26JQ46T8    if you choose to discard cards number 1 & 3  ( from the left )

            1      3        the display becomes:          5J86JQ46T8     -------------------------------------  3  & 10

            3      0        ---------------------          5J36JQ46TQ    and so on

-When - according to your rules - it is impossible to discard, press for example  ENTER
  and the HP41 displays your score ( in register R11 )


Notes:

-You have 59 seconds to choose the cards to discard.
-Press 0 to discard the 10th card ( from the left ) only the second card.

-To stop the game, press a key that is neither a number, nor a decimal point nor CHS

-A possible rule of the game is to discard pairs & blackjack
  ( 2 2  .....   A A  &  A T  or  A J  or  A Q  or A K )
-But there are many other choices...


2°)  Game n°2


-The HP41 also deals 10 cards.

-In this variant, you place one card on another card if the difference between their values = 1
-The first card is replaced by a random card.

-When it becomes impossible to continue, the HP41 displays your score.


Data Registers:   • R00 = random number     R01 thru R14: temp        R13 = your score
Flags: /
Subroutines: /



 01 LBL "PAT"
 02 FIX 0
 03 CF 29
 04 1.01
 05 STO 11
 06 STO 12
 07 10
 08 STO 14          
 09 LBL 01
 10 XEQ 04
 11 ASTO IND 11
 12 ISG 11
 13 GTO 01
 14 CLX
 15 STO 13
 16 LBL 02
 17 RCL 12          
 18 " "
 19 LBL 03
 20 ARCL IND X
 21 ISG X
 22 GTO 03
 23 AVIEW
 24 48
 25 GETKEYX
 26 X=0?
 27 GTO 05
 28 LASTX
 29 GETKEYX
 30 LASTX
 31 ST- T
 32 -
 33 STO 11          
 34 R^
 35 X=0?
 36 RCL 14
 37 X<> 11
 38 X=0?
 39 RCL 14
 40 RCL IND 11
 41 STO IND Y
 42 XEQ 04
 43 ASTO IND 11
 44 ISG 13
 45 CLX
 46 GTO 02
 47 LBL 04
 48 RCL 00          
 49 R-D
 50 FRC
 51 STO 00
 52 13
 53 *
 54 INT
 55 CLA
 56 DSE X
 57 ARCL X
 58 X<0?
 59 "K"
 60 X=0?
 61 "Q"
 62 RCL 14          
 63 X<Y?
 64 "J"
 65 X=Y?
 66 "T"
 67 SIGN
 68 X=Y?
 69 "A"
 70 RTN
 71 LBL 05
 72 " "
 73 ARCL 13
 74 >" PTS"
 75 FIX 4
 76 AVIEW
 77 END

     
         ( 129 bytes / SIZE 015 )


          STACK            INPUT         OUTPUT
              X                /                /


Example:
  If you choose 1 as the random seed

  1  STO 00  XEQ "PAT"   >>>>>                  2J26JQ46T8         you can place a    J  on   Q   or  on   T

-If you choose  J on T   press    2    6      ->     2526JJ46T8          Q  has been raplaced by  J   and   5   has replaced   J


Notes:

-You have 48 seconds to choose the cards.
-Press 0 to indicate the 10th card ( from the left )
-An A may be put on a K or a 2.

-When it becomes impossible to continue, press a key that is neither a number, nor a decimal point nor CHS.

-With 1 as random seed, the final score is at least 61 points.

-The calculator does not check the difference between the cards values,
-So, you can use your own rules...