Skip to content

mikelane/minichess

Repository files navigation

Minichess AI

CS542 Advanced AI: Combinatorial Games

About

This is my project for CS542. This minichess AI will play games on the Portland State University Internet MiniChess Server, and eventually it will play well enough to compete.

Installation

The installation utilizes ZeroMQ: http://zeromq.org/. Please ensure that ZeroMQ is installed and that the C++ binding (https://github.com/zeromq/cppzmq) is also installed by ensuring that the zmq.hpp file is in one of the paths found in the #include <...> search starts here: section when you execute:

cpp -v /dev/null -o /dev/null

The preferred compilation is via the make file. The Makefile is in the project root directory so you can issue one of the following commands:

  • make <-- The default is the same as make optimized
  • make debug
  • make odebug
  • make optimized
  • make standard

There is a cmake file if you choose to use it.You're on your own with that.

For the Python portion, you'll need Python 2.7.13, Python 3.6.0, or Pypy2 5.7.0. To install issue the following CLI commands from the python environment you have:

python setup.py build
python setup.py install

Connecting to the IMCS

In order to connect to the IMCS server, you must have a settings file. The game will attempt to help you make the settings file on the first run if no such file is found, but this might be a bit buggy at the moment. For now, please create a file called settings.ini and input information like you see in the example_settings.ini file.

[SERVER]
host = sweet.chess.host.url
port = 9999

[PLAYER]
username = ur_player
password = hunter2

Playing a Game

A minichess game is played via a bash script which starts the move generator back end as a background process and starts the front end with the CLI options you provided. To get help with the command line options, use ./play -h. What you'll see is this:

usage: play.py [-h] [--debug] [-v]
               [-p {tester,random,negamax,ab,abid,abidttable}] [-a]
               [-o OPPONENT [OPPONENT ...]] [-ao] [-n NAME] [-pw PASSWORD]

Minichess player:

optional arguments:
  -h, --help            show this help message and exit
  --debug               Turn on debugging mode
  -v, --verbosity       Increase output verbosity, blank shows DEBUG only, -v
                        shows ERROR and CRITICAL. -vv shows WARNING, ERROR,
                        and CRITICAL. -vvv shows INFO, WARNING, ERROR, and
                        CRITICAL. -vvvv shows all levels including DEBUG.
  -p {tester,random,negamax,ab,abid,abidttable}, --player {tester,random,negamax,ab,abid,abidttable}
                        Specify the type of player to use. Does what's on the
                        tin. The tester doesn't connect to IMCS; instead, it
                        causes the move generator to return all possible moves
                        of a given board.
  -a, --automatic       Play auto-accept games. Without this option, you will
                        choose games from a menu.
  -o OPPONENT [OPPONENT ...], --opponent OPPONENT [OPPONENT ...]
                        A (space separated) list of player names to play
                        against when playing as automatic player. Without this
                        set, the player will pick games at random.
  -ao, --auto-offer     This player connects and offers games automatically.
  -n NAME, --name NAME  The username to use for this player. Set this if you
                        want to override the settings.ini
  -pw PASSWORD, --password PASSWORD
                        The password to use with the overridden username.
                        Required if --name option is set.

About

A custom AI that plays minichess

Resources

License

Stars

Watchers

Forks

Packages

No packages published