{"id":16323133,"url":"https://github.com/danielstjules/battleship-puzzles","last_synced_at":"2025-10-31T21:30:27.914Z","repository":{"id":3419563,"uuid":"4470686","full_name":"danielstjules/battleship-puzzles","owner":"danielstjules","description":"Design and implementation of a battleships solitaire puzzle generator and algorithms to solve instances","archived":false,"fork":false,"pushed_at":"2012-05-28T23:22:23.000Z","size":744,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-25T22:15:40.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Olapic/javascript","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielstjules.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}},"created_at":"2012-05-28T13:13:55.000Z","updated_at":"2024-07-17T15:40:54.000Z","dependencies_parsed_at":"2022-08-20T15:41:14.474Z","dependency_job_id":null,"html_url":"https://github.com/danielstjules/battleship-puzzles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fbattleship-puzzles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fbattleship-puzzles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fbattleship-puzzles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fbattleship-puzzles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielstjules","download_url":"https://codeload.github.com/danielstjules/battleship-puzzles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239231086,"owners_count":19603990,"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":[],"created_at":"2024-10-10T22:54:02.660Z","updated_at":"2025-10-31T21:30:27.859Z","avatar_url":"https://github.com/danielstjules.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"battleship-puzzles\n==================\n\nBrief Overview\n-------------------------\n\nClasses and algorithms I wrote to solve Battleship Solitaire, \nan NP-Complete problem. Puzzles are displayed using the following\nformat:\n\n\t  2 0 2 1 3 2 0 \n\t0 - - - - - - - \n\t2 - - o - o - - \n\t1 - - o - - - - \n\t1 o - - - - - - \n\t2 - - - - o o - \n\t0 - - - - - - - \n\t4 o - - o o o - \n\tn: 7 m: 7\n\tbattleships: 0\n\tcruisers: 1\n\tdestroyers: 2\n\tsubmarines: 3\n\nThe code I wrote does not use hints like the \"Fathom it!\" variation \ndoes. The backtracking solutions are completely ineffective at solving \nany reasonable number of instances using a board size greater than 7. \nWithout pruning, even less so.\n\nUsing backtracking with pruning to solve 50 instances of a 7x7 configuration \nwith 1 cruiser, 2 destroyers, and 3 submarines, it averaged 78.385s per instance, \nwith a minimum of 0.0017s, and a maximum of 1667.682s. \n\nNaive backtracking proved to be completely useless, and the first-fit heuristic \nonly manages an 80.72% accuracy with a 5x5 board. This sharply drops to 29.07% \nwith the 6x6 puzzle configuration I chose. \n\nExample Use\n-------------------------\n\n\timport puzzle\n\timport backtracking_pruning\n\t\n    x = puzzle.Puzzle(7,7,0,1,2,3,0)\n    x.print_solution()\n    backtracking_pruning.BacktrackingPruning(x)    \n    x.print_alg_solution()\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstjules%2Fbattleship-puzzles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielstjules%2Fbattleship-puzzles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstjules%2Fbattleship-puzzles/lists"}