가위바위보 게임

김창현·2023년 3월 21일
1

라인 최소로 구현
이런식으로 하면 최악의 개발자가 됨

import java.util.Scanner;
public class RockScissorPaperGame {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int random = (int)(3 * Math.random() + 1), user = sc.nextInt();
        System.out.println(((random) == user)? "컴퓨터는 " + random + ", 유저는 " + user + "로 비겼습니다." : (random-user==Math.abs(1))? "컴퓨터는 " + random + ", 유저는 " + user + (random-user == 1? "로 졌습니다." : "로 이겼습니다.") : "컴퓨터는 " + random + ", 유저는 " + user + "로 이겼습니다");
    }
}
profile
클린코드 지향

0개의 댓글