This example will show how we can teach an AI to play a simple game using the Q-learning reinforcement learning algorithm.
This is implemented in pure Ruby without any external dependencies.
To run the game and play a human run:
$ ruby run.rb
To run the game and let the AI play run:
$ ruby run-q.rb
For more information about how this is implemented see Teaching an AI to play a simple game using q-learning.