{"id":23127652,"url":"https://github.com/hlfshell/ai_playground","last_synced_at":"2025-07-13T13:35:56.792Z","repository":{"id":146169967,"uuid":"305184975","full_name":"hlfshell/ai_playground","owner":"hlfshell","description":"Playground repos while playing with artificial intelligence algorithms","archived":false,"fork":false,"pushed_at":"2021-09-01T03:18:47.000Z","size":2819,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T17:14:47.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hlfshell.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-18T19:57:04.000Z","updated_at":"2025-01-01T20:29:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"83c8644d-3f9a-4297-b5bd-1bbd4c6f81c7","html_url":"https://github.com/hlfshell/ai_playground","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/hlfshell%2Fai_playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fai_playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fai_playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fai_playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlfshell","download_url":"https://codeload.github.com/hlfshell/ai_playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128739,"owners_count":20888234,"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-12-17T09:14:23.015Z","updated_at":"2025-04-04T05:42:21.699Z","avatar_url":"https://github.com/hlfshell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Playground\nPlayground repos while playing with AI algorithms\n\n\n## Search Algorithms\n\nSearch algorithms can be found in the `search` folder. Within, you'll find these files:\n\n* `test.py` - will generate a random map and attempt to traverse it with each of the available algorithms. IF the map generated can't be solved, it'll error out.\n- `searcher.py` - A generic `Searcher` class that sets up and manages basics a searcher would need. Expects children to implement a `step` function which expans the robot's consideration of a path by one \"step\" in its search algorithm.\n- `grid.py` - a `Grid` class with internal functions that provide utility functions that include:\n    - The ability to read and write grids to a text file with any CSV support (default is space delimited). This means a simple spreadsheet app can be used to easily generate maps.\n    - The ability to draw the map out to an image\n    - Controlled moving of a \"robot\" around the map, neighbor finding, obstacle awareness, goal awareness, etc.\n\n    Within the `grid.py` file there is also a `GridGIFMaker` class which accepts a grid and can generate a gif of a given `Searcher` class. There is also a `grid_generator` that makes random `Grid` objects.\n- `breadth_first_search.py` - implements a `BFS` breadth first search `Searcher`\n- `depth_first_search.py` - implements a `DFS` depth first search `Searcher` \n- `a_star.py` - this implements an A* searcher that uses simple euclidean distance for its cost function.\n\n### Search Examples\n\n#### Breadth First Search\n![Breadth First Search](search/example_gifs/bfs.gif)\n\n#### Depth First Search\n![Depth First Search](search/example_gifs/dfs.gif)\n\n#### A* Search\n![A* Search](search/example_gifs/astar.gif)\n\n## Min Max\n\nTo experiment with the `min max` algorithm I coded up a **Connect 4** game. The files of note here are:\n\n- `connect_four_board.py` - this is similar to `grid.py` before - it implements the connect four board of any given size, handles placing a piece (and having it \"fall\" to the correct place), has built in checks to determine a winner, and image drawing/gif writing capabilities.\n- `play_connect_four.py` - is a file that will have an in-terminal game of connect four against a bot as specified in the code.\n- `random_connect_four.py` - as a quick test and comparison bot, this bot literally just picks a random legal move each turn\n- `min_max_connect_four.py` - implements a minmax bot that plays connect four. It has a specifiable depth (defaults to 4) for how many turns ahead it must view.\n- `random_vs_minmax_connect_four.py` - pits the minmax bot against the random bot for 100 matches of Connect 4\n\n### Example GIFs\n\n#### Random (Red) vs Minmax (Blue) - 100 Games\n\n*minmax bot won 99 of 100 games against the random bot*\n\n![random bot vs minmax bot](search/example_gifs/random_vs_minmax.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfshell%2Fai_playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlfshell%2Fai_playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfshell%2Fai_playground/lists"}