
import java.io.IOException;
import java.util.Random;
import java.util.Scanner;

/**
 *
 * @author umyu
 */
public class Main {

    public static void main(String[] args) throws IOException {
        GamePlay game = new GamePlay();
        Actor player = new Player();
        Actor computer = new Computer();
        while (!game.isGameOver()) {
            try {
                System.out.println("ジャンケンゲームです！あなたの手を入力してください グー：0 チョキ：1 パー：2");
                game.DisplayGameOverCondition();
                game.determineWinner(player.choice(), computer.choice());
            } catch (Exception e) {
                System.out.println("0.1.2.以外は入力しないでください");
            }
        }
        System.out.println("3回負けたので終了です");
    }
}

enum Winlose {
    Win,
    Lose,
    Draw,
}

enum Hand {
    グー,
    チョキ,
    パー;

    static Hand valueOf(int i) {
        return Hand.values()[i];
    }

    static Winlose winlose(Hand handA, Hand handB) {
        if (handA.equals(handB)) {
            // Draw
            return Winlose.Draw;
        }
        switch (handA) {
            case グー:
                if (handB == Hand.チョキ) {
                    return Winlose.Win;
                }
                break;
            case チョキ:
                if (handB == Hand.パー) {
                    return Winlose.Win;
                }
                break;
            case パー:
                if (handB == Hand.グー) {
                    return Winlose.Win;
                }
                break;
        }
        return Winlose.Lose;
    }
}

interface Actor {

    Hand choice();
}

class Player implements Actor {

    @Override
    public Hand choice() {
        Scanner scanner = new Scanner(System.in);
        int hand = scanner.nextInt();
        scanner.reset();
        return Hand.valueOf(hand);
    }
}

class Computer implements Actor {

    private final Random random = new Random();

    @Override
    public Hand choice() {
        int hand = random.nextInt(3);
        return Hand.valueOf(hand);
    }
}

class GamePlay {

    private final int MAX_LOSE_COUNT = 3;
    private int winCount = 0;
    private int loseCount = 0;
    private int drawCount = 0;

    void determineWinner(Hand playerhand, Hand computerhand) {
        System.out.println("あなたの手は" + playerhand);
        System.out.println("コンピュータは" + computerhand);
        switch (Hand.winlose(playerhand, computerhand)) {
            case Win:
                System.out.println("勝ち");
                winCount++;
                break;
            case Lose:
                System.out.println("負け");
                loseCount++;
                break;
            case Draw:
                System.out.println("引き分け");
                drawCount++;
                break;
        }
        System.out.println("勝った回数:" + winCount + "/負けた回数:" + loseCount + "/引きわけの回数:" + drawCount + "");
    }

    boolean isGameOver() {
        return loseCount >= MAX_LOSE_COUNT;
    }

    void DisplayGameOverCondition() {
        System.out.println("コンピュータに" + MAX_LOSE_COUNT + "回負けたら終了です。");
    }
}

@@ -1,33 +1,4 @@
-%0Aimport java.io.IOException;%0A
 impo
@@ -43,16 +43,57 @@
 Scanner;
+%0Aimport java.util.InputMismatchException;
 %0A%0A/**%0A *
@@ -180,27 +180,8 @@
 rgs)
- throws IOException
  %7B%0A 
@@ -453,38 +453,77 @@
     
-game.DisplayGameOverCondition(
+System.out.println(%22%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF%E3%81%AB%22 + GamePlay.MAX_LOSE_COUNT + %22%E5%9B%9E%E8%B2%A0%E3%81%91%E3%81%9F%E3%82%89%E7%B5%82%E4%BA%86%E3%81%A7%E3%81%99%E3%80%82%22
 );%0A 
@@ -616,16 +616,29 @@
  catch (
+InputMismatch
 Exceptio
@@ -640,16 +640,17 @@
 eption e
+x
 ) %7B%0A    
@@ -759,10 +759,35 @@
 tln(
+GamePlay.MAX_LOSE_COUNT + 
 %22
-3
 %E5%9B%9E%E8%B2%A0%E3%81%91%E3%81%9F
@@ -810,22 +810,20 @@
 %7D%0A%0Aenum 
-Winlos
+Judg
 e %7B%0A    
@@ -976,22 +976,18 @@
 tic 
-Winlose winlos
+Judge judg
 e(Ha
@@ -1084,22 +1084,20 @@
  return 
-Winlos
+Judg
 e.Draw;%0A
@@ -1212,38 +1212,36 @@
          return 
-Winlos
+Judg
 e.Win;%0A         
@@ -1353,38 +1353,36 @@
          return 
-Winlos
+Judg
 e.Win;%0A         
@@ -1501,22 +1501,20 @@
  return 
-Winlos
+Judg
 e.Win;%0A 
@@ -1582,14 +1582,12 @@
 urn 
-Winlos
+Judg
 e.Lo
@@ -1681,52 +1681,21 @@
     
-@Override%0A    public Hand choice() %7B%0A       
+private final
  Sca
@@ -1732,16 +1732,58 @@
 tem.in);
+%0A%0A    @Override%0A    public Hand choice() %7B
 %0A       
@@ -1810,16 +1810,17 @@
 nextInt(
+3
 );%0A     
@@ -2109,30 +2109,36 @@
 lay %7B%0A%0A    p
-rivate
+ublic static
  final int M
@@ -2442,14 +2442,12 @@
 and.
-winlos
+judg
 e(pl
@@ -3025,123 +3025,7 @@
    %7D
-%0A%0A    void DisplayGameOverCondition() %7B%0A        System.out.println(%22%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF%E3%81%AB%22 + MAX_LOSE_COUNT + %22%E5%9B%9E%E8%B2%A0%E3%81%91%E3%81%9F%E3%82%89%E7%B5%82%E4%BA%86%E3%81%A7%E3%81%99%E3%80%82%22);%0A    %7D
 %0A%7D%0A

Change Enum Name