Esempio n. 1
0
 public void Setup()
 {
     algo            = new DecisionAlgorithm();
     testBoard       = new Board();
     upBoard         = new Board();
     leftBoard       = new Board();
     rightBoard      = new Board();
     downBoard       = new Board();
     testBoard2      = new Board();
     testBoard.Cells = new int[, ] {
         { 0, 0, 2, 4 }, { 0, 2, 4, 8 }, { 2, 2, 16, 0 }, { 0, 0, 8, 8 }
     };
     testBoard2.Cells = new int[, ] {
         { 0, 0, 2, 4 }, { 0, 0, 2, 4 }, { 0, 0, 2, 4 }, { 2, 0, 2, 4 }
     };
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            bool              continueRunning = true;
            Game2048Page      gamePage        = new Game2048Page();
            DecisionAlgorithm algo            = new DecisionAlgorithm();

            while (continueRunning)
            {
                Thread.Sleep(200);
                var board    = gamePage.GetBoard();
                var movement = algo.DecideBestMove(board, 4);
                if (movement != null)
                {
                    gamePage.MoveTo((MovementDirection)movement);
                }
                else
                {
                    continueRunning = false;
                }
            }
        }