Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class testy {
- public static void main(String[] args) {
- Scanner read = new Scanner(System.in);
- System.out.println("Welcome in Paper, Rock, Scissors, Spock and Lizard");
- System.out.println("Paper = 0, Rock = 1, Scissors = 2, Spock = 3 and Lizard = 4");
- for(int i=0; i<10; i++){
- int number = 0;
- number = read.nextInt();
- Random rand = new Random();
- int random = rand.nextInt(5);
- if(number<1 || number>4){
- System.exit(0);
- }
- if(random==number){
- System.out.println("Draw");
- }else if(random==(number+1)%5 || random==(number+3)%5){
- System.out.println("You Win");
- }else{
- System.out.println("You Lose");
- }
- System.out.println(random);
- System.out.println("Paper = 0, Rock = 1, Scissors = 2, Spock = 3 and Lizard = 4 " +
- "Paper = Rock and Spock, " +
- "Rock = Scissors and Lizard, " +
- "Scissors = Paper and Lizard, " +
- "Spock = Rock and Scissors and Lizard = Spock and Paper");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement