{"library":"open-spiel","title":"OpenSpiel: A Framework for Reinforcement Learning in Games","description":"OpenSpiel is a collection of environments and algorithms for research in reinforcement learning and search in games. It provides implementations of numerous games (e.g., Chess, Go, Poker, Tic-Tac-Toe) and common algorithms (e.g., MCTS, AlphaZero, CFR). The library is currently at version 1.6.12, with frequent staging releases in preparation for a major 2.0 release. It's developed and maintained by Google DeepMind.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install open-spiel"],"cli":null},"imports":["import pyspiel","game = pyspiel.load_game('tic_tac_toe')"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pyspiel\n\n# Load a game by its string identifier\ngame = pyspiel.load_game(\"tic_tac_toe\")\n\n# Create a new initial state for the game\nstate = game.new_initial_state()\n\n# Print the initial state\nprint(\"Initial state:\\n\", state)\n\n# Apply a move (e.g., player 0 places 'X' in the center)\n# Actions are integer indices, you can get valid actions via state.legal_actions()\nstate.apply_action(4) # Assuming 4 is a valid action in Tic-Tac-Toe\nprint(\"\\nState after move:\\n\", state)\n\n# Check if the game is terminal\nif state.is_terminal():\n    print(\"\\nGame is over. Returns:\", state.returns())","lang":"python","description":"This quickstart demonstrates how to load a game, create an initial state, apply an action, and check the game's status using the core `pyspiel` module.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}