Library and user interfaces for (m,n,k)+g?-games.
mnkgame - Library and user interfaces for (m,n,k)+g?-games.
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:
For a more comprehensive list of changes see CHANGELOG.rst (automatically generated from the version control system).
Once installed on a properly set-up system, running the software is as simple as typing:
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
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  -q, --quiet override verbosity settings to suppress output [False] -m N, --rows N number of rows for the board  -n N, --cols N number of cols for the board  -k N, --aligned N number of aligned pieces required for winning  -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 <email@example.com> License: GNU General Public License version 3 (GPLv3)
The recommended way of installing the software is through PyPI:
$ pip install mnkgame
Alternatively, you can clone the source repository from Bitbucket:
$ git clone firstname.lastname@example.org:norok2/mnkgame.git $ cd mnkgame $ pip install -e .
This work is licensed through the terms and conditions of the GPLv3+. See the accompanying LICENSE.rst for more details.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size mnkgame-0.0.0.4-py2.py3-none-any.whl (34.7 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View hashes|
Hashes for mnkgame-0.0.0.4-py2.py3-none-any.whl