This program was first published in the HP-41C Users' Library Solutions: Games by Hewlett-Packard and is used here by permission.
This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
Wari* is a board game which has been played for at least several centuries in various forms throughout Africa. The game is played on a board containing (generally) twelve small pits or bins, and two large pits. Forty-eight beads, seeds, or other counters are moved and captured according to certain rules.
The Wari board shown here is set up to begin a game.
Each player in turn removes all the counters from one bin on his side and distributes them one-at-a-time into successive bins moving counterclockwise, skipping the two bins which are for storing captured counters. If the last counter drops into an opponent's hole containing one or two counters, the contents of that hole are captured and placed in the player's scoring pit. Counters in an unbroken sequence of two- and three-counter bins on the opponent's side clockwise from the captured bin are also captured. If a bin contains twelve counters or more, that bin is skipped when the counters from that bin are distributed.
The above rules are implemented in the calculator program. Special rules, such as prohibiting moves which remove all of the opponent's counters, were deemed to be variations of the basic game and were not programmed. It is possible to come to a situation where a few counters will circulate forever. In this case each player claims the counters on his side.
To make a play on the calculator Wari board, the player specifies the bin he wants to move by keying in a number from 1 to 6 and then pushing either [A] or [B] (for player A or B). The machine then moves the counters from the specified bin according to the rules. To play against the calculator, signal to the calculator to move by pressing [C]. The calculator will then move player B's counters.
When one of the sites of the board is displayed, as designated by leading A or B, it is as if you moved around to that side of the board. In other words, bin 1 for either players side is always to the left and counterclockwise always to the right. If you are looking at side A, [R/S] will get you side B. If you are looking at side B, [R/S] will get you the score. If you are looking at the score, [R/S] will get you side A.
*Also known as Man-Kalah, Awari, and many other names.
Note: Requires 1 Memory Module on HP-41C
Step |
Instructions |
Input Data/Units |
Keys |
Output Data/Units |
1 |
Enter program |
|||
2 |
Initialize |
|
[XEQ] WARI |
SEED? |
3 |
Key in number between 0 and 1 |
seed |
[R/S] |
A 4,4,4,4,4,4 |
4 |
To see the other side of the board and/or the score, press [R/S]. This can be done as often as desired. |
|
[R/S] |
A (board) or B (board) or A= or B= |
5 |
Players A, B or the 41C moving B's counters can move in any order with anyone starting the game. |
|
|
|
Player A |
bin # |
[A] |
A (board) |
|
Player A |
bin # |
[B] |
A (board) |
|
HP-41C (moving for B) |
[C] |
A (board) |
||
6 |
Go to step 4 or 5 as desired. |
|
|
|
7 |
To start a new game press [E] and go to step 4 or 5 as desired. |
|
[E] |
A 4,4,4,4,4,4 |
Keystrokes: Display: [XEQ] [ALPHA] SIZE [ALPHA] 018 [XEQ] [ALPHA] WARI [ALPHA] SEED? .9977663333 [R/S] A 4,4,4,4,4,4 [R/S] B 4,4,4,4,4,4 [R/S] A=0, B=0 [C] A 5,5,4,4,4,4 [R/S] B 4,4,4,0,5,5 6 [A] A 5,5,4,4,4,0 [R/S] B 5,5,5,1,5,5 [C] A 6,6,4,4,4,0 [R/S] B 5,5,0,2,6,6 2 [A] A 6,0,5,5,5,1 [R/S] B 6,6,0,2,6,6 [C] A 7,1,6,6,6,0 [R/S] B 6,6,0,2,6,0 [R/S] A=0, B=2 . . . . . .
LINE KEYS 01 LBL "WARI" 02 SF 27 Initialize 03 CF 29 04 FIX 0 05 "SEED?" 06 PROMPT 07 STO 00 08 LBL E 09 1.012 10 CLRG 11 4 12 LBL 06 13 STO IND Y 14 ISG Y 15 GTO 06 16 GTO 50 17 LBL C 18 CF 05 41C move 19 0 20 STO 17 21 STO 15 22 2 23 XEQ 51 24 CF 06 25 X=0? 26 SF 06 27 CF 07 28 7.012 29 STO 16 30 LBL 05 Offense 31 RCL 16 32 INT 41C pit # 33 RCL IND 16 41C counters 34 X=0? 35 GTO 00 36 RCL X 37 12 38 / 39 INT 40 STO T 41 + 42 + 43 12 44 MOD 45 X=0? 46 X<> L Player pit # 47 7 48 X<=Y? 49 GTO 00 50 X<>Y 51 R^ 52 CHS 53 RCL IND Y Player counters 54 X<=Y? 55 GTO 00 56 X<>Y 57 3 58 + 59 X<=Y? 60 GTO 00 61 SF 07 62 RCL Z 63 RCL 17 64 X>Y? 65 GTO 00 66 X!=Y? 67 GTO 01 68 FS? 06 69 GTO 00 70 LBL 01 71 RDN 72 STO 17 73 RCL 16 74 STO 15 75 LBL 00 76 ISG 16 77 GTO 05 78 FC?C 07 79 GTO 00 80 RCL 15 Found an offensive move 81 INT 82 GTO A 83 LBL 00 84 6 85 STO 16 86 0 87 STO 15 88 LBL 04 Defense 89 RCL 16 Player's pit # 90 RCL IND 16 Player's counters 91 X=0? 92 GTO 00 93 RCL X 94 12 95 / 96 INT 97 X>0? 98 GTO 00 99 RDN 100 + 101 12 102 MOD 103 X=0? 104 LASTX 41C pit # 105 7 106 X>Y? 107 GTO 00 108 RCL IND Y 41C counters 109 X=0? 110 GTO 00 111 3 112 X<=Y? 113 GTO 00 114 SF 07 115 R^ 116 RCL 15 117 X<=Y? 118 X<>Y 119 STO 15 120 LBL 00 121 DSE 16 122 GTO 04 123 FC?C 07 124 GTO 00 125 RCL 15 Defensive move found 126 GTO A 127 LBL 00 128 6 129 XEQ 51 130 1 131 + 132 STO 15 133 STO 16 134 LBL 03 Random move 135 6 136 + 137 RCL IND X 138 X!=0? 139 GTO 00 140 RCL 15 141 1 142 - 143 6 144 MOD 145 X=0? 146 LASTX 147 RCL 16 148 X=Y? 149 GTO 01 150 RDN 151 STO 15 152 GTO 03 153 LBL 01 154 SF 05 155 "NO MOVE" 156 AVIEW 157 STOP 158 GTO 50 159 LBL 00 160 RCL 15 161 LBL B 162 6 Player B 163 + 164 CF 05 165 LBL A 166 STO 15 167 STO 17 Player A 168 RCL IND 15 169 X=0? 170 GTO 50 171 STO 16 172 ST- IND 15 173 LBL 08 Distribute counters 174 RCL 17 175 1 176 + 177 12 178 MOD 179 X=0? 180 LASTX 181 STO 17 182 RCL 15 183 X=Y? 184 GTO 08 185 1 186 ST+ IND 17 187 DSE 16 188 GTO 08 189 LBL 07 190 RCL 17 191 7 192 FS? 05 193 GTO 01 194 X<=Y? 195 GTO 50 196 GTO 00 197 LBL 01 198 X>Y? 199 GTO 50 200 LBL 00 Capture pits 201 RCL IND 17 202 2 203 X>Y? 204 GTO 50 205 RDN 206 4 207 X<=Y? 208 GTO 50 209 RDN 210 FS? 05 211 ST+ 13 212 FC? 05 213 ST+ 14 214 ST- IND 17 215 RCL 17 216 1 217 - 218 12 219 MOD 220 X=0? 221 LASTX 222 STO 17 223 GTO 07 224 LBL 50 225 SF 05 Output 226 "A " 227 1.006 228 XEQ 00 229 PROMPT A board 230 "B " 231 7.012 232 XEQ 00 233 PROMPT B board 234 "A=" 235 ARCL 13 236 ", B=" 237 ARCL 14 238 PROMPT Score 239 GTO 50 240 LBL 09 241 "," 242 LBL 00 243 ARCL IND X 244 ISG X 245 GTO 09 246 RTN 247 LBL 51 Random number generator 248 RCL 00 249 9821 250 * 251 .211327 252 + 253 FRC 254 STO 00 255 * 256 INT 257 RTN 258 .END.
R00 Seed R01 Bin A1 R02 A2 R03 A3 R04 A4 R05 A5 R06 A6 R07 Bin B1 R08 B2 R09 B3 R10 B4 R11 B5 R12 B6 R13 Score A R14 Score B R15 Used R16 Used R17 Used
05 A's move / B's move 06 Used 07 Found one to attack
Go back to the HP-41 software library
Go back to the general software library
Go
back to the main exhibit hall