Create an AI tic-tac-toe game player
1 2 3
AI strength. must be Integer 0 (weekest) to 5 (strongest)
level argument controls the strength of AI, from
0 (weekest) to 5 (strongest).
ttt_random is an alias of
ttt_ai(level = 0).
ttt_ai object has the
getmove function, which takes
ttt_game object and returns a move considered as optimal.
getmove function is designed to take a
and returns a move using the policy function.
The object has the value and policy functions. The value function maps a game state to the evaluation from the first player's viewpoint. The policy function maps a game state to a set of optimal moves in light of the value evaluation. The functions have been trained through the Q-learning.
Strength (0 to 5)
xhash object that maps a game state to moves
xhash object that maps a game state to a value
Returns a move considered as optimal.
Output: a move
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.