Ejemplo n.º 1
0
        /// <summary>
        /// Disposes all the view graphical objects
        /// </summary>
        public void Dispose()
        {
            Debug.WriteLine("Dispose();");
            for (int p = 0; p < 4; p++)
            {
                Debug.WriteLine("Player {0}", p);
                if (players[p] is ComputerPlayer)
                {
                    ComputerPlayer cpu = (ComputerPlayer)players[p];
                    cpu.StopThink();
                }
            }

            die1Entity.Dispose();
            die2Entity.Dispose();
        }
Ejemplo n.º 2
0
        static void TestThreading()
        {
            Board board = new Board();

            board.Set("g5", Board.YELLOW);

            BoardView      model = new BoardView(board, 700);
            ComputerPlayer plyr  = new ComputerPlayer(Board.YELLOW, Personality.Passive, new Difficulty(10000, 0.0), model);

            plyr.StartThink(board, new DiceRoll(5, 6));

            while (plyr.IsThinking)
            {
                Console.WriteLine("Thinking...");
                Thread.Sleep(150);
            }

            //Dont need to dispose boardView, Load has not been called
            Console.WriteLine("Done, best move is: {0}", plyr.GetMove().GetNotation());
            Console.ReadKey();
        }