Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repository files navigation

Morris

A computer implementation of Nine Men's Morris and its variants.

Morris playing the standard game

Morris is an implementation of the board game Nine Men's Morris, also known as Mills, Merrills or Mühle. Play against the computer, or use the program as a board for two people. Besides the standard game it offers a range of rule variants and boards:

  • the Lasker variant, where pieces may be moved during the placement phase
  • Morabaraba, Six and Seven Men's Morris
  • the Moebius board, the Windmill and the Sunmill
  • triangle, pentagon and hexagon boards
  • Tapatan, Achi and Nine Holes

The game also supports:

  • a computer player with adjustable search depth and thinking time
  • hints for good moves and display of the principal variation
  • move takeback (undo and redo)
  • a configurable display and translations into several languages

AI algorithm

The AI is a standard alpha-beta search in a NegaMax implementation using iterative deepening. It employs a transposition table to quickly find previously computed positions.

A special feature is the automatic learning capability: whenever the computer wins or loses a game, it will prefer to obtain or avoid similar situations in the future. This results in a better long-term motivation, since the computer will not make the same mistake twice and the gameplay will be more randomized.

The evaluation function consists of four parts:

  • material: the number of pieces each player has left
  • freedom: the number of possible moves a player can conduct
  • mills: the number of closed mills
  • experience: the learning bias from previous games

Building

Morris is built with CMake (version 3.16 or newer). You need a C++20 compiler (GCC 10 or newer, or Clang with libstdc++ 10 or newer), pkg-config, GTK 3 with GLib/GIO, and GNU gettext for the translations. On Debian or Ubuntu:

sudo apt install build-essential cmake pkg-config libglib2.0-dev libgtk-3-dev gettext

Then:

cmake -S . -B build
cmake --build build
sudo cmake --install build

Installing compiles the GSettings schemas (unless DESTDIR is set, as package builders do). Useful configure options:

option effect
-DCMAKE_INSTALL_PREFIX=/usr install prefix (default /usr/local)
-DENABLE_NLS=OFF build without translations
-DMORRIS_COMPILE_SCHEMAS=OFF do not run glib-compile-schemas on install

The game logic, rules and AI build as a library separate from the user interface, with a test suite that needs no display:

ctest --test-dir build

Running without installing

g_settings_new() aborts when the settings schema is not compiled and discoverable, so an uninstalled binary needs a compiled schema directory:

mkdir -p /tmp/morris-schemas
cp net.nine-mens-morris.gschema.xml /tmp/morris-schemas/
glib-compile-schemas /tmp/morris-schemas
GSETTINGS_SCHEMA_DIR=/tmp/morris-schemas ./build/src/morris

Release tarball

scripts/do-dist-source.scpt

exports the current commit, builds the source tarball with CPack, checks that it builds and passes its tests on its own, and writes it to dist/ with a SHA-256 checksum.

Packaging status

morris packaging status

Authors and credits

  • Dirk Farin, main author
  • Ryan Dibble provided many features to GNMM, the predecessor program of Morris

License

Copyright (C) 2009-2026 Dirk Farin [email protected]

Morris is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See COPYING for the full text.

Send inquiries, comments, bug reports, suggestions and patches to Dirk Farin [email protected], or open an issue on GitHub. See also the Morris home page at https://nine-mens-morris.net/.

About

Morris is an implementation of the board game "Nine Men's Morris".

Resources

Stars

9 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages