Question: Java code all written in the main method Due to the various game - variables and match - variables, all the code should be contained

Java code all written in the main method
Due to the various game-variables and match-variables, all the code should be contained only within the main() method. Other methods may be introduced to 'compartmentalize' code to facilitate readability and avoid repeating code unnecessarily; do not repeat code. However, since many game/match variables need to change almost simulataneously and methods return only one variable, program development will be facilitated if all code is contained within the main() method.
Example #1: 1 run with 1 winner:
Welcome to the 'Shut the Box' Game.
Begin playing game #1.
Enter a seed:
-44
The available number(s) are: 123456789
The dice roll is 6 and 5 for a sum of 11.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
38
The available number(s) are: 1245679
The dice roll is 6 and 3 for a sum of 9.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
9
The available number(s) are: 124567
The dice roll is 3 and 5 for a sum of 8.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
17
The available number(s) are: 2456
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
2
The dice roll is 1 and 3 for a sum of 4.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
4
The available number(s) are: 256
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
1
The die roll is 2.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
2
The available number(s) are: 56
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
2
The dice roll is 4 and 2 for a sum of 6.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
6
The available number(s) are: 5
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
1
The die roll is 5.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
5
Congratulations, you won!
Do you wish to play again? Enter Yes to play again or anything else to quit.
No
Thank you for playing "Close the Box"! The total score is 0 with 1 win(s) after 1 round(s).

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!