Connect-4 Solver

Implement the famous game in JavaScript

Suppose an 8*6 Connect-Four table is given. Each cell of the table is either empty (null), or contains the player’s number from the possible values 1 and 2. Determine if any player has won the game by connecting four of their symbols horizontally or vertically. For simplicity, ignore diagonal matches.

Solution:

As there is no example data, we have to model the table ourselves.

Get hands-on with 1400+ tech skills courses.