{"id":23790467,"url":"https://github.com/msampathkumar/battleship","last_synced_at":"2025-09-06T09:32:22.588Z","repository":{"id":91401100,"uuid":"155721951","full_name":"msampathkumar/battleship","owner":"msampathkumar","description":"Creates a mini Battlezone Game","archived":false,"fork":false,"pushed_at":"2018-11-01T07:20:26.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T17:42:32.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msampathkumar.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}},"created_at":"2018-11-01T13:47:14.000Z","updated_at":"2018-11-02T12:15:51.000Z","dependencies_parsed_at":"2023-04-11T18:32:22.481Z","dependency_job_id":null,"html_url":"https://github.com/msampathkumar/battleship","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/msampathkumar/battleship","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msampathkumar%2Fbattleship","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msampathkumar%2Fbattleship/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msampathkumar%2Fbattleship/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msampathkumar%2Fbattleship/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msampathkumar","download_url":"https://codeload.github.com/msampathkumar/battleship/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msampathkumar%2Fbattleship/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273886135,"owners_count":25185504,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":"2025-01-01T17:41:02.328Z","updated_at":"2025-09-06T09:32:22.536Z","avatar_url":"https://github.com/msampathkumar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Info\n\nThis module contains a simple Battle Ship game, which can be described as folows:\n- There are two players in the game.\n- Players have their own battle area with similar dimensions, each coordinate typically refferred as a cell.\n- Players have same number of ships with similar dimensions which are places on their respective battle area.\n- Ships can be of two types, P(weak) and Q(strong).\n- P type Ship takes a sigle hit on its cell to get cell destroyed whereas Q takes 2.\n- Players have moves which target a certain cell of a battle area ().\n- Player 1 starts the game, and they alternatively takes turn.\n- if attaking players' move hits the other player, attacker\n    gets another chance to make a move.\n- As soon as all the ships with other player gets destroyed, attacker wins.\n- If both players exhausts their moves and none gets destroyed, then they call Peace.\n\n# Installation\n```\nmake install\n# or\npip install .\n```\n\n# Usage\n```\ngame test.txt\n```\n\n# Run unittests\n```\nmake unittests\n```\n\n# Create a new Game with Python interpreter\n```\nimport game\ng = game.Game()\n\n# Get Player 1 and 2\np1 = g.get_player_1()\np2 = g.get_player_2()\n\n# add a new Q type ship for p1 and p2\ng.add_ship(p1, width=1, height=2, starts_at='B2', ship_type='Q')\ng.add_ship(p2, width=1, height=2, starts_at='C1', ship_type='Q')\n\n# add moves for each player\ng.add_moves(p1, ['C1', 'B1', 'C1', 'C2', 'D1', 'E1'])\ng.add_moves(p2, ['C1', 'B1', 'B1', 'B2', 'B3', 'D1'])\n\n# start the game\ng.start()\n\n```\n\n# Contributors\n\n@pawansingh126\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsampathkumar%2Fbattleship","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsampathkumar%2Fbattleship","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsampathkumar%2Fbattleship/lists"}