public Player(Game game, string name, HonorType seatWind)
 {
     Name     = name;
     Game     = game;
     Hand     = new HKOSHand();
     SeatWind = seatWind;
     Points   = 0;
     TilesSeenSinceLastTurn = new HashSet <Tile>();
     TileGrouper            = new SequenceTripletQuadTileGrouper(new SuitedHonorBonusTileSorter());
     WaitingDistanceFinder  = new RegularHandSevenPairsThirteenOrphansWaitingDistanceFinder();
 }
        public void GetHandString()
        {
            FillDict();
            var tiles = new List <Tile>();
            var digitsGroupBeforeLetterRegex = new Regex(@"(\d+)([a-zA-z])");

            //var hand = new List<Tile>
            //{
            //    TileInstance.TwoOfDots,
            //    TileInstance.TwoOfDots,
            //    TileInstance.FourOfDots,
            //    TileInstance.FourOfDots,
            //    TileInstance.FourOfDots,
            //    TileInstance.EightOfDots,
            //    TileInstance.ThreeOfBamboo,
            //    TileInstance.SevenOfBamboo,
            //    TileInstance.OneOfCharacters,
            //    TileInstance.TwoOfCharacters,
            //    TileInstance.TwoOfCharacters,
            //    TileInstance.FourOfCharacters,
            //    TileInstance.SevenOfCharacters,
            //    TileInstance.EightOfCharacters
            //};

            //foreach (var tile in TileInstance.AllMainTileInstances)
            //{
            //    tile.WriteShortColoredString();
            //}
            //Console.WriteLine("TEST");

            var aaaaa = new HKOSHand()
            {
                UncalledTiles = new List <Tile>
                {
                    TileInstance.FourOfDots,
                    TileInstance.FiveOfDots,
                    TileInstance.SixOfDots,
                    TileInstance.ThreeOfBamboo,
                    TileInstance.ThreeOfBamboo,
                    TileInstance.ThreeOfBamboo,
                    TileInstance.FiveOfBamboo,
                    TileInstance.FiveOfBamboo,
                    TileInstance.FiveOfBamboo,
                    TileInstance.OneOfCharacters,
                    TileInstance.TwoOfCharacters,
                    TileInstance.ThreeOfCharacters,
                    TileInstance.WhiteDragon,
                    TileInstance.WhiteDragon
                }
            };
            int b = aaaaa.FindScoreOfMostValuableHand();

            Console.WriteLine(b);

            foreach (var tile in TileInstance.AllBonusTileInstances)
            {
                tile.WriteShortColoredString();
            }
            Console.WriteLine();

            var shantenFinder = new RegularHandSevenPairsThirteenOrphansWaitingDistanceFinder();
            var ukeireFinder  = new HKOSEfficientDrawsFinder();

            var g = new Game();

            g.PlayGame();
            //foreach (var p in g.Players)
            //{
            //    p.Hand.SortHand();
            //}
            //g.CurrentDeal.WriteGameState();
            Console.WriteLine(">>>");
            Console.ReadKey();


            while (true)
            {
                var handString = Console.ReadLine();
                tiles.Clear();
                foreach (Match match in digitsGroupBeforeLetterRegex.Matches(handString))
                {
                    var  digitString = match.Groups[1].Captures[0].ToString();
                    char letterChar  = match.Groups[2].Captures[0].ToString().ToCharArray()[0];
                    //Console.WriteLine(match.Groups[1].Captures[0]);
                    //Console.WriteLine(match.Groups[2].Captures[0]);
                    foreach (var digit in digitString)
                    {
                        int index = (int)char.GetNumericValue(digit);
                        try
                        {
                            tiles.Add(mappingDict[letterChar].ElementAt(index - 1));
                        }
                        catch (KeyNotFoundException)
                        {
                            continue;
                        }
                    }
                }
                //var a = shantenFinder.GetWaitingDistance(tiles);
                //var b = ukeireFinder.GetEfficientDrawCount(tiles);
                //Console.WriteLine(a);
                //Console.WriteLine(b);
                //Console.WriteLine();
            }
        }
 public EfficientAI(Game game, string name, HonorType seatWind) : base(game, name, seatWind)
 {
     EfficientDrawsFinder  = new AppliedHKOSEfficientDrawsFinder();
     WaitingDistanceFinder = new RegularHandSevenPairsThirteenOrphansWaitingDistanceFinder();
     SeenTiles             = new List <Tile>();
 }
Exemple #4
0
 public HKOSEfficientDrawsFinder(IEnumerable <Tile> allDistinctTiles)
 {
     WaitingDistanceFinder = new RegularHandSevenPairsThirteenOrphansWaitingDistanceFinder();
     AllDistinctTiles      = new List <Tile>(allDistinctTiles);
 }