ttt: Play Tic-Tac-Toe Game

Description Usage Arguments Details See Also Examples

View source: R/ttt.R

Description

Start tic-tac-toe game on the console.

Usage

1
ttt(player1 = ttt_human(), player2 = ttt_human(), sleep = 0.5)

Arguments

player1, player2

objects that inherit ttt_player class

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

1
2
3
4
## Not run: 
ttt(ttt_human(), ttt_random())

## End(Not run)

kota7/tictactoe documentation built on May 20, 2019, 1:11 p.m.