Beispiel #1
0
        private void render()
        {
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    IPiece      piece        = _gameState.At(x, y);
                    Rectangle   square       = _imageSquares[x, y];
                    SquareState currentState = (SquareState)square.Tag;
                    if (currentState.Piece != piece)
                    {
                        if (piece != null)
                        {
                            string      path     = "images/" + piece.ImageFile();
                            Uri         imageUri = new Uri(BaseUriHelper.GetBaseUri(this), path);
                            BitmapImage image    = new BitmapImage(imageUri);

                            currentState.Piece = piece;
                            square.Tag         = currentState;
                            square.Fill        = new ImageBrush(image);
                        }
                        else
                        {
                            currentState.Piece = null;
                            square.Tag         = currentState;
                            square.Fill        = new ImageBrush();
                        }
                    }
                }
            }
            lblPlayerTurn.Content = _gameState.PlayerTurn.ToString();
            //lblWhiteHeuristic.Content = Agent.Heuristic.GetHeuristic(_gameState, Team.White);
            lblWhiteHeuristic.Content = _totalEvals;
        }