UXInteract / task_001 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
1.42 kB
# Gomoku with a victory reveal
Build a two-player Gomoku game in HTML and JavaScript. Open the root `index.html` directly in a browser; the game must work offline. Show a 15×15 board and both players' stones. On a win, display the winner and reveal an Easter egg.
## Game rules and state interface
Players alternate placing stones. Either player wins by completing five consecutive stones of their own color horizontally, vertically, or along either diagonal. A gap or an opposing stone breaks a line.
Expose `window.gameTest` with `reset()`, `move(row, col)`, and `state()`. Moves use zero-based coordinates and update the same state and board as user moves. Return `{size, board, current, winner, easterEgg}`: `size` is 15, `board` is a 15×15 array with `null` for empty cells and distinct piece values for the two players, and `current` identifies the current player. When there is a winner, set a nonempty, consistent player-specific `winner` and independently set `easterEgg` to true or a nonempty value.
## Acceptance Checklist
- The page renders offline without browser errors; legal API moves update the visible board.
- Occupied and out-of-bounds moves leave state unchanged.
- Both players can win in all four directions. Winner and Easter egg stay unset before a winning line, including for disconnected stones.
- Reset clears every cell, the winner and the Easter egg, and restores the first mover.