{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "easyAI\n======\n\nEasyAI (full documentation here_) is a pure-Python artificial intelligence framework for two-players abstract games such as Tic Tac Toe, Connect 4, Reversi, etc.\nIt makes it easy to define the mechanisms of a game, and play against the computer or solve the game.\nUnder the hood, the AI is a Negamax algorithm with alpha-beta pruning and transposition tables as described on Wikipedia_.\n\n\nInstallation\n------------\n\nIf you have ``pip`` installed, type this in a terminal ::\n \n sudo pip install easyAI\n \nOtherwise, dowload the source code (for instance on Github_), unzip everything into one folder and in this folder, in a terminal, type ::\n \n sudo python setup.py install\n\nAdditionnally you will need to install Numpy to be able to run some of the examples.\n\n\nA quick example\n----------------\n\nLet us define the rules of a game and start a match against the AI: ::\n \n from easyAI import TwoPlayersGame, Human_Player, AI_Player, Negamax\n \n class GameOfBones( TwoPlayersGame ):\n \"\"\" In turn, the players remove one, two or three bones from a\n pile of bones. The player who removes the last bone loses. \"\"\"\n \n def __init__(self, players):\n self.players = players\n self.pile = 20 # start with 20 bones in the pile\n self.nplayer = 1 # player 1 starts\n\n def possible_moves(self): return ['1','2','3']\n def make_move(self,move): self.pile -= int(move) # remove bones.\n def win(self): return self.pile<=0 # opponent took the last bone ?\n def is_over(self): return self.win() # Game stops when someone wins.\n def show(self): print \"%d bones left in the pile\"%self.pile\n def scoring(self): return 100 if game.win() else 0 # For the AI\n \n # Start a match (and store the history of moves when it ends)\n ai = Negamax(13) # The AI will think 13 moves in advance \n game = GameOfBones( [ Human_Player(), AI_Player(ai) ] )\n history = game.play()\n \nResult: ::\n \n 20 bones left in the pile\n \n Player 1 what do you play ? 3\n\n Move #1: player 1 plays 3 :\n 17 bones left in the pile\n\n Move #2: player 2 plays 1 :\n 16 bones left in the pile\n \n Player 1 what do you play ?\n\nSolving the game\n*****************\n\nLet us now solve the game: ::\n\n from easyAI import id_solve\n r,d,m = id_solve(GameOfBones, ai_depths=range(2,20), win_score=100)\n\nWe obtain ``r=1``, meaning that if both players play perfectly, the first player to play can always win (-1 would have meant always lose), ``d=10``, which means that the wins will be in ten moves (i.e. 5 moves per player) or less, and ``m='3'``, which indicates that the first player's first move should be ``'3'``.\n\nThese computations can be sped up using a transposition table which will store the situations encountered and the best moves for each: ::\n \n tt = TT()\n GameOfBones.ttentry = lambda game : game.pile # key for the table\n r,d,m = id_solve(GameOfBones, range(2,20), win_score=100, tt=tt)\n\nAfter these lines are run the variable ``tt`` contains a transposition table storing the possible situations (here, the possible sizes of the pile) and the optimal moves to perform. With ``tt`` you can play perfectly without *thinking*: ::\n \n game = GameOfBones( [ AI_Player( tt ), Human_Player() ] )\n game.play() # you will always lose this game :)\n \nContribute !\n------------\n\nEasyAI is an open source software originally written by Zulko_ and released under the MIT licence. It could do with some improvements, so if your are a Python/AI guru maybe you can contribute through Github_ . Some ideas: AI algos for incomplete information games, better game solving strategies, (efficient) use of databases to store moves, AI algorithms using parallelisation.\n\nFor troubleshooting and bug reports, the best for now is to ask on Github_.\n\n.. _here: http://zulko.github.io/easyAI\n.. _Wikipedia: http://en.wikipedia.org/wiki/Negamax\n.. _Zulko : https://github.com/Zulko\n.. _JohnAD : https://github.com/JohnAD\n.. _Github : https://github.com/Zulko/easyAI\n\nMaintainers\n-----------\n\n- Zulko_ (owner)\n- JohnAD_", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "board games AI artificial intelligence negamax", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "easyAI", "package_url": "https://pypi.org/project/easyAI/", "platform": "", "project_url": "https://pypi.org/project/easyAI/", "project_urls": null, "release_url": "https://pypi.org/project/easyAI/1.0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Easy-to-use game AI algorithms (Negamax etc. )", "version": "1.0.0.4" }, "last_serial": 3006945, "releases": { "0.0.0.1": [], "0.0.0.2": [ { "comment_text": "", "digests": { "md5": "1847ff76c77e9b8c5f093f9259c2bda4", "sha256": "acfa191cd9b2d51e0741f09a388ae51ed7653a831ff85da9ec23970cf9287657" }, "downloads": -1, "filename": "easyAI-0.0.0.2.tar.gz", "has_sig": false, "md5_digest": "1847ff76c77e9b8c5f093f9259c2bda4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13725, "upload_time": "2013-12-21T10:24:34", "url": "https://files.pythonhosted.org/packages/2e/e4/735c2aac6be4840bdee92c0c7f3d90359215fa1480d2a603681a180ebf5c/easyAI-0.0.0.2.tar.gz" } ], "0.0.0.4": [ { "comment_text": "", "digests": { "md5": "9ac540e72ffa474693261b7bc17ed797", "sha256": "57341a0e7a8bdf2d3806acb66c3660f2d8b2e52da9dc9bc332c7f2c5c34bfdaa" }, "downloads": -1, "filename": "easyAI-0.0.0.4.tar.gz", "has_sig": false, "md5_digest": "9ac540e72ffa474693261b7bc17ed797", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26076, "upload_time": "2014-01-08T07:48:55", "url": "https://files.pythonhosted.org/packages/d9/2f/4ec8e464900a6c8e49da9c5456e152a36e19756008887d1b16930535da4c/easyAI-0.0.0.4.tar.gz" } ], "1.0.0.2": [ { "comment_text": "", "digests": { "md5": "bce061666291afa0695e4b4448fd1ed6", "sha256": "70412b294554e3ca87d7313e54eb28359414d2fb93d934553cdc7dfe0f8492dd" }, "downloads": -1, "filename": "easyAI-1.0.0.2.tar.gz", "has_sig": false, "md5_digest": "bce061666291afa0695e4b4448fd1ed6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 69390, "upload_time": "2017-07-06T22:18:08", "url": "https://files.pythonhosted.org/packages/8b/76/d45f2a31df013a09aa5c7a3ddf7d8c9d86702ca5c8606051bc9fb72efbea/easyAI-1.0.0.2.tar.gz" } ], "1.0.0.2a": [ { "comment_text": "", "digests": { "md5": "e578037fc56a532e133400502157761c", "sha256": "2cd506eb5df5566a09876023ff39397932b57467c5806e37ef6e6a675cba8b78" }, "downloads": -1, "filename": "easyAI-1.0.0.2a.tar.gz", "has_sig": false, "md5_digest": "e578037fc56a532e133400502157761c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4778, "upload_time": "2017-07-06T22:46:52", "url": "https://files.pythonhosted.org/packages/c8/fa/4432802595eddb09f945ba53ef92260e64767791a48263e7d281276d9fbd/easyAI-1.0.0.2a.tar.gz" } ], "1.0.0.3": [ { "comment_text": "", "digests": { "md5": "4bed99de5c30004f536a43ce9f76fedd", "sha256": "2d2687efb8caa6522c03ce3a9b3b353a00dd3eca1eb575a19cf17de9ffa3cb97" }, "downloads": -1, "filename": "easyAI-1.0.0.3.tar.gz", "has_sig": false, "md5_digest": "4bed99de5c30004f536a43ce9f76fedd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3392, "upload_time": "2017-07-06T23:00:25", "url": "https://files.pythonhosted.org/packages/58/e1/f205c6e8ce68958c0234c8c70984237c1adad18c0a06f63f48f8898363f2/easyAI-1.0.0.3.tar.gz" } ], "1.0.0.4": [ { "comment_text": "", "digests": { "md5": "d0712408207acab527771115b7bf0a78", "sha256": "c6775ed6f20614f50a4f46af8709439d9c142b9562bb62bd4f64b1ddbb0b2674" }, "downloads": -1, "filename": "easyAI-1.0.0.4.tar.gz", "has_sig": false, "md5_digest": "d0712408207acab527771115b7bf0a78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27605, "upload_time": "2017-07-07T18:19:32", "url": "https://files.pythonhosted.org/packages/54/a0/c81556cd42db23a545a330e9331f96fd658fb4098392f7f686fa5c9b8836/easyAI-1.0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d0712408207acab527771115b7bf0a78", "sha256": "c6775ed6f20614f50a4f46af8709439d9c142b9562bb62bd4f64b1ddbb0b2674" }, "downloads": -1, "filename": "easyAI-1.0.0.4.tar.gz", "has_sig": false, "md5_digest": "d0712408207acab527771115b7bf0a78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27605, "upload_time": "2017-07-07T18:19:32", "url": "https://files.pythonhosted.org/packages/54/a0/c81556cd42db23a545a330e9331f96fd658fb4098392f7f686fa5c9b8836/easyAI-1.0.0.4.tar.gz" } ] }