Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Random Project By: Harry
- * For: ICS3U1 - Assignment 10, Ms.Strelkovska
- * Description: Make a rock, paper, scissor, lizard, spock game.
- * Personal Goal: Use as little logical lines as possible!
- * Date: Oct. 1, 2016
- *
- */
- public class Assignment10_Ex1_Min {
- public static void main(String[] args) {
- System.out.println("Enter your throw (0=Rock, 1=Paper, 2=Scissor, 3=Lizard, 4=Spock): ");
- int m = new java.util.Scanner(System.in).nextInt(), c = (int) (Math.random() * 5);
- System.out.println("Player thows " + new String[]{"Rock","Paper","Scissor","Lizard","Spock"}[m] + "\nComputer thows " + new String[]{"Rock","Paper","Scissor","Lizard","Spock"}[c] + "\n" + (m == c ? "You Tie!" : (((~(new int[]{12,17,10,18,5}[m] | new int[]{12,17,10,18,5}[m]) & ((1 << 5) - 1)) & new int[]{1,2,4,8,16}[m]) == new int[]{1,2,4,8,16}[m] ? true : false) ? "You Win!" : "Computer Wins!"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement