style: format code with Ktlint
This commit fixes the style issues introduced in 98c91a1 according to the output
from Ktlint.
Details: None
This commit is contained in:
parent
98c91a107a
commit
c57ed4e3d5
2 changed files with 5 additions and 5 deletions
|
|
@ -13,9 +13,9 @@ class Rover {
|
|||
fun go(cms: String) {
|
||||
for (c in cms) {
|
||||
when (c) {
|
||||
'L' -> { when (rs.dd) { 'E' -> rs.dd = 'N' 'N' -> rs.dd = 'W' 'W' -> rs.dd = 'S' 'S' -> rs.dd = 'E'}}
|
||||
'R' -> { when (rs.dd) { 'E' -> rs.dd = 'S' 'S' -> rs.dd = 'W' 'W' -> rs.dd = 'N' 'N' -> rs.dd = 'E'}}
|
||||
'M' -> { when (rs.dd) { 'E' -> rs.xx++ 'S' -> rs.yy-- 'W' -> rs.xx-- 'N' -> rs.yy++}}
|
||||
'L' -> { when (rs.dd) { 'E' -> rs.dd = 'N' 'N' -> rs.dd = 'W' 'W' -> rs.dd = 'S' 'S' -> rs.dd = 'E' } }
|
||||
'R' -> { when (rs.dd) { 'E' -> rs.dd = 'S' 'S' -> rs.dd = 'W' 'W' -> rs.dd = 'N' 'N' -> rs.dd = 'E' } }
|
||||
'M' -> { when (rs.dd) { 'E' -> rs.xx++ 'S' -> rs.yy-- 'W' -> rs.xx-- 'N' -> rs.yy++ } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class MarsRoverTests {
|
|||
"1 2 S, M, 1 1 S",
|
||||
"1 2 W, M, 0 2 W",
|
||||
"1 2 N, LMLMLMLMM, 1 3 N",
|
||||
"3 3 E, MMRMMRMRRM, 5 1 E"
|
||||
"3 3 E, MMRMMRMRRM, 5 1 E",
|
||||
)
|
||||
fun `execute commands`(startingPosition: String, instructions: String, expectedOutput: String) {
|
||||
val rover = Rover(startingPosition)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue