Quoridor ~ Mohammad Daraghmeh

Welcome, this is a ten week Python based project with the purpose of creating an Artificial intelligence (AI) to play the classical game Quoridor


Overview of Quoridor

The abstract strategy game, Quoridor, is one that can be played with two to four player(s). Quoridor even though it is a game of simple rules it is surprisingly a deep and strategic game. The whole object of the game is to advance your pawn to the opposite edge of the board.

Depth-In view of Quoridor

As mentioned the objective of Quoridor is to advance your pawn to the opposite end of the board. With each turn, a player is given two decisions: move their pawn or place a wall. The standard setup of the game is two players each with ten walls. In turn, players can choose whether to move their pawn by one space Up,Down,Right,Left (no diagonals); or place a wall anywhere on the board. Pawns have to maneuver around walls with of course the end goal being to get to the other side.

Language/Platform PythonEclipse

This project was written in Python using the platform Eclipse. This project was not completely from scratch for a GUI was provided for visual representation and checking. The rest was written by me from scratch.

Line Break

Game Setup Rule

~ One board with 81 squares

~ Two storage slots for walls

~ Each player starts off in the center of this base line (Fig. 1)


Move Rules Move

~ Each player in turn, chooses to move his/her pawn or to put up one of his/her wall

~ When a player runs out of walls, the player must move his/her pawn.

~ The pawns are to move one square at a time (Fig. 2)

~ Pawns must get around walls (Fig. 3)


Wall Rules Wall

~ The walls must be placed between 2 sets of 2 squares (Fig. 4)

~ No wall is to completely seal off a player's end goal line. One slot must be open at all times (Fig. 5)


Jump Rules Jump

~ When two players are face to face on a neighboring squares and not separated by a wall, the player whose turn it is can jump said opponent's pawn, thus advancing an extra square. (Fig. 6)

~ If there is a wall behind the said pawn, the player can place his pawn to the left or the right of the other pawn. (Fig. 8/9)


End Game End

The first player who reaches one of the 9 squares opposite his base line is the winner (Fig. 7)


Time of Game Time

From 10 to 20 minutes.

Line Break

How to use my Code Code

1) Download Zip or Tar (MohDar_Quoridor)

2) Exact downloaded file

3) Within the exacted folder are a few files looking similar to the image below:

Folder View

4) Best method to run the Quoridor's engine is through Eclipse Classic

5) Once Eclipse is installed if you do not have the PyDev Python Plugin go to the below section:

6) Create a new Python project with the following setup

Python Project

7) Drag the exacted folder to the newly created project, you will see something similar to the below:

Project View

8) Now in StudentPlayers, you will find the directory called MohDar13. This is where all the AI and good stuff is.

Line Break

How to Run Game Run

  1. Edit the config.txt in the project to your liking, the following are common edit areas:

    a. API_KEY ~ There is my personal API Key please be respectful of this fact (e4cda5d2ce6df460c13)

    b. PLAYER_MODULES Important area for selecting the AIs (Possible Choices: Human,OKComputer,BeatMe, and my module MohDar13)

    c. PRE_MOVE ~ Area for moves to be made before players get control

    d. NUM_WALLS ~ Wall count for players - Currently set for {1:20,2:10,4:5} meaning with 2 players each player gets 10 walls. If 4 players each player gets 5 walls.

    e. ANIMATION_SPEED ~ Unit is in milliseconds between successive moves

  2. The current config is set for my module (MohDar93) to versus another AI (BeatMe)

  3. To run simply right click on quoridor.py and click Run As - Python Run

  4. Enjoy and Give Credit where it is do.

Line Break

Installing Python Plugin

  1. Navigate to: Help->Install New Software...
  2. Click the "Add" button to view a pop-up window dialog.
  3. In "Name" enter: PyDev
  4. In "Location" enter: http://pydev.org/updates
  5. Click the "OK" button and the window presents information on PyDev.
  6. Select the checkbox next to "PyDev" and click the "Next" button.
  7. Re-select the "PyDev" entry and click the "Next" button.
  8. Select "Next", accept license agreement and click the "Finish" button.
  9. Now you are going to accept the certificate. One of these windows will bring up a checkbox that you must check in order to correctly accept the certificate.
  10. If prompted, trust all certificates.
  11. Quit and restart Eclipse (It usually tells you a restart is necessary).

PyDev Configuration

  1. In Eclipse, go to: Window->Preferences.
  2. Go to: Pydev->Interpreter - Python.
  3. Click the "New..." button.
  4. In "Interpreter Name" enter: python3
  5. In "Interpreter Executable" click the "Browse" button and navigate to C:\Python33\python.exe. Click "Open" with python.exe highlighted.
  6. Click the "Ok" button two times.
  7. Click the "Apply" button. Python 3 now should be configured.
  8. Click "OK" to return to main window.

PyDev Handle

  1. In the top menu, go to preferences (on a Mac, it is under the Eclipse pulldown, and on Windows, it is under the Window pulldown). Go to: Preferences->PyDev->Builders
  2. In the lower part of the window, change the option for "How to handle .pyc/$py.class deletion" to "Only delete .pyc when .py delete is detected."
  3. Click the Apply button.
  4. Below is an image of the settings screen. (Note: If you have the Helios edition, this option does not exist; switch to the Indigo or Juno edition of eclipse.)

PyDev ConfigurationLine Break

Figure

Quoridor Rules

Credit: UI Creator: Adam Oest

Created and Property of Mohammad M. Daraghmeh