/** * 両面待ちだったかを判定するため * 一つ一つの順子と最後の牌について判定する * * @param shuntsu 判定したい順子 * @param last 最後の牌 * @return 両面待ちだったか */ private bool isRyanmen(Shuntsu shuntsu, Tile last) { //ラスト牌と判定したい順子のtypeが違う場合はfalse if (shuntsu.getTile().getType() != last.getType()) { return(false); } int shuntsuNum = shuntsu.getTile().getNumber(); int lastNum = last.getNumber(); if (shuntsuNum == 2 && lastNum == 1) { return(true); } if (shuntsuNum == 8 && lastNum == 9) { return(true); } int i = shuntsuNum - lastNum; if (i == 1 || i == -1) { return(true); } return(false); }
public override bool isMatch() { if (shuntsuCount < 3) { return(false); } Shuntsu candidate = null; foreach (Shuntsu shuntsu in shuntsuList) { TileType shuntsuType = shuntsu.getTile().getType(); int shuntsuNum = shuntsu.getTile().getNumber(); if (candidate == null) { candidate = shuntsu; continue; } if (candidate.getTile().getNumber() == shuntsuNum) { detectType(shuntsuType); detectType(candidate.getTile().getType()); } else { candidate = shuntsu; } } return(manzu && pinzu && sohzu); }