rt3 {rt3}R Documentation

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

Description

The rt3 package provides functions to allow a user to simulate tic-tac-toe games. It provides a convenient gameState object as well as simple interface for developing new types of players.

Main Function

playGame Play a game of tic-tac-toe.

Structures

gameState A tic-tac-toe game state.

Constants

X The X player.

O The O player.

EMPTY The EMPTY constant. Used to indicate an empty board position.

NONE The NONE constant. Used to indicate a draw.

Support Functions

These functions are used by the playGame function.The will also be usefull in building game decsion trees for more complex players.

startGame Create a new tic-tac-toe game state.

getMoves Get the current set of valid moves for a given game state

makeMove Apply a move to the given game state and return the resulting game state

Built-In Player Functions

randomMovePlayer A player that plays random valid moves

firstAvailableMovePlayer A player that always plays the first move available

References

https://en.wikipedia.org/wiki/Tic-tac-toe


[Package rt3 version 0.1.2 Index]