AverageMovesToWin {SnakesAndLaddersAnalysis} | R Documentation |
The Average Moves to Win in a Game of Snakes and Ladders
Description
This function uses the function SnakesAndLaddersGame to estimate the average number of moves to win given any amount of players and allows you to change the number of trials used.
Usage
AverageMovesToWin(number.of.players = 2, number.of.trials = 1000)
Arguments
number.of.players |
A single numeric value that represents the number of players you wish to run the trial with |
number.of.trials |
A single numeric value that represents the number of trials you wish to run. The more trials the more accurate the estimation. |
Details
Function uses a simple for loop to run many trials of the SnakesAndLaddersGame, counts the number of moves and outputs an average.
Value
average.number.of.moves |
A numeric value which represents the average number of moves to win |
Warning
I have not put a limit on the amount of time that this function will run. This is to allow millions of trials.
Author(s)
Hector Haffenden haffendenh@cardiff.ac.uk
Examples
AverageMovesToWin(1)
AverageMovesToWin(100)
[Package SnakesAndLaddersAnalysis version 2.1.0 Index]