The figures 1 through 6 are mixed by a random number generator and then displayed. By means of application of suitable permutations the natural order 123456 has to be restored. Nine different permutations are available :
permutation | |
1. with 4. position and 2. with 3. position | |
2. with 5. position and 3. with 4. position | |
3. with 6. position and 4. with 5. position | |
4. with 1. position and 5. with 6. position | |
5. with 2. position and 6. with 1. position | |
6. with 3. position and 1. with 2. position | |
The last three permutations should be used only "in emergency" (in case one of them is appropriate as the very last operation). In fact the random order of the figures at the beginning isn't obtained by application of some permutations to the order 123456, but by "throwing dice". Therefore it's possible, that the natural order can't be restored by only using the first six permutations and two figures remain false. In this case you have to apply one of the last three operations.
Course of Game :
On starting the program the HP-41CX asks for a seed for the random number generator. Now the random order of the figures 1 through 6 is calculated and then displayed.
By means of the smallest number of appropriate permutations (see table above) the natural order 123456 has to be restored. To apply a permutation the corresponding key follwed by R/S has to be pressed. At the end the number of permutations and the required time is displayed.
Program Listing :
001 LBL "GAME3" 002 E-2 003 CLRGX 004 "123456" 005 ASTO 09 006 44 007 STO 02 008 STO 03 009 STO 04 010 STO 05 011 STO 06 012 STO 07 013 2,007 014 STO 01 015 RCLFLAG 016 STO 08 017 " " (F7 00 00 00 32 00 C0 00) 018 RCL M 019 STO d 020 CLST 021 SETSW 022 E 023 " RNG-SEED :" 024 PROMPT 025 STO 00 026 " MIXING" 027 AVIEW 028 LBL 10 029 XEQ 00 030 5 031 + 032 FS? IND X 033 GTO 10 034 SF IND X 035 ST+ IND 01 036 ISG 01 037 GTO 10 038 BEEP 039 LBL 11 040 CLA 041 XEQ 12 042 ASTO X 043 X=NN? 044 GTO 13 045 RUNSW 046 PROMPT 047 STOPSW 048 XEQ IND X 049 ISG 10 050 "" (NOP) 051 GTO 11 052 LBL 01 053 2,005 054 REGSWAP 055 3,004 056 REGSWAP 057 RTN 058 LBL 02 059 3,006 060 REGSWAP 061 4,005 062 REGSWAP 063 RTN 064 LBL 03 065 4,007 066 REGSWAP 067 5,006 068 REGSWAP 069 RTN 070 LBL 04 071 5,002 072 REGSWAP 073 6,007 074 REGSWAP 075 RTN 076 LBL 05 077 6,003 078 REGSWAP 079 7,002 080 REGSWAP 081 RTN 082 LBL 06 083 7,004 084 REGSWAP 085 2,003 086 REGSWAP 087 RTN 088 LBL 07 089 2,003 090 REGSWAP 091 RTN 092 LBL 08 093 4,005 094 REGSWAP 095 RTN 096 LBL 09 097 6,007 098 REGSWAP 099 RTN 100 LBL 00 101 RCL 00 102 R-D 103 R-D 104 FRC 105 R-D 106 FRC 107 STO 00 108 E6 109 * 110 INT 111 6 112 MOD 113 RTN 114 LBL 12 115 RCL 02 116 XTOA 117 RCL 03 118 XTOA 119 RCL 04 120 XTOA 121 RCL 05 122 XTOA 123 RCL 06 124 XTOA 125 9 126 RCL 07 127 XTOA 128 RTN 129 LBL 13 130 RCL 10 131 X=0? 132 GTO 10 133 BEEP 134 AVIEW 135 PSE 136 PSE 137 "TRIES : " 138 ARCL 10 139 AVIEW 140 PSE 141 PSE 142 "REQUIRED" 143 AVIEW 144 PSE 145 "TIME IN H.:" 146 AVIEW 147 PSE 148 RCLSW 149 FIX 6 150 VIEW X 151 CLA 152 RCL 08 153 STOFLAG 154 E-2 155 CLRGX 156 STOPSW 157 CLST 158 SETSW 159 END
Back to HP-41CX Selected (game) programs
Back to Natural Sciences and Mathematical Games
Kai Schröder, 30.5.2001