Answers.Body: <p>If it's a 2-player game it goes a little deeper into RL if you want both sides to be RL algorithms. I recommend reading about game theory and what is a Nash Equilibrium to start. For algorithms <a href="https://github.com/hiive/hiivemdptoolbox" rel="nofollow noreferrer">hiivemdptoolbox</a> has <a href="https://gym.openai.com/" rel="nofollow noreferrer">openai-gym</a> compatibility as well as Q-Learning. You will need to add code to make 2 learners play each other. I would also recommend adding Dyna-Q to the Q-Learner as it will probably speed up the learning.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-30T16:46:34.630Z
Answers.Text: I was thinking the same thing about leveraging learning from both sides. I guess I couldn't have the same learner play both sides and split the data on the go?
Answers.UserDisplayName: Wes Tomer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-13T18:36:40.053Z
Answers.LastActivityDate: 2021-06-13T18:36:40.053Z
Answers.UserDisplayName: A_Arnold
Answers.Body: <p>There are many approaches - the initial one would be a rule based one with some amount of randomness. The ML-AI approach is some variation of <a href="https://en.m.wikipedia.org/wiki/Reinforcement_learning" rel="nofollow noreferrer">reinforcement learning</a>, defining your game as an environment, see for instance <a href="https://gym.openai.com" rel="nofollow noreferrer">openai-gym</a>. ”Some variation” might be Deep Q Learning or <a href="https://medium.com/sciforce/reinforcement-learning-and-asynchronous-actor-critic-agent-a3c-algorithm-explained-f0f3146a14ab" rel="nofollow noreferrer">A3C</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-04T20:53:21.153Z
Answers.LastActivityDate: 2021-06-04T20:53:21.153Z
Answers.UserDisplayName: Edwin Carlsson
Body: <p>I am relatively new to Python but I taught myself enough to code a two-player board game that is similar to chess. It has a simple Tkinter UI. Now I am dipping into machine learning, and I want to write another program to play itself in this game repeatedly and &quot;naturally&quot; learn strategies for playing the game.</p>
  <p>Can anyone give advice on what I might be able to use for this? Is Tensorflow a good option? Is there a Python library well suited for this that I could adapt and train? I am partially through the <a href="https://buildingai.elementsofai.com/" rel="nofollow noreferrer">buildingai.elementsofai.com</a> course, but I am still very new at ML / AI.</p>
  
Tags: <neural-networks><machine-learning><reinforcement-learning><python>
Title: Best way to use/learn ML for board-game reinforcement learning
UserDisplayName: Wes Tomer
ThreadText: # Best way to use/learn ML for board-game reinforcement learning
  
  (Asked by: username_0 on 2021-06-04)
  
  I am relatively new to Python but I taught myself enough to code a two-player board game that is similar to chess. It has a simple Tkinter UI. Now I am dipping into machine learning, and I want to write another program to play itself in this game repeatedly and "naturally" learn strategies for playing the game.
  
  Can anyone give advice on what I might be able to use for this? Is Tensorflow a good option? Is there a Python library well suited for this that I could adapt and train? I am partially through the [buildingai.elementsofai.com](https://buildingai.elementsofai.com/) course, but I am still very new at ML / AI.
  
  **Tags:** neural-networks, machine-learning, reinforcement-learning, python
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-06-13. Score: 0 | Accepted answer
  
  If it's a 2-player game it goes a little deeper into RL if you want both sides to be RL algorithms. I recommend reading about game theory and what is a Nash Equilibrium to start. For algorithms [hiivemdptoolbox](https://github.com/hiive/hiivemdptoolbox) has [openai-gym](https://gym.openai.com/) compatibility as well as Q-Learning. You will need to add code to make 2 learners play each other. I would also recommend adding Dyna-Q to the Q-Learner as it will probably speed up the learning.
  
  > **Comments:**
  > **username_0**: I was thinking the same thing about leveraging learning from both sides. I guess I couldn't have the same learner play both sides and split the data on the go?  
  
  ---
  
  ### Answer by username_2 on 2021-06-04. Score: 0
  
  There are many approaches - the initial one would be a rule based one with some amount of randomness. The ML-AI approach is some variation of [reinforcement learning](https://en.m.wikipedia.org/wiki/Reinforcement_learning), defining your game as an environment, see for instance [openai-gym](https://gym.openai.com). ”Some variation” might be Deep Q Learning or [A3C](https://medium.com/sciforce/reinforcement-learning-and-asynchronous-actor-critic-agent-a3c-algorithm-explained-f0f3146a14ab).
  
  
  ---
  
  