Skip to content

Instantly share code, notes, and snippets.

@djtango
Created October 22, 2019 08:53
Show Gist options
  • Save djtango/c922c67a86367812fc5e8203223c2d0b to your computer and use it in GitHub Desktop.
Save djtango/c922c67a86367812fc5e8203223c2d0b to your computer and use it in GitHub Desktop.
three-mens-morris

three-mens-morris

Kata: Three Men's Morris History

The game of Three Men's Morris, similar to Noughts and Crosses or Tic-Tac-Toe is known alternately as:

"Terni Lapilli" or "Three Stones" in Roman times
"Tapatan" in the Philippines
"Luk Tsut K'i" ('six man chess') in China

The earliest known boards date from 1400 BCE, carved into the roof tiles in the Temple of Seti I in Kurna, Egypt. There are similar games found in most ancient cultures, the modern Noughts and Crosses or Tic-Tac-Toe is a simpler variation.

Boards have been found carved into cloister seats in many English cathedrals: Canterbury, Gloucester, Norwich, Salisbury and Westminster Abbey - so popular was it that there is some evidence that it was outlawed amongst the clergy in medieval times. The word 'Morris' here is not the same 'Morris' as from 'Morris Dancing' (which derives from 'Moorish' - the medieval culture of north-west Africa) but instead comes from the Latin word 'Merellus', which means a counter or gaming piece.

The objective of the game is to get your three counters in a row, either horizontally, vertically or diagonally. The board

The board is a three row, three column grid with nine spaces for players' counters to go:

o-o-o
|\|/|
o-o-o
|/|\|
o-o-o

Game play

There are two players, white and black.
As in the game of Chess, the white player moves first.
Players may choose any method they like to determine who plays white and who plays black.
Each player has three pieces of their own colour.
Each player takes it in turns to place a piece.
If a player has placed all three of their pieces, then they must pick up one of their already placed pieces and move it to a vacant space, either horizontally, vertically or diagonally.
A piece cannot be replaced in its original place, nor may it be placed on an opponents piece.
As soon as a player places a piece that gives them a row of three, either horizontally, vertically or diagonally, they have won.

Objective

Write an application that enables two players to play Three Men's Morris on a computer. No GUI is needed, but a primitive command-line display similar to the above would be helpful for the players.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment