Skip to content
/ nim Public

Clojure application to play the game of Nim.

Notifications You must be signed in to change notification settings

jimtyhurst/nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

# nim

Nim is a game played by two people, who take turns selecting tokens from a board. The player who picks up the last token wins.

This implementation was written as an exercise while learning Clojure.

## Usage

In a repl:
(use '[nim.ctl] :reload)
(start-game) ;Initializes board to default preferences.
(take-tokens number-of-tokens) ;Player takes a turn by taking number-of-tokens
(machine-takes-turn) ;The application makes a choice for the current turn.

Note: machine-takes-turn does an exhaustive look-ahead, evaluating all possible moves. So it selects the next move that maximizes the ratio of winning end conditions over all possible end conditions.

## License

Copyright (c) 2011 Jim Tyhurst

Distributed under the Eclipse Public License, the same as Clojure.

About

Clojure application to play the game of Nim.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published