{"id":26070424,"url":"https://github.com/unvercan/snake","last_synced_at":"2025-03-08T23:46:11.394Z","repository":{"id":281310568,"uuid":"940975331","full_name":"unvercan/snake","owner":"unvercan","description":"🐍 A simple console-based Snake Game written in Java, supporting Maven and Docker. Play in the terminal with adjustable board size!","archived":false,"fork":false,"pushed_at":"2025-03-08T07:20:50.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-08T08:25:21.197Z","etag":null,"topics":["cli-game","console-game","docker","game-development","java","java17","maven","opensource","snake-game","terminal-game"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"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/unvercan.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}},"created_at":"2025-03-01T07:14:53.000Z","updated_at":"2025-03-08T07:24:12.000Z","dependencies_parsed_at":"2025-03-08T08:36:08.741Z","dependency_job_id":null,"html_url":"https://github.com/unvercan/snake","commit_stats":null,"previous_names":["unvercan/snake"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unvercan%2Fsnake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unvercan%2Fsnake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unvercan%2Fsnake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unvercan%2Fsnake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unvercan","download_url":"https://codeload.github.com/unvercan/snake/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242623568,"owners_count":20159702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli-game","console-game","docker","game-development","java","java17","maven","opensource","snake-game","terminal-game"],"created_at":"2025-03-08T23:46:10.902Z","updated_at":"2025-03-08T23:46:11.369Z","avatar_url":"https://github.com/unvercan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snake Game\n\n## Description\n\nThis is a simple console-based Snake game written in Java. The player controls a snake, moving it around the board to consume food and grow in length. The objective is to achieve the maximum snake length without colliding with the walls or itself.\n\n## Features\n\n- Classic Snake game mechanics\n- Player-controlled movement using `W`, `A`, `S`, `D` keys\n- Food generation at random locations\n- Collision detection (walls and self)\n- Win condition when the snake reaches the maximum possible length\n- Console-based interface with real-time updates\n- Adjustable board size\n\n## Technologies Used\n\n- **Java**   (17 or later)\n- **Maven**  (if building the project manually)\n- **Docker** (if running inside a container)\n\n## How to Play\n\n1. Run the application.\n2. Control the snake using the following keys:\n    - `W` → Move up\n    - `A` → Move left\n    - `S` → Move down\n    - `D` → Move right\n3. Eat food (`*`) to grow longer.\n4. Avoid crashing into walls (`#`) or yourself.\n5. The game ends when:\n    - The snake collides with a wall or itself (lose condition).\n    - The snake reaches the maximum possible length (win condition).\n\n## Installation and Setup\n\n### Prerequisites\n\n- **Java 17** or later\n- **Maven** (if building the project manually)\n- **Docker** (if running inside a container)\n\n### Running the Game (Java and Maven)\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/unvercan/snake.git\n   cd snake\n   ```\n2. Build the project using Maven:\n   ```sh\n   mvn clean package\n   ```\n    - This command will clean any previous builds and package the project into a JAR file.\n3. Run the game using the JAR file:\n   ```sh\n   java -jar target/snake-1.0.jar boardWidth=15 boardHeight=8\n   ```\n   - `boardWidth`: Defines the board width.\n   - `boardHeight`: Defines the board height.\n   \n### Running the Game (Docker)\n\n1. **Build the Docker Image:**\n   ```sh\n   docker build -t snake .\n   ```\n2. **Run the Docker Container:**\n   ```sh\n   docker run --rm -it -e BOARD_WIDTH=15 -e BOARD_HEIGHT=8 snake\n   ```\n   - `-t` adds the name of the image while building the Docker file.\n   - `--rm` ensures the container is removed after it stops.\n   - `-it` keeps the container interactive for user input.\n   - `-e BOARD_WIDTH=15`: Sets the board width inside the container.\n   - `-e BOARD_HEIGHT=8`: Sets the board height inside the container.\n\nNow you can play the Snake game directly in the terminal inside the Docker container!\n\n## Project Structure\n\n```\n├── src\n│   ├── tr.unvercanunlu.snake     # Main package\n│      ├── App.java               # Main Application entry point\n│      ├── Game.java              # Game logic\n│      ├── util                   # Package for Utility classes\n│          ├── ConsoleUtil.java   # Console related Utility class\n│          ├── InputUtil.java     # Input related Utility class\n│          ├── NumberUtil.java    # Number related Utility class\n│      ├── constant               # Package for Enums\n│          ├── Tile.java          # Enum for board tiles\n│          ├── Status.java        # Enum for game statuses\n│          ├── Move.java          # Enum for movement directions\n│          ├── Input.java         # Enum for player inputs\n│          ├── Action.java        # Enum for possible actions\n├── pom.xml                       # Maven configuration file\n├── Dockerfile                    # Docker setup\n```\n\n## License\n\nThis project is open-source and available under the **MIT License**.\n\n## Author\n\nÜnver Can Ünlü\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funvercan%2Fsnake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funvercan%2Fsnake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funvercan%2Fsnake/lists"}