GREEN: implement turn right
This commit is contained in:
parent
df3823e3a9
commit
99c22b3a8a
1 changed files with 10 additions and 0 deletions
|
|
@ -14,4 +14,14 @@ class Rover {
|
||||||
};
|
};
|
||||||
direction = leftTurns[direction]!;
|
direction = leftTurns[direction]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void turnRight() {
|
||||||
|
const rightTurns = {
|
||||||
|
'N': 'E',
|
||||||
|
'E': 'S',
|
||||||
|
'S': 'W',
|
||||||
|
'W': 'N',
|
||||||
|
};
|
||||||
|
direction = rightTurns[direction]!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue