※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

public class Ssp{
private static final int STONE = 0;
private static final int SCISSORS = 1;
private static final int PAPER = 2;
public static void main(String[] args){
	int fwin = 0 , swin = 0;
	for(int i = 0 ; i < 3 ; i++){
		System.out.println(i + 1 +  "回目のジャンケン勝負だよ。");
		
		int f = (int)(Math.random() * 3);
		switch(f){
			case STONE:
				f = STONE;
				System.out.print("左はぐー VS ");
				break;
			case SCISSORS:
				f = SCISSORS;
				System.out.print("左はちょき VS ");
				break;
			case PAPER:
				f = PAPER;
				System.out.print("左はぱー VS ");
				break;
		}
		
		
		int s = (int)(Math.random() * 3);
		switch(s){
			case STONE:
				s = STONE;
				System.out.println("右はぐー");
				break;
			case SCISSORS:
				s = SCISSORS;
				System.out.println("右はちょき");
				break;
			case PAPER:
				s = PAPER;
				System.out.println("右はぱー");
				break;
		}
		
		//判定
		if(f == STONE && s == SCISSORS ||
		   f == SCISSORS && s == PAPER ||
		   f == PAPER && s == STONE){
			System.out.print( "\n" + (i + 1) + "番目は左の勝ち☆\n\n");
			fwin ++ ;
		}else if(f == s){
			System.out.println("\n" + (i + 1) + "番目は引き分けだよ。");
		} else {
			System.out.print( "\n" + (i + 1) + "番目は右の勝ち☆\n\n");
			swin ++;
		}
	}
	if(fwin > swin)
		System.out.println("\n\t通算で左の勝ちだぽ。\n");
	else if(fwin == 0 && swin == 0)
		System.out.println("\n\t通算で引き分けだっぷー\n");
	else 
		System.out.println("\n\t通算で右の勝ちだぽ。\n");
}
}