simple.chutes | R Documentation |
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.
simple.chutes(sim=FALSE, return.cl=FALSE, cl=make.cl())
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 |
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)
returns a trajectory as a vector, or a matrix if asked to return the transition matrix
John Verzani
board was from http://www.ahs.uwaterloo.ca/~musuem/vexhibit/Whitehill/snakes/snakes.gif
plot(simple.chutes(sim=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.