simple.chutes {UsingR} | R Documentation |
simulate a chutes and ladder game
Description
This function will simulate a chutes and ladder game. It returns a trajectory for a single player. Optionally it can return the transition matrix which can be used to speed up the simulation.
Usage
simple.chutes(sim=FALSE, return.cl=FALSE, cl=make.cl())
Arguments
sim |
Set to TRUE to return a trajectory. |
return.cl |
Set to TRUE to return a transistion matrix |
cl |
set to the chutes and ladders transition matrix |
Details
To make a chutes and ladders trajectory
simple.chutes(sim=TRUE)
To return the game board
simple.chutes(return.cl=TRUE)
when doing a lot of simulations, it may be best to pass in the game board
cl <- simple.chutes(return.cl=TRUE) simple.chutes(sim=TRUE,cl)
Value
returns a trajectory as a vector, or a matrix if asked to return the transition matrix
Author(s)
John Verzani
References
board was from http://www.ahs.uwaterloo.ca/~musuem/vexhibit/Whitehill/snakes/snakes.gif
Examples
plot(simple.chutes(sim=TRUE))