>>8
class JankenHand {
public:
 enum Mode { MANUAL, AUTO };
 enum Te { GU, TYOKI, PA, RANDOM };
 enum Judgement { WIN_1, WIN_2, EVEN };

 static Judgement Judge(const JankenHand& player_1, const JankenHand& player_2) {
  Te t1 = player_1.get(), t2 = player_2.get();
  if( t1==t2 ) return EVEN;
  else if( (t1 == GU && t2 == TYOKI) || (t1 == TYOKI && t2 == PA) || (t1 == PA && t2 == GU) ) return WIN_1;
  else return WIN_2;
 }
 JankenHand(Mode mode = AUTO) : mode_(mode), te_(GU) { srand((unsigned int)time(NULL)); }
 void select() {
  if( mode_ == AUTO )
   te_ = static_cast<Te>(rand() % 3);
  else {
   cout << "ジャンケン... " << endl;
   te_ = static_cast<Te>(getch() - '1');
  }
 }
 Te get() const { return te_; }
 const char* show() const {
  static char* str[] = {"グー", "チョキ", "パー"};
  return str[te_];
 }
private:
 Mode mode_;
 Te te_;
};