Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            ChessBoardModel = new ChessBoardModel();                // Initialize ChessBoardModel.

            ViewModel = new ChessViewModel(ref ChessBoardModel);    // Initialize ViewModel.

            ChessBoard = new ChessBoard(ref ViewModel);             // Initialize ChessBoard.

            ChessBoardFrame.Content = ChessBoard;                   // Set ChessBoardFrame content to the ChessBoard.

            DataContext = ViewModel;                                // Set the DataContext to the ViewModel.
        }
Exemplo n.º 2
0
        public ChessEngine(ref ChessBoardModel chessBoard, ref ChessViewModel viewModel, bool player)
        {
            // Initialize ChessBoard.
            ChessBoard = chessBoard;

            // Initialize ViewModel.
            ViewModel = viewModel;

            // Initialize the Player true = white, false = black.
            Player = player;

            // Initialize BoardDepth.
            BoardDepth = 4;

            // ThreadStart variable initializes with the start method which the Thread will run.
            ThreadStart engineStart = new ThreadStart(start);

            // Initialize the Engine Thread with engineStart.
            Engine = new Thread(engineStart);

            // Start Engine Thread;
            Engine.Start();
        }