Thanks for reply,
here is what I want to do
We have board is going to be 10x10, which means we have 100 tiles in total. The game starts at tile 0 and ends at tile 99. We are going to use a Markov Chain to study the game, and so we need a 100x100 stochastic matrix. We start by creating the matrix for the Markov chain graph of an empty board:
size = 100
first = 0
last = 99
board = np.zeros((size, size), dtype = float)
board[last, last] = 1.0
for i in range(0,size):
for j in range(0,min(6, last-i)):
board[i+j+1,i] = 1.0
colsum = np.dot(allone, board)
allone = np.ones((1,size))
for i in range(size):
board[:,i] /= colsum[i]
def addShortCut(board, i, j):
board[j, :] += board[i, :]
board[i, :] = np.zeros(size, dtype = float)
Add 5 snakes and 5 ladders to the game using “addShortCut”
I need python code which answers the following questions:
For one player playing the game:
What is the minimal number of rolls needed to finish the game
What is the average number of rolls needed to finish the game.
What percentage of games are finished after 30 rolls.
What percentage of games are finished after 50 rolls.
How many rolls are needed for 90% of games to be finished.