Learn R Programming

Tic-Tac-Toe Library for R

I wrote this as an excercise in creating a R package. Hopefully somebody will find it useful.

Install the CRAN package in R like this:

install.packages("st3")
library("st3")

Install the Swirl tutorial in R like this:

swirl.install("st3")
swirl()

Copy Link

Version

Install

install.packages('rt3')

Monthly Downloads

115

Version

0.1.2

License

MIT + file LICENSE

Maintainer

Johan Jordaan

Last Published

December 5th, 2016

Functions in rt3 (0.1.2)

randomMovePlayer

Player that picks a random move
rt3

rt3: A Package for Playing Tic-Tac-Toe in R.
gameState

The game state is represented by a list of 8 values.
getMoves

Get the list of valid move from the game state.
makeMove

Apply the move to the current game state an produce a new game state.
NONE

Constant for no winner. It's value is the character "_".
O

Constant for the O player.
playGame

Play a game of Tic-Tac-Toe using the two provided stragies.
startGame

Start a new game
X

Constant for the X player.
firstAvailableMovePlayer

Player that always takes the first move in the list of valid moves.
EMPTY

Constant for the empty square. It's value is the character "_".