Code Monkey home page Code Monkey logo

code-dojo-28's Introduction

Kata: the game of Three Men's Morris

This is my worked example from the 28th meeting of the London Code Dojo. Feel free to play around with it.

You can find a Node.js and CoffeeScript implementation of the kata in the coffee folder.

There is a Python starter test file in the Python folder.

The source of the kata is the ancient game of Three Men's Morris, similar to Noughts and Crosses, of which you can find out more here. You can find out more about the London Code Dojo at our homepage.

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.

License

The code samples are licensed under the CC-SA-NC-4.0 license, as shown in the LICENSE file.

code-dojo-28's People

Contributors

sleepyfox avatar

Watchers

Deon Tan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.