/* Highlighting of all possible moves
         */
        private void HighlightPossibleTurns(BaseChecker currentSelectedChecker)
        {
            PathPoint turns = currentSelectedChecker.GetPossibleTurns();

            if (!turns.IsDeadEnd())
            {
                foreach (TurnDirection direction in DirectionHelper.GetAllDirections())
                {
                    foreach (PathPoint point in turns[direction])
                    {
                        board[point.Position.X, point.Position.Y].Highlighted = true;
                    }
                }
            }
        }
        /* Trying to move checker
         * Calculating the movement
         * ------------------------------------------------------------------------------
         */
        private void DoMovement(BaseChecker previouslySelectedChecker, Point toPosition)
        {
            string    logMessage = Constants.localized.logTurn + ' ';
            PathPoint turns;

            // Erase highlighting on all checkers
            DeselectAllCheckers();

            // If the move does not start
            if (state.ActiveCheckerPathPoint == null)
            {
                turns = previouslySelectedChecker.GetPossibleTurns(); // Calculation of all possible chains of moves for a checker
                state.ActiveCheckerPathPoint = turns;
            }
            else
            {
                turns = state.ActiveCheckerPathPoint; // Continuation of the movement
            }
            // If the position is not a deadlock
            if (!turns.IsDeadEnd())
            {
                state.ActiveChecker = previouslySelectedChecker;

                // Movement
                for (int i = 0; i < 4; i++)
                {
                    foreach (PathPoint point in turns[i])
                    {
                        if (toPosition == point.Position)
                        {
                            Point fromPosition = new Point()
                            {
                                X = previouslySelectedChecker.Position.BoardPosition.X,
                                Y = previouslySelectedChecker.Position.BoardPosition.Y
                            };
                            logMessage += previouslySelectedChecker.GetPrintablePosition() + $" {Constants.localized.logMoveTo} ";
                            // Moving the checker to the selected position
                            previouslySelectedChecker.MoveTo(new Point(toPosition.X, toPosition.Y));
                            logMessage += previouslySelectedChecker.GetPrintablePosition();
                            Game.userLogController.WriteMessage(logMessage);
                            // Defining the direction of movement
                            Point moveDirection = new Point()
                            {
                                X = toPosition.X - fromPosition.X > 0 ? 1 : -1,
                                Y = toPosition.Y - fromPosition.Y > 0 ? 1 : -1
                            };

                            // Determination of the eaten checkers
                            TryEatEnemyCheckers(previouslySelectedChecker, toPosition, fromPosition, moveDirection);

                            // If the checker can become a king
                            if (previouslySelectedChecker is Pawn && previouslySelectedChecker.Position.BoardPosition.Y ==
                                (previouslySelectedChecker.Direction == CheckerMoveDirection.Upstairs ? 0 : 7))
                            {
                                // Replacement of a checker by a king
                                King newKing = new King(previouslySelectedChecker.Side, previouslySelectedChecker.Position);
                                state.AllCheckers.Remove(previouslySelectedChecker);
                                state.AllCheckers.Add(newKing);

                                // Adding to the list of drawings
                                Game.drawingController.AddToDrawingList(newKing);
                                previouslySelectedChecker.Destroy();

                                // Calculation of the further path for a king
                                state.ActiveChecker = newKing;
                                if (state.ActiveCheckerPathPoint.afterAggression)
                                {
                                    state.ActiveCheckerPathPoint = newKing.GetPossibleTurns(DirectionHelper.GetOppositeDirection(DirectionHelper.GetDirection(moveDirection)));
                                    if (state.ActiveCheckerPathPoint.TryGetAggresiveDirections().Count == 0)
                                    {
                                        // End of turn
                                        EndTurn();
                                        return;
                                    }
                                    else
                                    {
                                        DeselectAllCheckers();
                                        state.ActiveChecker.selected = true;
                                        HighlightPossibleTurns(state.ActiveChecker);
                                    }
                                }
                                else
                                {
                                    EndTurn();
                                    return;
                                }
                            }

                            // Find the point he went to
                            // Calculate whether it is possible to continue the movement
                            foreach (PathPoint waypoint in state.ActiveCheckerPathPoint[DirectionHelper.GetDirection(moveDirection)])
                            {
                                if (waypoint.Position == toPosition)
                                {
                                    if (!waypoint.IsOnlyFinalTraces())
                                    {
                                        // Continuation of the movement
                                        state.ActiveCheckerPathPoint = waypoint;
                                        DeselectAllCheckers();
                                        state.ActiveChecker.selected = true;
                                        HighlightPossibleTurns(state.ActiveChecker);
                                    }
                                    else
                                    {
                                        // End of turn
                                        EndTurn();
                                    }
                                }
                            }
                            return;
                        }
                    }
                }
            }
            else
            {
                // Deadlock position, end of turn
                if (state.ActiveChecker != null || state.ActiveCheckerPathPoint != null)
                {
                    state.ActiveChecker          = null;
                    state.ActiveCheckerPathPoint = null;
                }
            }
        }