public void UpdateBoardFromGlobalState()
        {
            //var vision = GameRules.GetVision(_globalState, _globalState.WhiteTurn, new VisionRules { ViewMoveFields = false, ViewRange = 1 });
            string blackKingField = _globalState.GetWhiteKingPos();
            string whiteKingField = _globalState.GetBlackKingPos();

            foreach (Grid child in this.BoardGrid.Children)
            {
                bool a = PosIsWhiteBoardField(child.Name);
                if (a)
                {
                    child.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x8F, 0xFF, 0xFF));
                }
                else
                {
                    //child.Background = new Brush("#FF6F6F6F");
                    child.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x6F, 0x8F, 0x8F));
                }
                ApplyFieldStateToGrid(child, _globalState.GetFieldAt(child.Name));
                if (_globalState.CanSeeField(_clientIsPlayer, child.Name))
                {
                    child.Opacity = 1;
                    foreach (UIElement underChiled in child.Children)
                    {
                        underChiled.Visibility = Visibility.Visible;
                    }
                    if (child.Name == _globalState.Selected)
                    {
                        var border = new Border();
                        border.BorderBrush     = Brushes.Red;
                        border.BorderThickness = new Thickness(2, 2, 2, 2); //You can specify here which borders do you want
                        child.Children.Add(border);
                    }
                    else if (_globalState.IsLegalMove(child.Name))
                    {
                        var border = new Border();
                        border.BorderBrush     = Brushes.Red;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        child.Children.Add(border);
                    }
                    else if (_lastMoveFrom == child.Name || _lastMoveTo == child.Name)
                    {
                        var border = new Border();
                        border.BorderBrush     = Brushes.SeaGreen;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        child.Children.Add(border);
                    }

                    if (_globalState.GetLegalMovesFromField(child.Name).Contains(whiteKingField) && _globalState.CanSeeField(_clientIsPlayer, whiteKingField))
                    {
                        //messageBox.AppendText("YGetLegalMovesFromField" + "\n");
                        var border = new Border();
                        border.BorderBrush     = Brushes.Gold;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        child.Children.Add(border);
                        Grid kingGrid = (Grid)BoardGrid.FindName(whiteKingField);
                        border                 = new Border();
                        border.BorderBrush     = Brushes.Gold;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        kingGrid.Children.Add(border);
                    }
                    else if (_globalState.GetLegalMovesFromField(child.Name).Contains(blackKingField) && _globalState.CanSeeField(_clientIsPlayer, blackKingField))
                    {
                        //messageBox.AppendText("YGetLegalMovesFromField" + "\n");
                        var border = new Border();
                        border.BorderBrush     = Brushes.Gold;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        child.Children.Add(border);
                        Grid kingGrid = (Grid)BoardGrid.FindName(blackKingField);
                        border                 = new Border();
                        border.BorderBrush     = Brushes.Gold;
                        border.BorderThickness = new Thickness(3, 3, 3, 3); //You can specify here which borders do you want
                        kingGrid.Children.Add(border);
                    }
                }
                else
                {
                    child.Visibility = Visibility.Visible;
                    child.Opacity    = 0.15;
                    foreach (UIElement underChiled in child.Children)
                    {
                        underChiled.Visibility = Visibility.Hidden;
                    }
                }
            }
            _killedPices.Sort();
            foreach (var pice in _killedPices)
            {
                AddPiceToGrid(KilledPicesGrid, pice);
            }
        }