3 unstable releases
Uses old Rust 2015
0.2.0 | Jun 25, 2020 |
---|---|
0.1.1 | Mar 16, 2020 |
0.1.0 | Jun 5, 2018 |
#882 in Algorithms
28KB
724 lines
Nine Men's Morris Rules
7 o-----------o-----------o
| | |
6 | o-------o-------o |
| | | | |
5 | | o---o---o | |
| | | | | |
4 o---o---o o---o---o
| | | | | |
3 | | o---o---o | |
| | | | |
2 | o-------o-------o |
| | |
1 o-----------o-----------o
a b c d e f g
The board consists of a grid with twenty-four intersections or points. Each player has nine pieces, or "men", usually coloured black and white. Players try to form 'mills' — three of their own men lined horizontally or vertically. Creating a mill allows a player to remove an opponent's piece from the board. Pieces that are part of a mill cannot be removed unless there are no other pieces to remove. A player wins by reducing the opponent to two pieces (where he could no longer form mills and thus be unable to win), or by leaving him without a legal move.
The game proceeds in three phases:
Placing men on vacant points Moving men to adjacent points Moving men to any vacant point when the player has been reduced to three men
Phase 1: Placing pieces
Nine Men's Morris starts on an empty board. The game begins with an empty board. The players determine who plays first, then take turns placing their men one per play on empty points. If a player is able to place three of his pieces on contiguous points in a straight line, vertically or horizontally, he has formed a mill and may remove one of his opponent's pieces from the board and the game, with the caveat that a piece in an opponent's mill can only be removed if no other pieces are available. After all men have been placed, phase two begins.
Phase 2: Moving pieces
Players continue to alternate moves, this time moving a man to an adjacent point. A piece may not "jump" another piece. Players continue to try to form mills and remove their opponent's pieces as in phase one. A player can "break" a mill by moving one of his pieces out of an existing mill, then moving it back to form the same mill a second time (or any number of times), each time removing one of his opponent's men. The act of removing an opponent's man is sometimes called "pounding" the opponent. When one player has been reduced to three men, phase three begins.
Phase 3: "Flying"
When a player is reduced to three pieces, there is no longer a limitation on that player of moving to only adjacent points: The player's men may "fly" from any point to any vacant point.
Dependencies
~0.5–1MB
~20K SLoC