Пример #1
0
        public Tuple <uint, uint> MakeMove(Board board)
        {
            if (board.Empty())
            {
                return(new Tuple <uint, uint>(board.Size / 2, board.Size / 2));
            }
            InitBoard(board);
            var begin = DateTime.Now;
            var t     = new Thread(new ThreadStart(this.DecideMove));

            t.Start();
            while ((DateTime.Now - begin).TotalMilliseconds < 4700 && !Finished)
            {
                Thread.Sleep(100);
            }
            if (!Finished)
            {
                t.Abort();
            }
            var res = new Tuple <uint, uint>(best.Item1 + Offset, best.Item2 + Offset);

            Map           = null;
            Offset        = 0;
            Finished      = false;
            best          = null;
            PossibleMoves = null;
            return(res);
        }