{"id":21522801,"url":"https://github.com/petrglad/robo-minesweeper","last_synced_at":"2025-03-17T17:25:06.897Z","repository":{"id":35018323,"uuid":"39120458","full_name":"PetrGlad/robo-minesweeper","owner":"PetrGlad","description":"Algorithm (solver) that plays Minesweeper game","archived":false,"fork":false,"pushed_at":"2016-02-09T02:16:43.000Z","size":87,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T04:53:28.853Z","etag":null,"topics":["algorithm","mines","minesweeper-game"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"NuGetArchive/NuGet3","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PetrGlad.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}},"created_at":"2015-07-15T06:32:38.000Z","updated_at":"2018-03-06T09:04:45.000Z","dependencies_parsed_at":"2022-09-11T15:22:05.190Z","dependency_job_id":null,"html_url":"https://github.com/PetrGlad/robo-minesweeper","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/PetrGlad%2Frobo-minesweeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PetrGlad%2Frobo-minesweeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PetrGlad%2Frobo-minesweeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PetrGlad%2Frobo-minesweeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PetrGlad","download_url":"https://codeload.github.com/PetrGlad/robo-minesweeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075990,"owners_count":20394035,"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":["algorithm","mines","minesweeper-game"],"created_at":"2024-11-24T01:11:46.400Z","updated_at":"2025-03-17T17:25:06.878Z","avatar_url":"https://github.com/PetrGlad.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"robo-minesweeper\n================\n\nProgram that automatically plays [Minesweeper game](https://en.wikipedia.org/wiki/Minesweeper_(video_game)).\n\n![robo-menesweeper in action](doc/screenshot.jpg)\n\nIn ambiguous situations algorithm attempts to minimize risk.\nThe algorithm:\n 1. Enumerate all mine layouts that are consistent with intel.\n 2. Find probabilities of a mine in an unknown position.\n 3. Probe positions with least probability of mine in them.\n\nNumber of mines is not provided to algorithm (original game does show total number of mines).\nTactics that relay on this number might be useful in endspiel - those are not implemented\n(see also TODO comments in Algorithm.hs).\n\nTo build with Cabal tool:\n```\n  cabal build\n```  \nTo run:\n```\n  dist/build/robominer/robominer\n```  \nor specify rows, columns, mines count:\n```\n    dist/build/robominer/robominer 128 64 1200\n```\nIn case of dense fields try (set -N parameter to number of cores or threads in your processor):\n```\n  dist/build/robominer/robominer +RTS -N4 -K256m -RTS 128 64 1500\n```    \n(It still may take forever to complete but at least it does not fail with an exception)\n\nAdd \"Fancy\" to run with alternative algorithm\n```\n  dist/build/robominer/robominer 128 64 1000 Fancy\n```    \nThis algorithm prefers to sweep empty areas first as does original game automatically.\nDue to smaller sweeps this algorithm runs slower because requires more rendering.\nOn sparse fields it would be as fast as the default one.\n\nAlso as this algorithm postpones hard work for later it may accrue too big chains for real analysis.\nThis means that it often hangs on moderately dense fields. Try, for example, `robominer 164 64 1300`\nwhich in most cases processed well by Default algorithm but overloads Fancy.   \n\nResults\n-------\n\nIt certainly plays minesweeper better (and a lot faster) than me what I wanted to achieve initially.\nWin-rate with usual settings:\n\n* Beginner: 8 × 8 field with 10 mines (density 0.156) - 56%\n* Intermediate: 16 × 16 field with 40 mines (density 0.156) - 55%\n* Expert: 30 × 16 field with 99 mines (density 0.206) - 32%\n\nSee 'scripts' subdirectory for scripts that calculate win-rate.\n\nHints\n-----\n\n### Game replay\nYou may store output of robominer into a file and later output it to ANSI-compatible\nterminal for replay. For example:\n```\n  time dist/build/robominer/robominer +RTS -N2 -K200m -RTS 164 64 1000  Fancy \u003erobo.log\n  cat robo.log\n```\n(This also shows that ~50-70% of running time is spent redrawing board.)\n\n### Build hints\n\nBefore running Cabal build init Cabal sandbox to avoid libraries version conflicts:\n```\n  cabal sandbox init\n  cabal install --only-dependencies\n```\n\nThe above instructions assume use of Cabal tool. To build/run with Stack instead use:\n```\n  stack build\n  stack exec robominer\n```\n\nTODO\n----\n\n* Implement remaining mines count heuristics (stepping randomly into unexplored area)\n* Cleanup/streamline code\n* Profile to find out where positions enumeration takes very long time sometimes (in hope it can be optimized).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrglad%2Frobo-minesweeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrglad%2Frobo-minesweeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrglad%2Frobo-minesweeper/lists"}