public class mainClass {
public static void main(String[] args) {
/* 가위, 바위, 보
* user: com
* ? wind ? lose ? draw
*
* replay -> (y/n)
*/
//선언
Scanner scanner = new Scanner(System.in);
Random rand = new Random();
int scissors = 1;
int rock = 2;
int paper = 3;
int winCount = 0;
int drawCount = 0;
int loseCount = 0;
String answer;
///반복
while(true) {
System.out.println("이긴 횟수: " + winCount);
System.out.println("진 횟수: " + loseCount);
//랜덤 생성
int randomChoice = rand.nextInt(3) + 1;
System.out.println("무엇을 낼지 숫자로 입력하세요");
System.out.println("1. 가위 2. 바위 3. 보");
int choice = scanner.nextInt();
if (choice - randomChoice == 0) {
System.out.println("비겼습니다");
continue; // 재시작 해버리기
} else if (choice - randomChoice == -1) {
System.out.println("졌습니다");
loseCount++;
} else {
System.out.println("이겼습니다");
winCount++;
}
System.out.println("다시 하시겠습니까? y/n");
answer = scanner.next();
if(answer.equals("y")) {
System.out.println("게임 재시작!");
continue;
} else {
System.out.println("게임이 종료됩니다");
break;
}
}
}
}