예제 #1
0
        public bool isMatch()
        {
            if (janto == null)
            {
                return(false);
            }
            if (janto.getTile().getNumber() == 0)
            {
                return(false);
            }
            TileType type = janto.getTile().getType();

            int[] churen = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            churen[janto.getTile().getNumber() - 1] = 2;

            foreach (Shuntsu shuntsu in shuntsuList)
            {
                if (shuntsu.getTile().getType() != type)
                {
                    return(false);
                }
                churen[shuntsu.getTile().getNumber() - 2]++;
                churen[shuntsu.getTile().getNumber() - 1]++;
                churen[shuntsu.getTile().getNumber()]++;
            }

            foreach (Kotsu kotsu in kotsuList)
            {
                if (kotsu.getTile().getType() != type)
                {
                    return(false);
                }
                churen[kotsu.getTile().getNumber() - 1] += 3;
            }

            bool restOne = false;

            for (int i = 0; i < churen.Length; i++)
            {
                int num = churen[i] - churenManzu[i];
                if (num == 1 && !restOne)
                {
                    restOne = true;
                    continue;
                }

                if (num == 1)
                {
                    return(false);
                }

                if (num < 0 || num > 1)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public bool isMatch()
        {
            //七対子の場合はありえないのでfalse
            if (janto == null)
            {
                return(false);
            }

            if (janto.getTile().getType() != TileType.SANGEN)
            {
                return(false);
            }
            int count = 0;

            foreach (Kotsu kotsu in kotsuList)
            {
                if (kotsu.getTile().getType() == TileType.SANGEN)
                {
                    count++;
                }
                if (count == 2)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
        public bool isMatch()
        {
            if (janto == null)
            {
                return(false);
            }

            if (janto.getTile().getType() != tile.TileType.FONPAI)
            {
                return(false);
            }
            if (kotsuCount < 3)
            {
                return(false);
            }

            int shosushiCount = 0;

            foreach (Kotsu kotsu in kotsuList)
            {
                if (kotsu.getTile().getType() == tile.TileType.FONPAI)
                {
                    shosushiCount++;
                }
            }
            return(shosushiCount == 3);
        }
예제 #4
0
        public bool isMatch()
        {
            if (shuntsuList.Count() > 0)
            {
                return(false);
            }
            if (janto == null)
            {
                foreach (Toitsu toitsu in toitsuList)
                {
                    if (toitsu.getTile().getNumber() != 0)
                    {
                        return(false);
                    }
                }
                return(true);
            }

            if (janto.getTile().getNumber() != 0)
            {
                return(false);
            }

            foreach (Kotsu kotsu in kotsuList)
            {
                if (kotsu.getTile().getNumber() != 0)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #5
0
        /**
         * 違うものが見つかったらfalseを返す方針です
         *
         * @return 清老頭かどうか
         */
        public bool isMatch()
        {
            if (totalKotsuKantsu != 4)
            {
                return(false);
            }

            int tileNum = janto.getTile().getNumber();

            if (tileNum != 1 && tileNum != 9)
            {
                return(false);
            }

            //刻子が全て一九牌か
            foreach (Kotsu kotsu in kotsuList)
            {
                tileNum = kotsu.getTile().getNumber();
                if (tileNum != 1 && tileNum != 9)
                {
                    return(false);
                }
            }

            //ここまできたら見つかっている
            return(true);
        }