Description Usage Arguments Details See Also Examples
Start tic-tac-toe game on the console.
1 |
player1, player2 |
objects that inherit |
sleep |
interval to take before an AI player to make decision, in second |
At default, the game is played between humans.
Set player1
or player2
to ttt_ai()
to play against
an AI player.
The strength of the AI can be adjusted by passing the level
argument (0 (weekest) to 5 (strongest)) to the ttt_ai
function.
To input your move, type the position like "a1". Only two-length string consisting of an alphabet and a digit is accepted. Type "exit" to finish the game.
You may set both player1
and player2
as AI players.
In this case, the game transition is displayed on the console without
human inputs.
For conducting a large sized simulations of games between AIs, refer to
ttt_simulate
ttt_ai
, ttt_human
,
ttt_simulate
1 2 3 4 | ## Not run:
ttt(ttt_human(), ttt_random())
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.