()
| 11 | static final int SIZE = 20; |
| 12 | private static Random rand = new Random(47); |
| 13 | public static Item newItem() { |
| 14 | switch(rand.nextInt(3)) { |
| 15 | default: |
| 16 | case 0: return new Scissors(); |
| 17 | case 1: return new Paper(); |
| 18 | case 2: return new Rock(); |
| 19 | } |
| 20 | } |
| 21 | public static void match(Item a, Item b) { |
| 22 | System.out.println( |
| 23 | a + " vs. " + b + ": " + a.compete(b)); |