R: ktlint
This commit is contained in:
parent
0ca418f0b5
commit
c5ce275612
2 changed files with 7 additions and 5 deletions
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
# Mikado
|
||||
- [ ] Change var to val (immutable)
|
||||
- [ ] Rover.turnLeft use copy() on state
|
||||
- [ ] Rover.turnRight use copy() on state
|
||||
- [x] Rover.turnLeft use copy() on state
|
||||
- [x] Rover.turnRight use copy() on state
|
||||
- [x] Rover.move use copy() on state
|
||||
- [x] Rover.constructor use copy() on state
|
||||
- [x] Change RoverState to Data Class
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ class Rover {
|
|||
state.copy(
|
||||
positionX = command[ROVER_STARTING_POSITION_X].toInt(),
|
||||
positionY = command[ROVER_STARTING_POSITION_Y].toInt(),
|
||||
heading = Heading.from(command[ROVER_FACING_DIRECTION][ROVER_COMMANDLIST_DIRECTION]) ?: state.heading,
|
||||
heading =
|
||||
Heading.from(command[ROVER_FACING_DIRECTION][ROVER_COMMANDLIST_DIRECTION])
|
||||
?: state.heading,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -29,11 +31,11 @@ class Rover {
|
|||
}
|
||||
|
||||
private fun turnRight() {
|
||||
state.heading = state.heading.turnRight()
|
||||
state = state.copy(heading = state.heading.turnRight())
|
||||
}
|
||||
|
||||
private fun turnLeft() {
|
||||
state.heading = state.heading.turnLeft()
|
||||
state = state.copy(heading = state.heading.turnLeft())
|
||||
}
|
||||
|
||||
val position: String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue