Apply one already-legal Go action to a nonterminal state. The board uses 0 for empty, 1 for Black, and -1 for White. For a board with side length n, intersection actions use row-major indices from 0 to n squared minus one; action n squared means pass.
A stone placement captures each adjacent opposing group with no remaining liberties. Groups connect horizontally or vertically, and a liberty is an adjacent empty intersection. This task receives a legal action, so occupancy, suicide, and repetition checks are not required.
Return a six-item tuple containing a NumPy array for the next board, next player, captured-stone count, consecutive-pass count, move count, and Boolean terminal flag. The player and counters are integers; the board keeps its original shape and uses -1, 0, and 1 for its entries.
Input: board = [[0,0],[0,0]], player = 1, action = 4, consecutive_passes = 0, move_count = 0
Output: ([[0,0],[0,0]], -1, 0, 1, 1, False)
Explanation: Pass leaves the board unchanged, switches the player, and increments both counters.
Input: board = [[1,-1,0],[0,1,0],[0,0,0]], player = 1, action = 2, consecutive_passes = 0, move_count = 4
Output: ([[1,0,1],[0,1,0],[0,0,0]], -1, 1, 0, 5, False)
Input: board = [[1,0],[0,-1]], player = -1, action = 4, consecutive_passes = 1, move_count = 3
Output: ([[1,0],[0,-1]], 1, 0, 2, 4, True)
divmod(action, board_size) maps a non-pass action to its coordinates.
A set of captured coordinates avoids counting the same group twice.
Use the updated counters to determine the terminal flag.
Accepts: array
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Apply one already-legal Go action to a nonterminal state. The board uses 0 for empty, 1 for Black, and -1 for White. For a board with side length n, intersection actions use row-major indices from 0 to n squared minus one; action n squared means pass.
A stone placement captures each adjacent opposing group with no remaining liberties. Groups connect horizontally or vertically, and a liberty is an adjacent empty intersection. This task receives a legal action, so occupancy, suicide, and repetition checks are not required.
Return a six-item tuple containing a NumPy array for the next board, next player, captured-stone count, consecutive-pass count, move count, and Boolean terminal flag. The player and counters are integers; the board keeps its original shape and uses -1, 0, and 1 for its entries.
Input: board = [[0,0],[0,0]], player = 1, action = 4, consecutive_passes = 0, move_count = 0
Output: ([[0,0],[0,0]], -1, 0, 1, 1, False)
Explanation: Pass leaves the board unchanged, switches the player, and increments both counters.
Input: board = [[1,-1,0],[0,1,0],[0,0,0]], player = 1, action = 2, consecutive_passes = 0, move_count = 4
Output: ([[1,0,1],[0,1,0],[0,0,0]], -1, 1, 0, 5, False)
Input: board = [[1,0],[0,-1]], player = -1, action = 4, consecutive_passes = 1, move_count = 3
Output: ([[1,0],[0,-1]], 1, 0, 2, 4, True)
divmod(action, board_size) maps a non-pass action to its coordinates.
A set of captured coordinates avoids counting the same group twice.
Use the updated counters to determine the terminal flag.
Accepts: array
Accepts: number
Accepts: number
Accepts: number
Accepts: number