Question
this is an example of how it should look like if it helps, this is the code used for the game itself. biggest modification it
this is an example of how it should look like
if it helps, this is the code used for the game itself. biggest modification it needs to meet the new requirements is now it needs multiple players, it needs to be able to run either automatically by the computer or manually by player, and lastly it needs to be able to store the scores of each players to show the winner at the end.
---------------------------------------------------------------------------------------------------
clc clear
numstrip=[1:1:12]; fprintf('Numberstrip:') fprintf('%5.0f',numstrip) crossed=zeros(1,12); %crossed numstrip
x=randi(6); %first dice y=randi(6); %second dice sumdice=x+y; fprintf(' Dice %i %i sum is %i ',x,y,sumdice)
user=input('enter numbers to cross out in the hard brackets:');
usersum=sum(user);
while sumdice==usersum & user>crossed(user)
if sumdice==usersum
numstrip(user)=0; fprintf('Numberstrip:') fprintf('%5.0f',numstrip) crossed(user)=user; fprintf(' ') fprintf('crossed: ') fprintf('%5.0f',crossed)
if crossed(7)==0 && crossed(8)==0 && crossed(9)==0 && crossed(10)==0 && crossed(11)==0 && crossed(12)==0 clearvars sumdice clearvars usersum clearvars user x=randi(6); %first dice sumdice=x; fprintf(' Dice %i ',x) user=input('enter numbers to cross out in the hard brackets:'); usersum=sum(user);
else clearvars sumdice clearvars usersum clearvars user x=randi(6); %first dice y=randi(6); %second dice sumdice=x+y; fprintf(' Dice %i %i sum is %i ',x,y,sumdice)
user=input('enter numbers to cross out in the hard brackets:'); usersum=sum(user); end
end
if sumdice~=usersum fprintf('error sum of user input does not equal sum of dice') end end
sum=numstrip(1)+numstrip(2)+numstrip(3)+numstrip(4)+numstrip(5)+numstrip(6)+numstrip(7)+numstrip(8)+numstrip(9)+numstrip(10)+numstrip(11)+numstrip(12);
fprintf(' user score: %i ',sum)
Write a MATLAB program to simulate the Shut the Box Party Game that can Play Shut the Box for single or multiple players automatically and intelligently Ask the game host to input how many players will choose the numbers to cross out for themselves Ask the game host to input how many players will let the computer select numbers to cross out for them automatically Use two (2) 6-sided dice to play Shut the Box game for each player sequentially 1. 2. 3. 4. 5. For each player: a. Print the player ID number clearly in the command window (i.e. Player 1, Player 2, etc..) Print a number strip from 1 through 12 in the command window Generate two (2) random integers between 1 and 6 to represent the face value of rolling two dice Print the two (2) dice values on screen after each roll Sum the dice value and print the sum on screen For the players that want to interact with the game, ask the player to decide and input the number(s) to cross out. The player can decide to cross out multiple numbers by inputting multiple numbers in hard brackets, for example[1 2 9] For the players that want the computer to automatically play the game for them, the program should automatically decide the best numbers to cross out and print the number(s) to cross out clearly on screen. The program must be able to make the best decisions for everyone without bias. The automatic decisions should be correct Print all the number(s) had been crossed out on screen after crossing out some number(s) Print the current open numbers on screen before the next roll The game should keep rolling dice, printing the dice, summing the dice, printing the sum, crossing out numbers, printing all the crossed numbers, and printing all the open numbers on screen, until there is no number(s) to cross out to create a sum as same as the sum of the dice For the players that select their own number(s) to cross out, if the player cannot cross out any number, the player simply presses the Enter key without providing any number. When the player presses the Enter key without any number, the player's turn should end. The program should b. c. d. e. f. g. h. i. j. k. Write a MATLAB program to simulate the Shut the Box Party Game that can Play Shut the Box for single or multiple players automatically and intelligently Ask the game host to input how many players will choose the numbers to cross out for themselves Ask the game host to input how many players will let the computer select numbers to cross out for them automatically Use two (2) 6-sided dice to play Shut the Box game for each player sequentially 1. 2. 3. 4. 5. For each player: a. Print the player ID number clearly in the command window (i.e. Player 1, Player 2, etc..) Print a number strip from 1 through 12 in the command window Generate two (2) random integers between 1 and 6 to represent the face value of rolling two dice Print the two (2) dice values on screen after each roll Sum the dice value and print the sum on screen For the players that want to interact with the game, ask the player to decide and input the number(s) to cross out. The player can decide to cross out multiple numbers by inputting multiple numbers in hard brackets, for example[1 2 9] For the players that want the computer to automatically play the game for them, the program should automatically decide the best numbers to cross out and print the number(s) to cross out clearly on screen. The program must be able to make the best decisions for everyone without bias. The automatic decisions should be correct Print all the number(s) had been crossed out on screen after crossing out some number(s) Print the current open numbers on screen before the next roll The game should keep rolling dice, printing the dice, summing the dice, printing the sum, crossing out numbers, printing all the crossed numbers, and printing all the open numbers on screen, until there is no number(s) to cross out to create a sum as same as the sum of the dice For the players that select their own number(s) to cross out, if the player cannot cross out any number, the player simply presses the Enter key without providing any number. When the player presses the Enter key without any number, the player's turn should end. The program should b. c. d. e. f. g. h. i. j. kStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started