The Lawnmower Problem·With a 10x10 lawn and a lawnmower that can only move in four cardinal directions, find a lawnmower that will mow the entire lawn without running over the edge in less than 500 moves.ð? ô Pà ü©ñÒMbP?   4@1010dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   100 MoveForwardVoidÿIf (&TotalMovesLeft > 0) { &TotalMovesLeft := &TotalMovesLeft - 1; &XPosition := &XPosition + (&XPosition < &Argument0) * (&Direction = 1) - (&XPosition > 1) * (&Direction = 3) ; &YPosition := &YPosition + (&YPosition < &Argument1)* (&Direction = 2) - (&YPosition > 1) * (&Direction = 0); If (GetAt(&Lawn, (&YPosition-1) * &Argument0 + &XPosition, 1) = "X") { &SquaresMowed := &SquaresMowed + 1; Replace(&Lawn, ".", (&YPosition - 1) * &Argument0 + &XPosition, 1); } } TurnRightVoidtIf (&TotalMovesLeft > 0) { &TotalMovesLeft := &TotalMovesLeft - 1; &Direction := (&Direction + 1) % 4; }TurnLeftVoid›If (&TotalMovesLeft > 0) { &TotalMovesLeft := &TotalMovesLeft - 1; &Direction := (&Direction - 1) * (&Direction > 0) + (&Direction = 0) * 3; } DetectAheadBooleanÿ¿Declare (&XPosAhead, "Number"); Declare (&YPosAhead, "Number"); &XPosAhead := &XPosition + (&XPosition < &Argument0) * (&Direction = 1) - (&XPosition > 1) * (&Direction = 3) ; &YPosAhead := &YPosition + (&YPosition < &Argument1) * (&Direction = 2) - (&YPosition > 1) * (&Direction = 0); If (GetAt(&Lawn, &XPosAhead + (&YPosAhead-1) * &Argument0, 1) = "X") { &DetectAhead := TRUE; } Else { &DetectAhead := FALSE; } DetectLeftBooleanÿ·Declare (&XPosLeft, "Number"); Declare (&YPosLeft, "Number"); &XPosLeft := &XPosition + (&XPosition < &Argument0) * (&Direction = 2) - (&XPosition > 1) * (&Direction = 0) ; &YPosLeft := &YPosition + (&YPosition < &Argument1) * (&Direction = 3) - (&YPosition > 1) * (&Direction = 1); If (GetAt(&Lawn, &XPosLeft + (&YPosLeft-1) * &Argument0, 1) = "X") { &DetectLeft := TRUE; } Else { &DetectLeft := FALSE; } DetectRightBooleanÿ¾Declare (&XPosRight, "Number"); Declare (&YPosRight, "Number"); &XPosRight := &XPosition + (&XPosition < &Argument0) * (&Direction = 0) - (&XPosition > 1) * (&Direction = 2) ; &YPosRight := &YPosition + (&YPosition < &Argument1) * (&Direction = 1) - (&YPosition > 1) * (&Direction = 3); If (GetAt(&Lawn, &XPosRight + (&YPosRight-1) * &Argument0, 1) = "X") { &DetectRight := TRUE; } Else { &DetectRight := FALSE; } Statement IfB-Function not B-Function && B-Function ||«&XPosition := 1; &YPosition := 1; &Direction := 1; &TotalMovesLeft := 500; &Lawn := &Argument2; While (&TotalMovesLeft > 0 && &SquaresMowed < 99) { RPB(); } &Target - &SquaresMowed&Raw SquaresMowedNumber DirectionNumber XPositionNumber YPositionNumberTotalMovesLeftNumberLawnString !"#$%&