{"id":18074299,"url":"https://github.com/mgmerino/battleship-game","last_synced_at":"2025-07-06T22:39:03.032Z","repository":{"id":257992719,"uuid":"873242498","full_name":"mgmerino/battleship-game","owner":"mgmerino","description":"Classic game implemented in Ruby","archived":false,"fork":false,"pushed_at":"2024-10-20T21:36:07.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T18:52:26.690Z","etag":null,"topics":["battleship-game","game","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgmerino.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-10-15T20:46:53.000Z","updated_at":"2025-03-19T18:32:29.000Z","dependencies_parsed_at":"2024-10-31T10:12:20.695Z","dependency_job_id":"1a28fe61-f88a-4ea8-9174-20e72526da3f","html_url":"https://github.com/mgmerino/battleship-game","commit_stats":null,"previous_names":["mgmerino/battleship-game"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mgmerino/battleship-game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgmerino%2Fbattleship-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgmerino%2Fbattleship-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgmerino%2Fbattleship-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgmerino%2Fbattleship-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgmerino","download_url":"https://codeload.github.com/mgmerino/battleship-game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgmerino%2Fbattleship-game/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263984989,"owners_count":23539769,"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":["battleship-game","game","ruby"],"created_at":"2024-10-31T10:12:11.229Z","updated_at":"2025-07-06T22:39:03.012Z","avatar_url":"https://github.com/mgmerino.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battleship\n\nThis is a simple implementation of the Battleship game in Ruby. It is a two-player game where each player has a board with ships on it. The players take turns to guess the location of the ships on the opponent's board. The first player to sink all the ships of the opponent wins the game.\n\n## Usage\n\nYou can install the gem by running:\n\n```bash\ngem install battleship\n```\n\nAfter installing the gem, you can start the game by running:\n\n```bash\nbattleship\n```\n\n## Technical Details\n\nThe game is implemented using the following classes:\n\n- `Cell`: Represents a cell on the board. It has a state that can be either `:empty`, `:ship`, `:hit`, or `:miss`.\n- `Grid`: Represents the board. It is responsible for placing the ships, and sending the attack to the cells.\n- `Ship`: Represents a ship on the grid. It has a size and a direction and health points determined by its size.\n- `Player`: Represents a player in the game. It has a grid and can make an attack on the opponent's grid.\n- `Engine`: The main game engine that controls the flow of the game. It spawns the ships, switch turns and manages the attack.\n\nThe game is played in the terminal. The players can see their own board and the opponent's board. The players take turns to make an attack by entering the coordinates of the cell they want to attack. The game displays the result of the attack and the state of the opponent's board.\n\nThe terminal client is implemented the following classes:\n- `Interface`: The main interface that displays the game state and takes input from the players.\n- `Presenter`: The presenter that formats the game state for display in the terminal.\n- `InputHandler`: The input handler that validates the input from the players.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/battleship.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgmerino%2Fbattleship-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgmerino%2Fbattleship-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgmerino%2Fbattleship-game/lists"}