Exemple #1
0
        private void CheckShanten(Result R)
        {
            if ((ShantenMin != -1) || (ShantenMax != -1))
            {
                for (int i = 0; i < R.Replay.Rounds.Count; i++)
                {
                    Mahjong.Round Rnd = R.Replay.Rounds[i];

                    for (int j = 0; j < R.Replay.PlayerCount; j++)
                    {
                        if (Rnd.Shanten[j].Count > 0)
                        {
                            if (ShantenMin != -1) if (Rnd.Shanten[j][0] < ShantenMin) R.HandMark[i][j] = false;
                            if (ShantenMax != -1) if (Rnd.Shanten[j][0] > ShantenMax) R.HandMark[i][j] = false;
                        }
                        else
                        {
                            R.HandMark[i][j] = false;
                        }
                    }
                }
            }

            if (Tempai != -1)
            {
                bool IsTempai = (Tempai != 0);

                for (int i = 0; i < R.Replay.Rounds.Count; i++)
                {
                    Mahjong.Round Rnd = R.Replay.Rounds[i];

                    for (int j = 0; j < R.Replay.PlayerCount; j++)
                    {
                        if (IsTempai != Rnd.Shanten[j].Contains(0)) R.HandMark[i][j] = false;
                    }
                }
            }

            if (KaratenNoten != -1)
            {
                bool IsKaraten = (KaratenNoten != 0);

                for (int i = 0; i < R.Replay.Rounds.Count; i++)
                {
                    Mahjong.Round Rnd = R.Replay.Rounds[i];

                    // Restore hands
                    Rnd.ReplayGame();

                    for (int j = 0; j < R.Replay.PlayerCount; j++)
                    {
                        bool Karaten = false;
                        for (int k = 0; k < Rnd.Hands[j].Count; k++)
                        {
                            Mahjong.Hand H = Rnd.Hands[j][k];
                            
                            bool K = new Mahjong.ShantenCalculator(H).KaratenNotenHand;
                            if (K) Karaten = true;
                        }

                        if (IsKaraten != Karaten) R.HandMark[i][j] = false;
                    }
                }
            }
        }
Exemple #2
0
        // filters
        private bool CheckChiitoiHand(Mahjong.Hand H)
        {
            if(H.Shanten != 0) return false;
            Mahjong.ShantenCalculator Sh = new Mahjong.ShantenCalculator(H);

            Sh.GetShanten();

            return (Sh.ShantenChiitoi == 0);
        }