import java.util.*; public class FightGame { public static void main(String[] args) { // declare the variables for the game: // hp1 = your hit points // hp2 = the monster's hit points // def1 and def2 = your and the monster's protection value // attack1 and attack2 = your and the monster's number of attacks per turn // damage1 and damage2 = the amount of damage you each can do on a hit i // a for loop index roll // used to temporarily store any random value // initialize all of the above values as follows: // def1=10, hp1=50, attack1=4, damage1=8 // def2=random number from 6 to 15 // hp2=random number from 30-50 // attack2=2, damage2=12 Random g=new Random(); while(hp1>0&&hp2>0) // while you are both alive { // a for loop to iterate for each of your attacks { // generate a random roll from 1-20 // if roll > def2 then you hit the monster { // generate a random roll from 1 to damage1 // subtract this amount from hp2 // output the result of the hit } // else output that you missed the monster } // if the monster is still alive, it gets to attack you // a for loop to iterate for each of its attacks { // generate a random roll from 1-20 // if roll > def1 then monster hits you { // generate a random roll from 1 to damage2 // subtract this amount from hp1 // output the result of the hit } // else output that the monster missed } } // end of 1 full turn // output your and the monster's current hit points } // output who won the game } }