package 猜拳游戏;
import static 猜拳游戏.OutCome.*;
public enum RoshamBo2 implements Competitor<RoshamBo2> {
PAPER(DRAW, LOSE, WIN){
@Override
public String toString() {
return "布 ";
}
},
SCISSORS(WIN, DRAW, LOSE) {
@Override
public String toString() {
return "剪刀";
}
},
ROCK(LOSE, WIN, DRAW) {
@Override
public String toString() {
return "石头";
}
};
public abstract String toString();
private OutCome vPAPER, vSICISSOR, vROCK;
RoshamBo2(OutCome paper, OutCome scissors, OutCome rcok){
this.vPAPER = paper;
this.vSICISSOR = scissors;
this.vROCK = rcok;
}
@Override
public OutCome compete(RoshamBo2 it) {
switch (it){
default: return null;
case PAPER:return vPAPER;
case SCISSORS:return vSICISSOR;
case ROCK:return vROCK;
}
}
public static void main(String [] argv){
RoShamBo.play(RoshamBo2.class, 20);
}
}