A simple Connect Four implementation in node.js.
TODOs, bugs, remarks and possible enhancements:
- The node.js project is based on Express.
- The template engine has been changed to Mustache.
- Everything is in ES6 so make sure to activate
chrome://flags/#enable-javascript-harmony
in Chrome! - The client side is some very simple jQuery.
- Grunt is used to pass the code through JSHint and JS Beautifier.
- The AI uses a simple negamax without prunning or memoization; the main
Board
object is not optimized (arrays of objects), so the AI is not very strong, yet. - A very important shortcoming : node.js cannot deal with long running processes without stalling its I/O. Workarounds for this problem are hard and convoluted, and are not implemented here. As a result, when the AI thinks, the server stops responding.
- Sessions allow for many simultaneous games.
- Only playing vs. AI is supported for the moment (no human vs. human).
- Server sessions do not expire, which is a potential DOS vector, a dedicated middleware is required.