project-ed70c7de

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. # Additional Requirements ## Step-by-Step Capture Mode Capture sequences must be performed **step by step**, not instantly. During a multi-capture: * After each jump, the board must visually update. * The captured tower immediately becomes **gray (inactive)**. * The player must manually choose the next capture from the available options. * The move ends only when no further captures are available. * The player cannot switch to another tower during the capture sequence. * Captured towers remain on the board until the entire capture sequence finishes. * The same tower may **never be captured twice during the same move**, even if ownership would change after the sequence. * At the end of the capture sequence, update all affected towers simultaneously according to the Bashni rules. ## Board Editor Add a complete board editor. The editor must include the following tools: * Eraser (removes the entire tower from a square). * Top-piece eraser (removes only the top piece of a tower). * White man. * White king. * Black man. * Black king. Editor behavior: * Clicking an empty square places the selected piece. * Clicking a square that already contains a tower automatically places the selected piece **on top**, creating or extending the tower. * The editor must preserve the exact internal tower structure. * The editor must allow creating towers of any height and any combination of white/black men and kings. * The editor must immediately refresh the board display after every modification. ## Editor Controls Include buttons for: * Enter/Exit Editor Mode. * Clear Board. * Standard Initial Position. * Set Side to Move (White / Black). The editor must work entirely offline and integrate seamlessly with the game engine without breaking undo, move generation, capture detection, or Bashni mechanics.

Game
Game

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 5

project-ed70c7de

Introduction

The purpose of this document is to outline the system requirements for the "Bashni (Tower Checkers)" game, which is to be developed as a fully self-contained HTML game for two players. The game must function entirely within a single HTML file, incorporating all necessary HTML, CSS, and JavaScript, and must operate without any external libraries or internet connection.

System Overview

The "Bashni (Tower Checkers)" game is a digital adaptation of the traditional board game, designed to be played by two players on an 8×8 board. The game will follow the rules of Russian Draughts with the unique mechanics of Bashni (Tower Checkers). The game will include a board editor for modifying the board setup and will maintain seamless integration with the game engine.

Page 2 of 5

Functional Requirements as Story Points

  • As a Player, I should be able to play on an 8×8 board with 12 white and 12 black pieces.
  • As a Player, I should be able to move pieces only on dark squares.
  • As a Player, I should be able to see all legal moves highlighted.
  • As a Player, I should be able to see all possible captures highlighted.
  • As a Player, I should be prevented from making illegal moves.
  • As a Player, I should be able to perform multiple captures in a single turn.
  • As a Player, I should be notified of the winner when the game ends.
  • As a Player, I should be able to start a new game using a "New Game" button.
  • As a Player, I should be able to undo the last move using an "Undo Last Move" button.
  • As a Player, I should be able to perform mandatory captures.
  • As a Player, I should be able to choose from multiple capture sequences.
  • As a Player, I should be able to see captured pieces placed under the capturing piece, forming a tower.
  • As a Player, I should be able to move towers as a single piece, with movement determined by the top piece.
  • As a Player, I should be able to see only the top piece removed when a tower is captured.
  • As a Player, I should be able to see tower ownership change if the newly exposed top piece belongs to the opposite player.
  • As a Player, I should be able to see a king regain its status if exposed inside a tower.
  • As a Player, I should be able to perform capture sequences step by step, with visual updates after each jump.
  • As a Player, I should be able to use a board editor to modify the board setup.
  • As a Player, I should be able to use tools like an eraser, top-piece eraser, and piece placement in the board editor.
  • As a Player, I should be able to enter and exit editor mode seamlessly.
  • As a Player, I should be able to clear the board or set it to the standard initial position.
  • As a Player, I should be able to set the side to move (White/Black) in the editor.
Page 3 of 5

User Personas

  • Player: A user who plays the game, either as White or Black, and interacts with the game board and editor.
  • Editor User: A user who modifies the board setup using the board editor tools.

Core User Flows

  • Player starts a new game -> Moves pieces according to Bashni rules -> Highlights legal moves and captures -> Completes capture sequences -> Game detects winner -> Player starts a new game.
  • Editor User enters editor mode -> Modifies board using tools -> Exits editor mode -> Game updates with new board setup.

Visuals Colors and Theme

  • primary: #8B4513 (SaddleBrown)
  • primary_light: #CD853F (Peru)
  • secondary: #4682B4 (SteelBlue)
  • accent: #FFD700 (Gold)
  • highlight: #FF4500 (OrangeRed)
  • bg: #F5F5DC (Beige)
  • surface: rgba(139, 69, 19, 0.8)
  • text: #000000 (Black)
  • text_muted: #696969 (DimGray)
  • border: rgba(105, 105, 105, 0.2)
Page 4 of 5

Signature Design Concept

The homepage of the "Bashni (Tower Checkers)" game will feature an interactive animated board that mimics a real wooden checkered board. The board will have a 3D effect, with pieces that appear to stack and unstack dynamically as they move. When a player selects a piece, the board will highlight potential moves with a glowing effect. The pieces will animate smoothly across the board, and captures will be visually represented by stacking captured pieces beneath the capturing piece. The board editor will allow users to drag and drop pieces, with real-time updates to the board's appearance. The game will use motion/react for animations to create a seamless and engaging user experience.

Landing Hero Motion Brief

The landing hero will feature a continuously moving 2D composition where pieces move across the board, demonstrating the game's mechanics. The animation will show a sequence where a piece captures another, stacks it beneath, and continues to move, highlighting the unique Bashni mechanics. The animation will loop every 10 seconds, providing a clear visual story of the game's rules and features. The animation will be built using motion/react, ensuring smooth transitions and interactions.

Interaction Model & Motion Direction

  • Interaction Model: Animated
  • The landing page will feature moderate scroll-triggered reveals and hover transitions, with spring physics on interactive elements. This will provide a polished and engaging experience for users as they explore the game and its features.
Page 5 of 5

Non-Functional Requirements

  • The game must be fully functional and bug-free.
  • The game must operate entirely offline without any external dependencies.
  • The game must be responsive and work well on both desktop and mobile devices.
  • The game must have a clean object-oriented architecture with no duplicated code.

Tech Stack

  • Frontend: HTML, CSS, JavaScript (no external libraries)
  • Backend: None (all logic contained within the HTML file)

Assumptions and Constraints

  • The game will be developed as a single HTML file.
  • No external libraries or internet connection will be used.
  • The game will follow the rules of Russian Draughts with Bashni mechanics.
  • The board editor will integrate seamlessly with the game engine.

Glossary

  • Bashni (Tower Checkers): A variant of checkers where captured pieces are stacked beneath the capturing piece.
  • King: A piece that can move any distance diagonally.
  • Man: A regular piece that moves one square diagonally forward.
  • Tower: A stack of pieces formed when a piece captures another.
  • Capture Sequence: A series of captures performed in a single turn.
Game design preview
Game: View Board
Editor: Enter Editor Mode
Editor: Select Tool
Editor: Place Piece
Editor: Erase Tower
Editor: Erase Top Piece
Editor: Clear Board
Editor: Set Standard Position
Editor: Set Side To Move
Editor: Exit Editor Mode
Game: View Updated Board
Game design preview
Game: View Board
Editor: Enter Editor Mode
Editor: Select Tool
Editor: Place Piece
Editor: Erase Tower
Editor: Erase Top Piece
Editor: Clear Board
Editor: Set Standard Position
Editor: Set Side To Move
Editor: Exit Editor Mode
Game: View Updated Board