{"id":50840105,"url":"https://github.com/vimalyad/snake-and-ladder-game","last_synced_at":"2026-06-14T06:06:45.997Z","repository":{"id":346388058,"uuid":"1189561364","full_name":"vimalyad/snake-and-ladder-game","owner":"vimalyad","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-23T18:54:07.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-24T13:47:31.140Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vimalyad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-23T12:54:22.000Z","updated_at":"2026-03-23T18:54:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vimalyad/snake-and-ladder-game","commit_stats":null,"previous_names":["vimalyad/snake-and-ladder-game"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/vimalyad/snake-and-ladder-game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimalyad%2Fsnake-and-ladder-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimalyad%2Fsnake-and-ladder-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimalyad%2Fsnake-and-ladder-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimalyad%2Fsnake-and-ladder-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vimalyad","download_url":"https://codeload.github.com/vimalyad/snake-and-ladder-game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimalyad%2Fsnake-and-ladder-game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34310816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-14T06:06:45.222Z","updated_at":"2026-06-14T06:06:45.990Z","avatar_url":"https://github.com/vimalyad.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐍🪜 Snake and Ladder Game\n\nA robust, terminal-based Snake and Ladder game engineered in Java. This project emphasizes clean architecture, applying\nSOLID principles, the Strategy Pattern, and the Factory Pattern to create a highly extensible and maintainable codebase.\n\n## ✨ Features\n\n* **Dynamic Board Generation:** Play on any $N \\times N$ board size.\n* **Smart Entity Placement:** Automatically generates $N$ Snakes and $N$ Ladders. The algorithm mathematically\n  guarantees that entities do not overlap, do not start/end on the same row (preventing horizontal moving walkways), and\n  do not create infinite loops.\n* **Multiplayer Support:** Supports a custom number of players taking turns in a continuous loop.\n* **Configurable Difficulty Levels:**\n    * **Easy:** Rolling three consecutive 6s resets your counter and grants another roll.\n    * **Hard:** Rolling three consecutive 6s instantly ends your turn and forfeits all accumulated movement for that\n      turn.\n* **Cycle-Free Architecture:** Utilizes a `TurnContext` to prevent \"Ghost Movements\" and decouple game rules from the\n  main execution loop.\n\n## 🏗️ Architecture \u0026 UML Class Diagram\n\nThe application is strictly divided into Entities (State), Strategies (Rules), Factories (Creation), and the Engine (\nExecution) to ensure zero architectural overlap.\n\n```mermaid\nclassDiagram\n    %% Core Engine \u0026 Factories\n    class GameFactory {\n        +createGame(n: int, numPlayers: int, difficulty: String): Game\n    }\n    class BoardFactory {\n        +createBoard(n: int): Board\n    }\n    class DiceFactory {\n        +createDice(faces: int): Dice\n    }\n    class DifficultyFactory {\n        +getStrategy(difficulty: String): DifficultyStrategy\n    }\n    class Game {\n        -board: Board\n        -strategy: DifficultyStrategy\n        -playerQueue: Queue~Player~\n        -dice: Dice\n        +play()\n    }\n\n    %% Entities\n    class Board {\n        -size: int\n        -boardEntityMap: Map~Integer, BoardEntity~\n        +addEntity(position: int, entity: BoardEntity)\n        +totalCells(): int\n        +getEntity(position: int): Optional~BoardEntity~\n    }\n    class BoardEntity {\n        \u003c\u003cabstract\u003e\u003e\n        -start: int\n        -end: int\n        +apply(): int\n        +getStart(): int\n        +getEnd(): int\n    }\n    class Snake {\n        +apply(): int\n    }\n    class Ladder {\n        +apply(): int\n    }\n    class Player {\n        -name: String\n        -currentPosition: int\n        +getName(): String\n        +getCurrentPosition(): int\n        +setCurrentPosition(pos: int)\n    }\n    class Dice {\n        -sides: int\n        +roll(): int\n    }\n    class TurnContext {\n        -skipTurn: boolean\n        -consecutiveSixes: int\n        -totalMoveCount: int\n        +incrementSixes()\n        +getConsecutiveSixes(): int\n        +resetSixes()\n        +addMove(amount: int)\n        +getTotalMoveCount(): int\n        +triggerSkip()\n        +isSkipTurn(): boolean\n    }\n\n    %% Strategies\n    class DifficultyStrategy {\n        \u003c\u003cinterface\u003e\u003e\n        +handleThreeSixes(context: TurnContext)\n    }\n    class EasyDifficultyStrategy {\n        +handleThreeSixes(context: TurnContext)\n    }\n    class HardDifficultyStrategy {\n        +handleThreeSixes(context: TurnContext)\n    }\n\n    %% Relationships\n    GameFactory --\u003e Game : Creates\n    GameFactory --\u003e BoardFactory : Uses\n    GameFactory --\u003e DifficultyFactory : Uses\n    GameFactory --\u003e DiceFactory : Uses\n    \n    Game --\u003e Board : Has-A\n    Game --\u003e DifficultyStrategy : Has-A\n    Game --\u003e Player : Manages Queue\n    Game --\u003e Dice : Uses\n    Game ..\u003e TurnContext : Creates per turn\n    \n    Board \"1\" *-- \"*\" BoardEntity : Contains\n    BoardEntity \u003c|-- Snake\n    BoardEntity \u003c|-- Ladder\n    \n    DifficultyStrategy \u003c|-- EasyDifficultyStrategy\n    DifficultyStrategy \u003c|-- HardDifficultyStrategy\n    DifficultyStrategy ..\u003e TurnContext : Modifies State\n```\n\n## 🚀 How to Run\n\n### Prerequisites\n\n* Java Development Kit (JDK) 11 or higher installed on your machine.\n\n### Compilation \u0026 Execution\n\n1. Clone the repository and navigate to the root directory.\n2. Compile the Java files:\n   ```bash\n   javac SnakeAndLadderGame/src/*.java\n   ```\n3. Run the application:\n   ```bash\n   java SnakeAndLadderGame.src.Main\n   ```\n\n### Gameplay Instructions\n\nUpon starting the game, you will be prompted to enter:\n\n1. **Board Dimension ($N$):** Enter a number (e.g., `10` for a standard 100-cell board).\n2. **Number of Players:** Enter the total amount of players.\n3. **Difficulty:** Type `easy` or `hard`.\n\nThe game will automatically simulate the dice rolls and display the action turn-by-turn until one player successfully\nlands exactly on the final cell.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvimalyad%2Fsnake-and-ladder-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvimalyad%2Fsnake-and-ladder-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvimalyad%2Fsnake-and-ladder-game/lists"}