Here is the actual question for clarification...
The function Playball simulates a 9-innings baseball game for one lineup. Your code will do the same. The function input is a 9x5 Matrix of player data probabilities. The function has 5 outputs: the number of runs scored in the 9 inning game (a scalar), the runs scored by each player (9x1 vector), the runs batted in (rbi) of each player (9x1 vector), the total hits of each player (9x1 vector), and the total outs of each player (9x1 vector). Your function should simulate a 9 inning game, with three outs per inning, using nested loops. You will use the player data probabilities and Monte Carlo simulation to simulate a given player when they come to bat (more below). If they get a hit, they advance to whatever base their hit corresponds to (a single to first base, double to second, triple to third, homerun back to home plate). If they get an out, they do not advance and the number of outs in the inning increases by 1. Any baserunners on base when a batter gets a hit advance the number of bases that the hitter gets. If the batter was to hit a double all base runners would advance 2 bases, a triple 3 bases and so on. We will assume no base running errors or advances other than that previously mentioned. The order of the hitters should carry over through innings, so if the 5th batter made the last out, then the 6th batter leads off the next inning. In this simulation you will only worry about one of the teams so once one inning is over, you can go right to the next. A 9x1 matrix will also be needed to keep track of where each player is on base. Remember that any time a player reaches over 3 bases, they have scored. An RBI is defined as the number of runs that score when a player gets a hit. So if there are runners on all bases and a double is hit, the batter