GREEN: implement command execution

This commit is contained in:
fiatcode 2026-02-24 10:48:32 +07:00
parent 9cc1ae42b0
commit e292e66c64

View file

@ -41,4 +41,21 @@ class Rover {
break;
}
}
void execute(String commands) {
for (var i = 0; i < commands.length; i++) {
final command = commands[i];
switch (command) {
case 'L':
turnLeft();
break;
case 'R':
turnRight();
break;
case 'M':
moveForward();
break;
}
}
}
}