Hacker News new | past | comments | ask | show | jobs | submit login
Teaching an AI to play a simple game using Q-learning (practicalai.io)
118 points by ml-student on Aug 15, 2017 | hide | past | favorite | 8 comments



One of my favourite undergraduate projects was applying Q-learning to the game Flappy Bird. http://www.mast.queensu.ca/%7Emath472/FlappyQ.pdf


That was a cool read. Thank you.


If anyone is interested in learning more on this topic, Mykel Kochenderfer's "Decision Making Under Uncertainty" offers a stellar treatment of reinforcement learning from the ground up. https://mitpress.mit.edu/decision-making-under-uncertainty


This game really is quite simple! The go-to example I use for a simple game is called 21.

- There are N (usually 21) tokens in a pile. - A turn consists of removing 1, 2, or 3 tokens from the pile. - The player who removes the final token is the winner. - The opponent will always take tokens equal to n mod 4 if that is a valid move, otherwise will play randomly (this is the optimal strategy). - The AI plays first.

You can see my write-up here: [1]. One of the most interesting things for me was visually inspecting the action scores (at the end) to see how the agent learned the optimal strategy over time. My configuration took 3000 games to reach the optimal strategy against against a strong opponent (opponent epsilon = 0.1), and substantially longer as the opponent starts to play worse.

[1] https://www.dropbox.com/s/eooqlhgg98zc398/Q-Learning%2B21.ht...


I know that game as "nim," and Wikipedia shows 21 as a variation. https://en.wikipedia.org/wiki/Nim#The_21_game

There's a mechanical version of an AI from the 60s called Dr. Nim. It doesn't learn to play, of course, but instead it has a 3-bit binary counter.


How does it work for that other game called "21"?


This is an awesome idea, thanks for the weekend project!


Let us know how it turns out!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: