SVG Perl Script to Make 9 Men’s Morris Game

9 Men’s Morris is a great simple strategy game that has been around for thousands of years. You can play it by scratching some lines in the dirt (or paper) and then using 9 tokens each. Here is a Perl script that generates a game board for you in SVG format.

9 Men’s Morris Game Board

The game board is pretty easy to make and has been found in tombs in Egypt carved into stones. Game pieces can be pennies and dimes, or a bag of glass beads from walmart for $1.

9 Men's Morris Game Board


Reduce your opponent down to 2 pieces by making 3 in a row and taking 1 piece each time you create a 3 in a row.
If your opponent is trapped completely and cannot move, they lose.

Setup (Stage 1)

Take turns putting your 9 pieces down, trying to get 3 in a row. Each time you get three in a row, take an unprotected piece from your opponent and remove it from the game. 3 in a Row can only be done on lines, not diagonal.

Movement (Stage 2)

Take turns sliding your piece trying to get 3 in a row again. Each time you get three in a row, take an unprotected piece from your opponent and remove it from the game.

Underdog Rule (Stage 3)

If a player only has 3 pieces left, they are no longer bound to the 1 segment move rule and can put any 1 of their pieces on any location instead of sliding 1 segment. This allows a losing player to have a very strong fighting chance even if they were obliterated early on in the game.

Additional Rules

  • You cannot take from a string, unless there is no other option to take first
  • If your opponent is trapped and has no legal moves, you win.

9 Men’s Morris Strategy

Your opponent will easily see you put down 2 in a row and will block your third play. So, you must think of ways to get multiple 3 in a rows that your opponent cannot block both. When you beat your opponent down to 3, they can fly anywhere on the board and block your moves. So, you need to patiently setup a double 3 in a row that they cannot block both.

9 Men’s Morris SVG Code

This code was generated with the Perl script at the bottom of the article. You can view it in any browser.

Perl Script to Generate Game Boards

The lines are actually 2 point polygons, which seemed easier than drawing lines another way. The end result is the same.

Gift Ideas

Carving this into a piece of wood and buying some shiny glass beads would make a great game gift. If you want to do the fast/cheap method just print out this graphic and use some pennies/dimes. it’s a very fun game.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.