R: Heading turnLeft()

This commit is contained in:
Paul Hameteman 2025-10-14 22:27:53 +02:00
commit a56304bc77
3 changed files with 9 additions and 7 deletions

View file

@ -7,6 +7,13 @@ enum class Heading(val symbol: Char) {
WEST('W'),
;
fun turnLeft() = when (this) {
EAST -> NORTH
NORTH -> WEST
WEST -> SOUTH
SOUTH -> EAST
}
fun turnRight() = when (this) {
EAST -> SOUTH
SOUTH -> WEST