Example #1
0
 @Override
 protected boolean apply(List<Mentsu> list) {
   Hai jikaze = state.getJikaze();
   for (Mentsu mentsu : list) {
     if (mentsu.getClass() != Koutsu.class && mentsu.getClass() != Kantsu.class) continue;
     if (mentsu.getHai(0) != jikaze) continue;
     return true;
   }
   return false;
 }
Example #2
0
  @Override
  protected boolean apply(List<Mentsu> list) {
    if (list.size() != 5) return false;

    for (Mentsu mentsu : list) {
      if (mentsu.getClass() == Shuntsu.class) {
        // 両面待ちの検証
        for (HaiWithAttrs hwa : mentsu.getHais()) {
          if (hwa.hasAttribute(HaiAttribute.AGARI)) {
            Hai agari = hwa.getHai();

            // 両面待ち以外の場合false
            if (agari == mentsu.getHai(0) && agari.getNumber() == 7) return false;
            if (agari == mentsu.getHai(1)) return false;
            if (agari == mentsu.getHai(2) && agari.getNumber() == 3) return false;
          }
        }
      } else if (mentsu.getClass() == Toitsu.class) {
        Hai hai = mentsu.getHai(0);
        // 役牌が雀頭の場合false
        if (hai.isSangenhai()) return false;
        if (hai == state.getBakaze()) return false;
        if (hai == state.getJikaze()) return false;

        // 両面待ちの検証
        for (HaiWithAttrs hwa : mentsu.getHais()) {
          if (hwa.hasAttribute(HaiAttribute.AGARI)) return false;
        }
      } else {
        return false;
      }
    }
    return true;
  }