Question: This is a math oriented c++ program. I need help writing a program that will simulate moving a rock around an M x M chess

This is a math oriented c++ program.

I need help writing a program that will simulate moving a rock around an M x M chess board at random, using only legal moves. The rook will start in the lower left corner of the board. For each move, the rook will move according to one of its available legal moves, selected uniformly at random (i.e. each legal move has the same chance of being selected). We are interested in the expected number of moves until the rook has been stationary on every square of the board at least once. After 0 moves, the rook has already been stationary on one square (the lower left).

The program should take two command line arguments: an integer M representing the size of the board and an integer N representing the number of trials to perform. Your program should report to the user the approximate expected number of moves the rook must make until it has been stationary on every square of the board.

For a 4 x 4 board, the expected number of moves to visit every square at least once is approximately 55.1 moves.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!