/connect4

Interview challenge

Primary LanguageJavaScript

Connect 4 interview assignment

Game screenshot

Play now

https://conscious-thistle.glitch.me/

Server may hibernate during periods of low use. Please be patient while it boots.

Get started

Tested with Node 9.x

yarn install
yarn start

Navigate browser to localhost:3000. Open second tab to start game.

Run tests

yarn run test

Implementation

I used an ExpressJS scaffold for the project structure and socket.io library for real-time communication. Connect4 implementation and socket server lives in /server and the browser React client is in /client.

Persistence

Games are persisted to an append only log in a file. Before persisting, games are serialized to a 42 character text representation of the board. It would be straightforward to use a database table with a character field in its place.

Future improvements

  • Improve UI!!
  • Better mobile experience
  • Persist to DB so app is stateless and can scale horizontally
  • Write React client tests
  • Remove PUG templates. Serve client from CDN.