Exemplo n.º 1
0
        public void Init()
        {
            _heuristic = new YiyuanLeeHeuristic();

            _twoPieceSearch         = new TwoPieceSearch(_heuristic);
            _predictiveSearch       = new PredictiveSearch(_heuristic);
            _predictiveSearch.Cache = false;
            _recursiveSearch        = new RecursiveSearch(_heuristic);
            _recursiveSearch.Depth  = 2;

            // init lookups
            var lookups = BoardLookups.Instance;
        }
Exemplo n.º 2
0
        static TimeSpan MeasurePredictiveSearch(int number)
        {
            var gamestates = Enumerable.Range(0, number)
                             .Select(x => new Board().Random())
                             .Select(x => new GameState(x, Tetriminos.GetRandom(), Tetriminos.GetRandom()))
                             .ToList();

            var heuristic = new YiyuanLeeHeuristic();
            var search    = new PredictiveSearch(heuristic);

            var sw = new Stopwatch();

            sw.Start();

            foreach (var gamestate in gamestates)
            {
                var result = search.Search(gamestate);
            }

            sw.Stop();
            return(sw.Elapsed);
        }