Representing algorithms

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
Question 25
Medium

A planetary rover is placed on a 5x5 grid of a Mars sector. The rover's starting position is shown in the grid below by the arrow symbol ► at Row 2, Column 4, which indicates it is initially facing East (Right).

Shaded squares containing a [Boulder] represent hazardous terrain that the rover cannot move into.

Mars Rover Grid

Mars Rover Grid

Rover Algorithm

WHILE HazardAhead() = true
  SpinLeft()
  IF HazardAhead() = true THEN
    SpinRight()
    SpinRight
  ENDIF
  Advance(1)
ENDWHILE
Advance(1)

Determine the sequential path of coordinates the rover visits from start to finish. Specify each step in order using the format (Row, Column).

[3]

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms