Computers and Technology

For this lab you will write a Java program that will run a Dragon Trainers. The rules of the game are simple: each player has three dragons that they have trained, and each dragon is tied to a particular element. Each player has a Fire Dragon, a Water Dragon and a Plant Dragon. Each player picks one dragon to put out in front of them to fight the other player's dragon. Both players choose separately without knowing what the other player has selected. Fire Dragons always beat Plant Dragons, Plant Dragons always beat Water Dragons, and Water Dragons always beat Fire Dragons. If both players choose the same kind of dragon, they tie. Your program will run a series of games of one player against the computer. First the player will be prompted for a random seed and then a number of matches to play. For each match, the computer will pick a random dragon type and the player will enter their choice as a single letter- F for fire, W for water, or 'P' for plant (the program should accept either uppercase or lowercase, and should only care about the first letter of the user's input). The program should then report both choices as well as who the winner is. This process repeats until all of the matches have been played- at that point the program will reporta summary of the matches and decide who won the tournament overall. See the transcripts below for how your output should be formatted.
NOTE if the player enters an invalid choice, the computer wins by default.
NOTE To generate a random choice, you must use the Random object as we have used in the previous labs. You can use it to generate a number between 0 and 2 and assiign each value to a type of dragon A value of 0 will be Fire, 1 will be Plant and 2 will be Water. Note that you MUST use these assignments of numbers to types for your submission to be able to pass the test cases!
NOTE You MUST only declare and instantiate one single Random object to be able to match the test cases And this must be done outside of your main game loop. Note that this is typically how Random objects are used-you create them once and then use the same Random object for your entire program, rather than creating new ones every time you need a new random number.
Here is one example of the game in action. Note that as always, user inputs are in BOLD.
Enter a random seed: 24
How many matches will we play? 3
Please select one of your dragons [Fire/Plant/Water]: Plant
You chose: Plant dragon.
I chose: Plant dragon.
A Tie!
Please select one of your dragons [Fire/Plant/Water]: FIRE
You chose: Fire dragon.
I chose: Plant dragon.
Fire defeats Plant -you win!
Please select one of your dragons [Fire/Plant/Water]: w
You chose: Water dragon.
I chose: Fire dragon.
Water defeats Fire you win!
The tournamont is over!
We tied 1 matches.
I won 0 matches.
You won 2 matches.
You are the winner!
Here is another example of the game in action. Note that if the user enters an invalid response, the computer wins by default. But also note that only the first character of the input matters when determining whether or not the input is valid
Enter a random seed: 33
How many matches will we play? 4
Please select one of your dragona (Fire/Plant/Water]:
You chose: Fire dragon.
I chose: Fire dragon.
A Tie!
Please select one of your dragons [Fire/Plant/Water): pfjlsd
You chose: Plant dragon.
I chose: Fire dragon.
Fire defeats Plant-you lose!
Please select one of your dragons [Fire/Plant/Water]: jkfld
You don't have a jkfld dragon, so you choose no dragons.
I chose: Water dragon.
I win by default!
Please nelect one of your dragons [Fire/Plant/Water]: plnat
You chose: Plant dragon.
I chose: Water dragon.
Plant defeats Water -you win!
Please select one of your dragons [Fire/Plant/Water] plnat
You chose: Plant dragon.
I chose: Water dragon.
Plant defeats Water- you win!
The tournament is over!
We tied 1 matches.
I Won 2 matches.
You won 1 matoches.
I am the winner!
If there is a tie, the final message should indicate that neither player is the winner as in the transcript below
Enter a random seed: 33
How many matches will we play? 1
Please select one of your dragons [Fire/Plant/Water]: Fire
You chose: Fire dragon. Fire dragon.
I chose:
A Tie!
The tournament is over!
We tied 1 matches.
I won 0 matches.
You won 0 matches.
Neither of us can claim victory here!

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:30, Tcareyoliver
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
image
Computers and Technology, 23.06.2019 00:20, kathlynskare06
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, jason9394
Facial expressions and gestures are examples of messages.
Answers: 3
image
Computers and Technology, 23.06.2019 21:00, shawnnoteman1234
Which task uses a simple parameter?
Answers: 1
Do you know the correct answer?
For this lab you will write a Java program that will run a Dragon Trainers. The rules of the game ar...

Questions in other subjects:

Konu
Mathematics, 02.07.2019 19:00
Konu
Mathematics, 02.07.2019 19:00
Konu
Mathematics, 02.07.2019 19:00