Game Of Dots And Boxes

Old school-time game, played at backbench with just Dots and Boxes also known for pencil and paper game

View on Github Page

Code is made with p5js library and is to run with browser as Javascript

Plot of Game

Game of Dots and Lines is a two player game (sometime more players can play, but this code is for two players only), In the game there is a grid of dots and player one start to draw a line connecting any two neibouring dots, connecting line can be only horizontal or vertial (Not diagonal). Player’s objective is to draw a line and completing the rectangular box, which will be named for him. On the other hand Player’s objective is also to avoid giving opportunity to another player to complete a box on his turn. Each player get a turn to draw one line. If player complete a box he/she gets another chance to draw one more line before pass to next player. At the last one player who gets more number of boxes wins. More description can be find on Wikipedia

How to RUN

  1. Just download the repo
  2. Open the file “LineGame_v1.0.html” in any browser (Preferably in Crome or Firefox)

Options

Once select any option, click of ‘Apply and Start’ button in order to apply this new selection

Player 2

Grid Size

Draw Line

As you move your pointer, you can see the line you can draw, once you click on it, it will be drawn

Color Coding

..

FUN Options

Try ‘Auto’ option with ‘Big Size’ of grid and let the computer play both end

Improve the Code

If you are in Game development or AI Stretagy or Planning AI Agent, try to improve the computer player to be more smarter than it is now. There are flaws in Computer Player’s stratagy. I won’t tell you NOW ;) Explore it and try to fix it. Let me know once you do it. I would like discuss :)

@Author : Nikesh Bajaj

PhD Student @ QMUL and UNIGE

n.bajaj@qmul.ac.uk

http://nikeshbajaj.in