Answers.Body: <p>One of the simplest games you could solve with an AI technique is <a href="https://en.wikipedia.org/wiki/Tic-tac-toe" rel="nofollow noreferrer">tic-tac-toe</a>, which is a very simple game. To solve it, you could use minimax or alpha-beta pruning (an extension of minimax), which are very basic but fundamental search techniques for two-player games, so minimax can be applied not only to tic-tac-toe but any two-player game.  </p>
  
  <p>The notes <a href="http://web.cs.ucla.edu/~rosen/161/notes/alphabeta.html" rel="nofollow noreferrer">CS 161 Recitation Notes - Minimax with Alpha-Beta Pruning</a> provide a decent overview (with a concrete example) of alpha-beta pruning, which may be a little bit confusing at the beginning, but it is a relatively simple search technique that you can grasp with a few reading iterations (but take this with a grain of salt because the time and effort that it takes to learn something strongly depends on your knowledge and experience). There are several tutorials online that show how to implement minimax and alpha-beta pruning for tic-tac-toe. I could list them all, but I think it's better you look for them and choose your favorite. Maybe have a look at <a href="https://github.com/Cledersonbc/tic-tac-toe-minimax" rel="nofollow noreferrer">this implementation</a>.</p>
  
  <p>Of course, when it comes to games, one cannot forget about reinforcement learning. I cannot currently list any good tutorials, but there are many resources online. You can even apply RL to tic-tac-toe, so this may be your next step. As someone mentioned in the comments, <a href="https://gym.openai.com/" rel="nofollow noreferrer">OpenAI's gym</a> is an RL library for implementing RL agents, which can be used to solve many games, so you should definitely have a look at it. OpenAI's gym comes with a <a href="https://gym.openai.com/docs/" rel="nofollow noreferrer">nice introduciton</a>, especially if you are already familiar with RL, which, of course, you probably should before trying to use it. In principle, you can apply RL to many games, including chess, snake, etc.</p>
  
  <p>There's also a book entitled <a href="http://www.cleveralgorithms.com/nature-inspired/index.html" rel="nofollow noreferrer">Clever Algorithms: Nature-Inspired Programming Recipes</a> by Jason Brownlee that describes numerous AI techniques, some of them could, in principle, be applied to games too. The book is concise and relatively clear. It also comes with <a href="https://github.com/clever-algorithms/CleverAlgorithms" rel="nofollow noreferrer">the implementation</a> (in Ruby, which is a language similar to Python) of all of the algorithms presented in it.</p>
  
  <p>To conclude, although this site is not appropriate for recommendations, I recommend you first get familiar with fundamental search techniques, such as minimax and alpha-beta pruning, then you could start learning RL, which can be applied to many games. There are many resources online for both of them.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-10T15:21:27.180Z
Answers.LastActivityDate: 2020-04-10T19:13:12.350Z
Answers.LastEditDate: 2020-04-10T19:13:12.350Z
Answers.UserDisplayName: nbro
Body: <p>I know the most basic rudimentary theory on AI, and I want to delve into actual practical coding with AI and machine learning. I already know a decent bit of coding in C++ and I'm learning Python syntax now. </p>
  
  <p>I think I want to start implementing artificial intelligence techniques for simple games (like snake or maybe chess, which isn't really a simple game, but I know a lot about it), and then move on to more complex methods and algorithms. </p>
  
  <p>So, what are some resources (e.g. tutorials, guides, books, etc.) for coding some artificial intelligence techniques in the context of games?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T13:51:50.257Z
Comments.Text: I don't know if it's enough for an answer, but if you're not already aware of it, [Gym](https://gym.openai.com) is probably the best introductory tool out there to train intelligent agents for games.
Comments.UserDisplayName: Edoardo Guerriero
Tags: <machine-learning><game-ai><reference-request><chess>
Title: What are some resources for coding some artificial intelligence techniques in the context of games?
UserDisplayName: Tarun
ThreadText: # What are some resources for coding some artificial intelligence techniques in the context of games?
  
  (Asked by: username_0 on 2020-04-10)
  
  I know the most basic rudimentary theory on AI, and I want to delve into actual practical coding with AI and machine learning. I already know a decent bit of coding in C++ and I'm learning Python syntax now.
  
  I think I want to start implementing artificial intelligence techniques for simple games (like snake or maybe chess, which isn't really a simple game, but I know a lot about it), and then move on to more complex methods and algorithms.
  
  So, what are some resources (e.g. tutorials, guides, books, etc.) for coding some artificial intelligence techniques in the context of games?
  
  **Tags:** machine-learning, game-ai, reference-request, chess
  
  > **Comments:**
  > **username_1**: I don't know if it's enough for an answer, but if you're not already aware of it, [Gym](https://gym.openai.com) is probably the best introductory tool out there to train intelligent agents for games.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-10. Score: 2 | Accepted answer
  
  One of the simplest games you could solve with an AI technique is [tic-tac-toe](https://en.wikipedia.org/wiki/Tic-tac-toe), which is a very simple game. To solve it, you could use minimax or alpha-beta pruning (an extension of minimax), which are very basic but fundamental search techniques for two-player games, so minimax can be applied not only to tic-tac-toe but any two-player game.
  
  The notes [CS 161 Recitation Notes - Minimax with Alpha-Beta Pruning](http://web.cs.ucla.edu/~rosen/161/notes/alphabeta.html) provide a decent overview (with a concrete example) of alpha-beta pruning, which may be a little bit confusing at the beginning, but it is a relatively simple search technique that you can grasp with a few reading iterations (but take this with a grain of salt because the time and effort that it takes to learn something strongly depends on your knowledge and experience). There are several tutorials online that show how to implement minimax and alpha-beta pruning for tic-tac-toe. I could list them all, but I think it's better you look for them and choose your favorite. Maybe have a look at [this implementation](https://github.com/Cledersonbc/tic-tac-toe-minimax).
  
  Of course, when it comes to games, one cannot forget about reinforcement learning. I cannot currently list any good tutorials, but there are many resources online. You can even apply RL to tic-tac-toe, so this may be your next step. As someone mentioned in the comments, [OpenAI's gym](https://gym.openai.com/) is an RL library for implementing RL agents, which can be used to solve many games, so you should definitely have a look at it. OpenAI's gym comes with a [nice introduciton](https://gym.openai.com/docs/), especially if you are already familiar with RL, which, of course, you probably should before trying to use it. In principle, you can apply RL to many games, including chess, snake, etc.
  
  There's also a book entitled [Clever Algorithms: Nature-Inspired Programming Recipes](http://www.cleveralgorithms.com/nature-inspired/index.html) by Jason Brownlee that describes numerous AI techniques, some of them could, in principle, be applied to games too. The book is concise and relatively clear. It also comes with [the implementation](https://github.com/clever-algorithms/CleverAlgorithms) (in Ruby, which is a language similar to Python) of all of the algorithms presented in it.
  
  To conclude, although this site is not appropriate for recommendations, I recommend you first get familiar with fundamental search techniques, such as minimax and alpha-beta pruning, then you could start learning RL, which can be applied to many games. There are many resources online for both of them.
  
  
  ---
  
  