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.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.