Connect4Regular

Connect4Regular

Standard Connect 4 (6 rows, 7 columns default). Grid is standard reading order or maybe row-major. Let's use row-major for simplicity in drawing, but move logic is column-based. Rows 0..5, Cols 0..6. 0,0 is top-left usually for rendering, but for gravity bottom-up is easier? Let's use 0 = top, 5 = bottom. Gravity fills 5 then 4...

Constructor

new Connect4Regular()

Source:

Methods

getAllValidMoves() → {Array.<number>}

Description:
  • Returns valid moves (columns that are not full).

Source:
Returns:

list of column indices (0..cols-1)

Type
Array.<number>

makeMove(col) → {boolean}

Description:
  • Makes a move in the given column.

Source:
Parameters:
Name Type Description
col number
Returns:
Type
boolean