Skip to content

NicoMoli/connect4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect4 — interview practice

Mini TS project for practicing the classic Connect4 problem under live-coding conditions.

Setup

cd connect4
npm install

Workflow

  1. Open src/Connect4.ts — stub class, all methods throw.
  2. Run tests in watch mode:
    npm test
  3. Implement until green. Try to do it in one sitting, no AI help.

Rules of the game

  • 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.
  • playMove returns [row, col] where the disc landed.
  • Invalid moves (bad column, full column, game already over) throw Connect4Error.

Reset for another run

git stash      # or just revert src/Connect4.ts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors