Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4. public class testy {
  5.     public static void main(String[] args) {
  6.         Scanner read = new Scanner(System.in);
  7.  
  8.         System.out.println("Welcome in Paper, Rock, Scissors, Spock and Lizard");
  9.         System.out.println("Paper = 0, Rock = 1, Scissors = 2, Spock = 3 and Lizard = 4");
  10.  
  11.  
  12.  
  13.         for(int i=0; i<10; i++){
  14.  
  15.             int number = 0;
  16.             number = read.nextInt();
  17.  
  18.             Random rand = new Random();
  19.             int random = rand.nextInt(5);
  20.  
  21.             if(number<1 || number>4){
  22.                 System.exit(0);
  23.             }
  24.  
  25.             if(random==number){
  26.                 System.out.println("Draw");
  27.             }else if(random==(number+1)%5 || random==(number+3)%5){
  28.                 System.out.println("You Win");
  29.             }else{
  30.                 System.out.println("You Lose");
  31.             }
  32.             System.out.println(random);
  33.             System.out.println("Paper = 0, Rock = 1, Scissors = 2, Spock = 3 and Lizard = 4 " +
  34.                     "Paper = Rock and Spock, " +
  35.                     "Rock = Scissors and Lizard, " +
  36.                     "Scissors = Paper and Lizard, " +
  37.                     "Spock = Rock and Scissors and Lizard = Spock and Paper");
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement