Mini TS project for practicing the classic Connect4 problem under live-coding conditions.
cd connect4
npm install- Open src/Connect4.ts — stub class, all methods throw.
- Run tests in watch mode:
npm test - Implement until green. Try to do it in one sitting, no AI help.
- 6 rows × 7 columns. Row 0 is the bottom (gravity drops discs down).
- Red (
"R") moves first; players alternate. - Win: 4 in a row horizontally, vertically, or diagonally.
playMovereturns[row, col]where the disc landed.- Invalid moves (bad column, full column, game already over) throw
Connect4Error.
git stash # or just revert src/Connect4.ts