Skip to content

Instantly share code, notes, and snippets.

@santhoshtr
Last active August 29, 2015 14:16
Show Gist options
  • Save santhoshtr/546d143100376481de72 to your computer and use it in GitHub Desktop.
Save santhoshtr/546d143100376481de72 to your computer and use it in GitHub Desktop.
Dots and Boxes

Write a simple implementation of the Dots and Boxes game that works in a web browser.

Refer https://en.wikipedia.org/wiki/Dots_and_Boxes Write a 4 X 4 Dots and Boxes game. The two players are humans and they can take the turn from the web page.

When a user opens the page in their browser, it should display a game board and indicate which player (e.g. red player) takes the turn. Players take turns using a single browser window (no server-side code needed). If any player fills a box they can make another move. When all boxes covered, the page should indicate the winner, the game ends and no more moves can be made.

Things to keep in mind:

  • Use JavaScript, HTML, CSS.
  • Keep the code light. You can use basic JavaScript libraries(jQuery for example) though.
  • You don't need to spend too much time on the UI. It's enough if it's playable, doesn't have to be pretty.
  • Try to write the code in such a way that it's modular and easily testable (you can do a bit of TDD too), e.g. Separate the game board logic from the UI.
  • It should be playable on modern browsers (Chrome, Safari).
  • Start simple and leave improvements for later. You should be able to have something working in 2-3 hours.
  • You will be evaluated based on how you approach the problem and how well you organized the code. Of course you need a working solution.
  • Needless to say we are evaluating YOU and not anybody else in internet :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment