Created
December 30, 2014 01:16
-
-
Save bufferings/60d53f7d7b4251bd27da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package janken; | |
public class じゃんけん { | |
public enum 結果 { | |
あいこ, 負け, 勝ち | |
} | |
public enum 手 { | |
グー, チョキ, パー; | |
public 結果 対(手 相手の手) { | |
return 結果.values()[(ordinal() - 相手の手.ordinal() + 3) % 3]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment