{"id":50541774,"url":"https://github.com/notakeith/battleship","last_synced_at":"2026-06-03T20:30:54.621Z","repository":{"id":361575150,"uuid":"1125779252","full_name":"notakeith/battleship","owner":"notakeith","description":"Console bot for Battleship over stdin/stdout. Supports master/slave roles, configurable grid, and two shot strategies: ordered sweep and hunt-and-target.","archived":false,"fork":false,"pushed_at":"2026-05-31T08:58:37.000Z","size":181,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T10:19:55.456Z","etag":null,"topics":["battleship","cpp","game-bot"],"latest_commit_sha":null,"homepage":"","language":"C++","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/notakeith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-12-31T10:47:08.000Z","updated_at":"2026-05-31T09:15:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/notakeith/battleship","commit_stats":null,"previous_names":["notakeith/cpp-sea-battle"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/notakeith/battleship","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notakeith%2Fbattleship","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notakeith%2Fbattleship/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notakeith%2Fbattleship/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notakeith%2Fbattleship/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notakeith","download_url":"https://codeload.github.com/notakeith/battleship/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notakeith%2Fbattleship/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33878990,"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-03T02:00:06.370Z","response_time":59,"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":["battleship","cpp","game-bot"],"created_at":"2026-06-03T20:30:54.534Z","updated_at":"2026-06-03T20:30:54.609Z","avatar_url":"https://github.com/notakeith.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battleship\n\n\u003e [Русская версия](README_RU.md)\n\n[![C++20](https://img.shields.io/badge/C%2B%2B-20-blue?logo=cplusplus\u0026logoColor=white)](https://en.cppreference.com/w/cpp/20)\n[![CMake](https://img.shields.io/badge/CMake-3.12%2B-064F8C?logo=cmake\u0026logoColor=white)](https://cmake.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n\nConsole bot for [Battleship](https://en.wikipedia.org/wiki/Battleship_(game)) over stdin/stdout. Supports master/slave roles, configurable grid size and ship counts, and two shot strategies: ordered sweep and hunt-and-target. Written as part of a C++ course at ITMO University.\n\nTwo roles: **master** sets game parameters, **slave** receives them. All interaction is via a line-based text protocol.\n\n## Build\n\n```bash\ngit clone https://github.com/notakeith/battleship-bot.git\ncd battleship-bot\ncmake -B build \u0026\u0026 cmake --build build\nctest --test-dir build\n```\n\nRequirements: CMake ≥ 3.12, GCC 13+ or Clang 17+.\n\n## Protocol\n\nAll commands and responses are lowercase strings separated by `\\n`.\n\n| Command | Response | Description |\n|---|---|---|\n| `ping` | `pong` | connection check |\n| `exit` | `ok` | terminate program |\n| `create master` | `ok` | master mode (fixed 5×4 grid, 3 four-cell ships) |\n| `create slave` | `ok` | slave mode (accepts parameters from master) |\n| `start` | `ok` | start game, place ships |\n| `stop` | `ok` | stop current game |\n| `set width N` | `ok` | set grid width |\n| `get width` | `N` | get grid width |\n| `set height N` | `ok` | set grid height |\n| `get height` | `N` | get grid height |\n| `set count [1-4] N` | `ok` | set ship count for type 1–4 |\n| `get count [1-4]` | `N` | get ship count for type 1–4 |\n| `set strategy ordered` | `ok` | strategy: sequential sweep |\n| `set strategy custom` | `ok` | strategy: hunt-and-target |\n| `shot X Y` | `hit` / `miss` / `kill` | receive shot on own grid |\n| `shot` | `X Y` | request next shot coordinates |\n| `set result [miss,hit,kill]` | — | report result of last shot |\n| `finished` | `yes` / `no` | is the game over? |\n| `win` | `yes` / `no` | did we win? |\n| `lose` | `yes` / `no` | did we lose? |\n| `dump PATH` | `ok` | save grid to file |\n| `load PATH` | `ok` | load grid from file |\n\n\u003e After each `shot` (request), `set result` must be sent before the next `shot`.\n\n## File format (dump/load)\n\n```\n5 20\n4 v 0 0\n4 v 2 0\n4 v 4 0\n```\n\nFirst line: `width height`. Each following line: `size direction x y`, where direction is `h` (horizontal) or `v` (vertical).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotakeith%2Fbattleship","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotakeith%2Fbattleship","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotakeith%2Fbattleship/lists"}