You are on page 1of 9

NAME : SMIT PATEL

ROLL NO. : 19DCS103

1. Create a Wrestling game.


CODE:
import java.util.Scanner;

class game {

private static boolean fight = false;

private static int enemyHealth = 100;

private static int playerHealth = 100;

private static double enemyChoice = Math.ceil(Math.random() * 5);

private static String pName;

private static double pHeight;

private static double pWeight;

public static void Healthcheck()

if(enemyHealth <= 0)

System.out.println("That's right\nK.O. "+pName+" wins!");

fight = false;

CE251 19DCS148

else if(playerHealth <= 0)


{

System.out.println(pName+"Never enter a fight you can't win\nK.O.

Deadpool wins!");

fight = false;

public static void main(String[] args)

Scanner user_input = new Scanner(System.in);

String Play;

System.out.print("Let's take this outside: ");

Play = user_input.next();

if(Play.equals("Yes") || Play.equals("yes") || Play.equals("alright") ||

Play.equals("Alright") || Play.equals("What did you just say to me, huh ?"))

CE251 19DCS148

System.out.print("Hey I don't know your name, so why don't you spit it out:

");

pName = user_input.next();

System.out.print("You look too skinny\nHey my weight is: ");

pWeight = user_input.nextFloat();

System.out.print("You are too small to be an American\nReally! my height

is: ");

pHeight = user_input.nextFloat();

System.out.println("Hey guys!, we are going to have an exiting match

today!");

System.out.println("On your left, we have weighing 110 pounds, 6 feet

long Deadpool !\nOn your right, we have weighing "+pWeight+" pounds,


"+pHeight+" feet long "+ pName+ "!");

fight = true;

while(fight == true)

System.out.println("Deadpool has "+enemyHealth+" health remaining.");

System.out.println("I have "+playerHealth+" health remaining.");

String action;

System.out.println("What should I do? \n(a)Upper cut \n(b)Left side punch

\n(c)Right side punch \n(d)Slam \n(e)Down cut: ");

action = user_input.next();

CE251 19DCS148

enemyChoice = Math.ceil(Math.random() * 5);

Healthcheck();

if(action.equals("a") && enemyChoice == 2)

Healthcheck();

System.out.println("Woah! and "+pName+" throws a devistating blow to

Deadpool!");

enemyHealth-=10;

Healthcheck();

else if (action.equals("a") && enemyChoice == 3)

Healthcheck();

System.out.println("Woah! and "+pName+" throws a devistating blow to

Deadpool!");

enemyHealth -=10;
Healthcheck();

else if (action.equals("a") && enemyChoice == 4)

Healthcheck();

CE251 19DCS148

System.out.println("Deadpool saw it coming and dodged the incoming

attack");

else if (action.equals("a") && enemyChoice == 5)

Healthcheck();

System.out.println(pName+" took a huge hit there!");

playerHealth-=20;

Healthcheck();

else if(action.equals("b") && enemyChoice == 1)

Healthcheck();

System.out.println("Deadpool counter-attacks");

playerHealth-=5;

Healthcheck();

else if (action.equals("b") && enemyChoice == 3)

Healthcheck();

System.out.println("Deadpool counter-attacks with a right side punch");

playerHealth -=5;
CE251 19DCS148

Healthcheck();

else if (action.equals("b") && enemyChoice == 4)

Healthcheck();

System.out.println("What are those reflexes "+pName+" saw it from a

mile away!");

Healthcheck();

else if (action.equals("b") && enemyChoice == 5)

Healthcheck();

System.out.println("Deadpool took a huge hit there!");

enemyHealth-=10;

Healthcheck();

else if(action.equals("c") && enemyChoice == 1)

Healthcheck();

System.out.println("Deadpool counter-attacks with a cut");

playerHealth-=5;

Healthcheck();

CE251 19DCS148

else if (action.equals("c") && enemyChoice == 2)

{
Healthcheck();

System.out.println("Deadpool counter-attacks with a left side punch");

playerHealth -=5;

Healthcheck();

else if (action.equals("c") && enemyChoice == 4)

Healthcheck();

System.out.println("What are those reflexes "+pName+" saw it from a

mile away!");

Healthcheck();

else if (action.equals("c") && enemyChoice == 5)

Healthcheck();

System.out.println("Deadpool took a huge hit there!");

enemyHealth-=10;

Healthcheck();

else if(action.equals("d") && enemyChoice == 1)

CE251 19DCS148

Healthcheck();

System.out.println("Deadpool took a huge hit there!");

enemyHealth-=20;

Healthcheck();

else if (action.equals("d") && enemyChoice == 2)


{

Healthcheck();

System.out.println(pName+" that turned out spectacular!");

enemyHealth -=30;

Healthcheck();

else if (action.equals("d") && enemyChoice == 3)

Healthcheck();

System.out.println("Deadpool saw it from a mile away!");

Healthcheck();

else if (action.equals("d") && enemyChoice == 5)

Healthcheck();

CE251 19DCS148

System.out.println("Nobody could survive this!");

playerHealth-=20;

Healthcheck();

else if(action.equals("e") && enemyChoice == 1)

Healthcheck();

System.out.println(pName+" sees the incoming punch and hits Deadpool

with a big down cut");

enemyHealth-=20;

Healthcheck();

}
else if (action.equals("e") && enemyChoice == 2)

Healthcheck();

System.out.println("Deadpool attacks with a side punch");

playerHealth -=10;

Healthcheck();

else if (action.equals("e") && enemyChoice == 3)

Healthcheck();

CE251 19DCS148

10

System.out.println("Deadpool attacks with a side punch");

playerHealth -=10;

Healthcheck();

else if (action.equals("e") && enemyChoice == 4)

Healthcheck();

System.out.println("Deadpool took a huge hit there!");

enemyHealth-=10;

Healthcheck();

else if(action.equals("a") && enemyChoice == 1)

System.out.println("Their fists collided! this is intense!");

else if(action.equals("b") && enemyChoice == 2)

{
System.out.println("Their fists collided! this is intense!");

else if (action.equals("c") && enemyChoice == 3)

System.out.println("Their fists collided! this is intense!");

CE251 19DCS148

11

else if(action.equals("d") && enemyChoice == 4)

System.out.println("Their fists collided! this is intense!");

else if (action.equals("e") && enemyChoice == 5)

System.out.println("Their fists collided! this is intense!");

You might also like