ttt {tictactoe} | R Documentation |
Play Tic-Tac-Toe Game
Description
Start tic-tac-toe game on the console.
Usage
ttt(player1 = ttt_human(), player2 = ttt_human(), sleep = 0.5)
Arguments
player1 , player2 |
objects that inherit |
sleep |
interval to take before an AI player to make decision, in second |
Details
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
See Also
ttt_ai
, ttt_human
,
ttt_simulate
Examples
## Not run:
ttt(ttt_human(), ttt_random())
## End(Not run)