Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
03
:
08
:
30
Back to Dashboard
Color Chain Winner
Medium
FREE
You are implementing a color chain game. Two players take turns placing tokens on a grid. Each cell contains "red", "blue", or "" (empty). A player wins when they form a chain of 4 or more consecutive tokens of their color in a row, column, or diagonal.
Given the current board state (before the move), the position [row, col] where the current player places their token, and the player's color, place the token and check if the placement creates a chain of 4 or more. Return the winning player's color if they win, or "" if no win occurs.
...