AwariAwari is an ancient African game. The board is divided into six compartments or pits on each side (numbered as shown below). In addition, there are two special home pits at the ends: My Side A move is made by taking all of the beans from any (non-empty) pit on your own side. Starting from the pit to the right of this one, these beans are 'sown' one in each pit working around the board anticlockwise. A turn consists of one or two moves. If the last bean of your move is sown in your own home you may take a second move. If the last bean sown in a move lands in an empty pit, provided that the opposite pit is not empty, all the beans in the opposite pit, together with the last bean sown, are 'captured' and moved to the player's home. |
This chapter is adapted from the book Basic Computer Games Small Basic Edition published by BibleByte Books. To purchase this book in its entirety, please see the Computer Science For Kids web site. |
When either side is empty, the game is finished. The player with the most beans in his home has won. In the computer version, the board is printed as 14 numbers representing the 14 pits. 3 3 3 3 3 3 The pits on your (lower) side are numbered 1-6 from left to right. The pits on my (the computer's) side are numbered from my left (your right). To make a move you type in the number of a pit If the last bean lands in your home, the computer types 'AGAIN?' and you then type in your second move. The computer's move is typed, followed by a diagram of the board in its new state. The computer always offers you the first move. This is considered to be a slight advantage. There is a learning mechanism in the program that causes the play of the computer to improve as it plays more games. This version of Awari is adopted from one originally written by Geoff Wyvill of Bradford, Yorkshire, England. Code Listing (Small Basic File: awari.sb):
Sample Run: © Copyright 2010 By BibleByte Books. All Rights Reserved. BibleByte Books, the BibleByte Books Logo, Computer Science For Kids, the Computer Science For Kids logo, and related trade dress are trademarks or registered trademarks of BibleByte Books. |