create_transmatrix: Creates a transition matrix of probabilities for each square...

Description Usage Arguments Value Examples

Description

create_transmatrix() creates the transition matrix necessary to perform the markov chain simulation in the function markov_chain(). A markov chain transition matrix contains all the probabilities for moving from any one board square to any other. The starting square is represented by the row number, and the ending square by the column number. For this simulation, however, row/column 1 represents the fictional square "0" because the game of Snakes and Ladders begins off the board rather than at square 1. Therefore, a typical 100 square Snakes and Ladders board will be represented by a 101x101 matrix.

Usage

1
create_transmatrix(input, roll)

Arguments

input

A vector with information about the gameboard. Typically, this should be a board that has already been modified with snake and ladder transitions via add_snakesandladders(). However, the user can use a standard board with no snakes or ladders if they choose.

roll

Indicates the number of sides on a fictional die. Can be any number, but typically a single, six-sided die is used in-game.

Value

a transition matrix with a number of rows and columns corresponding to the board length. Contains the probabilities for moving from any one square to another.

Examples

1
create_transmatrix(input = add_snakesandladders(snakematrix = default_ladders_and_snakes, board = default_input_board), roll = 6)

iawindham/snakesandladders documentation built on May 20, 2019, 2:08 p.m.