project-90a0a215

byMerington BTor

Create a fully self-contained HTML game **"Bashni (Tower Checkers)"** for two players. Everything must work in a **single HTML file** (HTML + CSS + JavaScript), with **no external libraries** and **no Internet connection** required. # Core Requirements * 8×8 board. * 12 white and 12 black pieces. * Play only on dark squares. * White moves first. * Highlight all legal moves. * Highlight all possible captures. * Prevent any illegal moves. * Fully support multiple captures in a single turn. * Display the winner when the game ends. * "New Game" button. * "Undo Last Move" button. # Rules Use the rules of **Russian Draughts**, but with the mechanics of **Bashni (Tower Checkers)**. ### Movement * A regular man moves one square diagonally forward. * A king moves any distance diagonally. * Capturing is mandatory. * If multiple capture sequences exist, the player may choose any of them. * Men capture both forward and backward. * Kings capture over any distance diagonally. * After a capture, if another capture is available with the same tower, the turn must continue. * If, during a capture sequence, a man reaches the last rank, it is **immediately promoted to a king** and must continue capturing as a king during the same turn. # Bashni (Tower Checkers) Rules This is the most important part. * A captured piece is **NOT removed from the board**. * Instead, it is placed **under the capturing piece**, forming a tower. * A tower moves as a single piece. * The movement type of a tower is determined **only by its top piece**. * If the top piece is a man, the tower moves as a man. * If the top piece is a king, the tower moves as a king. * When a tower is captured, **only its top piece is removed**. * The remainder of the tower stays on the same square. * If removing the top piece reveals a piece of the opposite color, control of the tower immediately changes to that player. * If a king becomes exposed inside the tower, it regains its king status and determines the movement of the tower. # Capture Sequence Rules During a capture sequence: * Tower ownership changes are **not applied until the entire capture sequence is finished**. * Towers that have been captured become **gray (inactive)** until the end of the capture sequence. * A tower **cannot be captured more than once during the same turn**, even if it changes ownership after the sequence. * At the end of the capture sequence: * Remove the top piece from every captured tower. * Update tower ownership if the newly exposed top piece belongs to the opposite player. * Restore the normal colors of all affected towers. # Internal Data Structure Every occupied square must store an array: ```javascript [ { color: "white", king: false }, { color: "black", king: true }, ... ] ``` The **last element of the array is always the top of the tower**. All game logic must operate directly on this structure. # User Interface * Attractive wooden/checkered board. * Towers displayed as stacked pieces. * Show the height of every tower. * Kings display a crown icon. * Highlight the selected tower. * Animate movement. * Animate captures. * Display whose turn it is. * Responsive layout that works well on desktop and mobile. # Algorithms Implement: * `getLegalMoves()` * `getCaptures()` * `makeMove()` * `undoMove()` * `promoteIfNeeded()` * `checkGameOver()` Implement classes: * `Board` * `Game` * `Renderer` Requirements: * No duplicated code. * Clean object-oriented architecture. * Efficient move generation. * Correct recursive search for all possible capture sequences. # Game Over Detection Detect: * One player has no controllable towers. * One player has no legal moves. * Opponent is completely blocked. Display the winner and prevent further moves until a new game starts. # Final Validation Before generating the code, verify that all Bashni rules are implemented correctly, especially: * placing captured pieces underneath the capturing tower; * removing **only the top piece** when a tower is captured; * immediate promotion during a capture sequence; * multiple captures in a single turn; * mandatory captures; * correct tower ownership switching after the capture sequence ends; * deferred tower updates until the end of the capture sequence; * preventing the same tower from being captured twice during one move; * proper undo functionality restoring the complete previous game state. The final result must be a **fully functional, production-quality, bug-free single HTML file** containing all HTML, CSS, and JavaScript, ready to open locally in any modern browser without any external dependencies.

LandingGame
Landing

Comments (0)

No comments yet. Be the first!

Architecture

No Services Diagrams Yet

Architecture diagrams will be automatically generated when the Project Manager creates tasks for your project.

Landing design preview
Landing: View Board
Game: View Turn Indicator
Game: Select Tower
Game: View Legal Moves
Game: View Captures
Game: Move Piece
Game: Capture Piece
Game: Continue Capture Sequence
Game: Promote To King
Game: View Tower Height
Game: Undo Last Move
Game: Start New Game
Game: View Winner
Landing design preview
Landing: View Board
Game: View Turn Indicator
Game: Select Tower
Game: View Legal Moves
Game: View Captures
Game: Move Piece
Game: Capture Piece
Game: Continue Capture Sequence
Game: Promote To King
Game: View Tower Height
Game: Undo Last Move
Game: Start New Game
Game: View Winner