Hot-seat Connect Four. Drop discs by column, or let the solver play the most optimal move for the current player.
Choose who starts
This is a client-side React internal app: a 6×7 board in component state, gravity drops into the lowest empty cell of a column, and win checks for four-in-a-row in every direction (plus draw when the board fills). Two players share one device; either can also ask the solver to move for the current color.
Most optimal move uses minimax with alpha-beta pruning. It searches the game tree, ordering columns center-out for faster pruning. Instant wins and blocks are checked first. Deeper search uses iterative deepening with a short time budget (~350ms): each extra ply improves the pick until time runs out. Non-terminal leaves are scored with a heuristic that favors center control and open twos/threes (and penalizes the opponent’s threats)—so early positions stay snappy while mid/late games approach near-perfect play.