4 ms·
Teaching an AI to play a simple game using Q-learning
- hervature 9y agoOne of my favourite undergraduate projects was applying Q-learning to the game Flappy Bird. http://www.mast.queensu.ca/%7Emath472/FlappyQ.pdf http://www.mast.queensu.ca/%7Emath472/FlappyQ.pdf
- ghostbrainalpha 9y agoThat was a cool read. Thank you.
- CGamesPlay 9y agoThis 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.html?dl=0 https://www.dropbox.com/s/eooqlhgg98zc398/Q-Learning%2B21.ht...
- bluetwo 9y agoHow does it work for that other game called "21"?
- kmill 9y agoI know that game as "nim," and Wikipedia shows 21 as a variation. https://en.wikipedia.org/wiki/Nim#The_21_game 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.
- pigscantfly 9y agoIf 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 https://mitpress.mit.edu/decision-making-under-uncertainty