Skip to content

Files

08_Batnum

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 5, 2022
Mar 5, 2022
Mar 13, 2022
Mar 16, 2022
Mar 16, 2022
Nov 21, 2021
Mar 10, 2022
Aug 19, 2024
Jun 2, 2022
Dec 1, 2023
Jan 17, 2022
Jul 12, 2023
Mar 5, 2022

Batnum

The game starts with an imaginary pile of objects, coins for example. You and your opponent (the computer) alternately remove objects from the pile. You specify in advance the minimum and maximum number of objects that can be taken on each turn. You also specify in advance how winning is defined:

  1. To take the last object
  2. To avoid taking the last object

You may also determine whether you or the computer go first.

The strategy of this game is based on modulo arithmetic. If the maximum number of objects a player may remove in a turn is M, then to gain a winning position a player at the end of his turn must leave a stack of 1 modulo (M+1) coins. If you don’t understand this, play the game 23 Matches first, then BATNUM, and have fun!

BATNUM is a generalized version of a great number of manual remove-the-object games. The original computer version was written by one of the two originators of the BASIC language, John Kemeny of Dartmouth College.


As published in Basic Computer Games (1978):

Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html

Known Bugs

  • Though the instructions say "Enter a negative number for new pile size to stop playing," this does not actually work.

Porting Notes

(please note any difficulties or challenges in porting here)