Skip to main content

(m,n,k)-Game

mnkgame - Library and user interfaces for (m,n,k)+g?-games.

Overview

This software provides a library and user interfaces for (m,n,k)-games, including optional gravity and simple search-tree algorithms.

The (m,n,k)-game family of games are played in a rectangular grid of size m x n (where m is the number of rows and n is the number of columns). Each player position a piece (typically X and O) on the grid in alternating turns until one of the player manages to align k pieces either horizontally, vertically or diagonally. The first player to achieve this wins the game.

A variant of this game, called gravity, is when the pieces cannot be put anywhere in the grid but must fall toward the lower horizontal edge of the grid, so that each piece must be placed either at such edge or on top of another piece.

Popular such games are:

The following user interfaces are provided:

  • a Command-Line Interface (CLI) - with optional coloring from blessed / blessings.

  • a Text User Interface (TUI) - planned to be implemented with asciimatics.

  • a Graphical User Interface (GUI) - implemented with tkinter.

For a more comprehensive list of changes see CHANGELOG.rst (automatically generated from the version control system).

Quick Start

Once installed on a properly set-up system, running the software is as simple as typing:

$ mnk-game

which will default to the best user interface (UI) the system can handle.

To specify a certain UI, just use the first positional argument, e.g. for the CLI:

$ mnk-game cli

To get information on the command-line option, just type:

$ mnk-game --help

which produces:

usage: mnk-game.py [-h] [--ver] [-v] [-q] [-m N] [-n N] [-k N] [-g] [-a MODE]
                   [-t X] [-c]
                   [USER_INTERFACE]

(m,n,k)-game: command-line interface.

positional arguments:
  USER_INTERFACE        select the user interfact [auto|(auto, gui, tui, cli)]

optional arguments:
  -h, --help            show this help message and exit
  --ver, --version      show program's version number and exit
  -v, --verbose         increase the level of verbosity [1]
  -q, --quiet           override verbosity settings to suppress output [False]
  -m N, --rows N        number of rows for the board [3]
  -n N, --cols N        number of cols for the board [3]
  -k N, --aligned N     number of aligned pieces required for winning [3]
  -g, --gravity         use gravitataion-rule variant [False]
  -a MODE, --ai_mode MODE
                        AI mode [alphabeta_jit|(alphabeta_jit, alphabeta,
                        negamax, pvs, alphabeta_hashing, random)]
  -t X, --ai_time_limit X
                        time limit for AI move in sec [4.0]
  -c, --computer_plays  computer plays first move of first game [False]

v.0.0.0.4 - Riccardo Metere <rick@metere.it>
License: GNU General Public License version 3 (GPLv3)

Installation

The recommended way of installing the software is through PyPI:

$ pip install mnkgame

Alternatively, you can clone the source repository from GitHub:

$ git clone git@github.com:norok2/mnkgame.git
$ cd mnkgame
$ pip install -e .

License

This work is licensed through the terms and conditions of the GPLv3+. See the accompanying LICENSE.rst for more details.

Acknowledgements

This software is a spin-off of a Python course held in 2018 at the Donders Institute, part of the Radboud University Nijmegen (neither of which is involved or in any way affiliated with this).

Metadata

Release files for mnkgame 0.0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mnkgame 0.0.0.5
File Interpreter ABI Platform
mnkgame-0.0.0.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Release files / mnkgame-0.0.0.5-py2.py3-none-any.whl

Download URL mnkgame-0.0.0.5-py2.py3-none-any.whl
Size 35.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d61805a7e49ab84b9ae4c480688fb302487b1861d4e0c25d4ede98d9affe30b8
BLAKE2b-256 checksum
How to use checksums
0be1e03165a79b29522d6f9afd92bce11b29b2715b07aacdc7ec0db835be1283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.10.0 pkginfo/1.2.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.0.5 This release

1 release file

0.0.0.4

1 release file

0.0.0.3

1 release file

0.0.0.2

1 release file

0.0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page