Exemplo n.º 1
0
        public void BestMove_4x4_Best8_ChanceOfTimeout()
        {
            var pieces = new string[]
            {
                "1001",
                "1101",
                "0101",
                "0010"
            };

            BuildGrid(pieces);


            var result = BestMoverChecker.GetBestMove();

            if (result.Result == SearchResult.TimeOut)
            {
                Assert.AreEqual(0, result.Move.Count);
                Console.WriteLine("Search Timed out");
            }
            else
            {
                Assert.AreEqual(8, result.Move.Count);
            }
        }
Exemplo n.º 2
0
        public void BestScore_3x3_JustDoubles_Score0()
        {
            var pieces = new string[]
            {
                "dd-",
                "--d",
                "---"
            };

            BuildGrid(pieces);

            Assert.AreEqual(0, scoreCalculator.CalculateScore(BestMoverChecker.GetBestMove().Move.ToArray()));
        }
Exemplo n.º 3
0
        public void Invoke()
        {
            var move = bestMoveChecker.GetBestMove(LevelManager.Instance.SelectedLevel.GetCurrentRestriction());

            if (move.Result == SearchResult.TimeOut)
            {
                ToastPanel.Instance.ShowText("Search timed out", 2f);
            }
            else if (move.Result == SearchResult.NoMoves || move.Move == null || move.Move.Count == 0)
            {
                ToastPanel.Instance.ShowText("No Reults", 2f);
            }
            else
            {
                PieceSelectionManager.Instance.PreformMove(move.Move);
            }
        }
        public void NoDiagonalRestriction_Best4()
        {
            IRestriction restriction = new DiagonalRestriction();

            var pieces = new string[]
            {
                "1--1",
                "11--",
                "-1-1",
                "--1-"
            };

            BuildGrid(pieces);

            var move = BestMoverChecker.GetBestMove(restriction).Move;

            Assert.AreEqual(4, move.Count);
            Assert.IsFalse(restriction.IsRestrictionViolated(move.ToArray()));
        }