Git Product home page Git Product logo

quoridor_engine's Introduction

Quoridor Engine

About

An engine made in pure C11 simulating the board game Quoridor on a terminal.
More information about the game can be found here and an online board to try the game here.

Quoridor Text Protocol

The communication protocol between the user/programs that they play Quoridor is well described here.
It is obligatory for the user to be well informed for the way the parsing is implemented and the usage of each command and its requested arguments. Although, there is enough error checking and no graceful exit for any mistake a user makes :).

AI Agent

The engine is based on minimax with alpha-beta pruning that uses iterative deepening in order to search at the maximum depth possible at a fixed time. Although it would be better the time for generating a move to be parameterized based on the board size and the available moves the player has in every snapshot of the game.

Compilation/Example

A Makefile is provided for the creation of the executable file that is stored at the ./build folder. The game initially starts with a board size of 7 but the user can choose any available combination for the board size and the number of walls as shown below.

make run

boardsize 5
=

clear_board
=

walls 2
=

showboard
=

     A   B   C   D   E
   +---+---+---+---+---+
5  |   |   | B |   |   |  5  black walls: 2
   +---+---+---+---+---+
4  |   |   |   |   |   |  4  white walls: 2
   +---+---+---+---+---+
3  |   |   |   |   |   |  3
   +---+---+---+---+---+
2  |   |   |   |   |   |  2
   +---+---+---+---+---+
1  |   |   | W |   |   |  1
   +---+---+---+---+---+
     A   B   C   D   E

 
genmove black
= C4

playmove white c2
=

genmove black
= B5 horizontal

playwall white c2 horizontal
=

showboard
=

     A   B   C   D   E
   +---+---+---+---+---+
5  |   |   |   |   |   |  5  black walls: 1
   +---+=======+---+---+
4  |   |   | B |   |   |  4  white walls: 1
   +---+---+---+---+---+
3  |   |   |   |   |   |  3
   +---+---+---+---+---+
2  |   |   | W |   |   |  2
   +---+---+=======+---+
1  |   |   |   |   |   |  1
   +---+---+---+---+---+
     A   B   C   D   E

winner
= false

quit
=

make clean

Referee

A referee is also provided that allows two programs to play against each other.
Both programs must follow the protocol that was mentioned above.
We can also use a program to play against itself.

Run with:
chmod +x quoridor_referee.py < program_1 > < program_2 >
./quoridor_referee.py --white < program_1 > --black < program_2 > possible_args

possible_args = {
  --verbose 1 (to list moves) or --verbose 2 (to draw board)
  --size <board size>               (default 9)
  --walls <number of walls>         (default 7/4*boardsize-23/4)
  --games <number of games to play> (default 1)
  --maximum_time <time(in seconds)> (default boardsize/3)
  --move_time <time(in seconds)>    (default 30)
  --memory_limit <memory(in MB)>    (default 950MB)
  --seed <seed>                     (default current unix timestamp)
}

quoridor_engine's People

Contributors

alexandrosmisas avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

willjyang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.