Skip to content

Instantly share code, notes, and snippets.

@bufferings
Created December 30, 2014 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bufferings/60d53f7d7b4251bd27da to your computer and use it in GitHub Desktop.
Save bufferings/60d53f7d7b4251bd27da to your computer and use it in GitHub Desktop.
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