Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simple.chutes

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))

UsingR

Data Sets, Etc. for the Text "Using R for Introductory Statistics", Second Edition

v2.0-6
GPL (>= 2)
Authors
John Verzani <verzani@math.csi.cuny.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.