GREEN: implement move forward

This commit is contained in:
fiatcode 2026-02-24 10:47:38 +07:00
parent 36003654c7
commit c6235bd38a

View file

@ -24,4 +24,21 @@ class Rover {
}; };
direction = rightTurns[direction]!; direction = rightTurns[direction]!;
} }
void moveForward() {
switch (direction) {
case 'N':
y += 1;
break;
case 'E':
x += 1;
break;
case 'S':
y -= 1;
break;
case 'W':
x -= 1;
break;
}
}
} }