R: Data clump position in Heading/ RoverState
This commit is contained in:
parent
61a4d417b8
commit
65444e0932
3 changed files with 12 additions and 15 deletions
|
|
@ -23,10 +23,7 @@ enum class Heading(val symbol: Char, val vector: Vector) {
|
|||
NORTH -> EAST
|
||||
}
|
||||
|
||||
fun move(
|
||||
x: Int,
|
||||
y: Int,
|
||||
): Pair<Int, Int> = Pair(x + vector.deltaX, y + vector.deltaY)
|
||||
fun move(position: Position): Position = position.copy(x = position.x + vector.deltaX, position.y + vector.deltaY)
|
||||
|
||||
override fun toString(): String = symbol.toString()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue