Commit 2608e141 authored by Stefanie Hasler's avatar Stefanie Hasler

tcr

parent ef8d8d45
......@@ -10,17 +10,18 @@ class MarsRover {
}
forward(): MarsRover {
if (this.dir === 'E') {
this.x++
}
else if (this.dir === 'S') {
this.y--
}
else if (this.dir === 'W') {
this.x--
}
else {
this.y++
switch(this.dir) {
case 'E':
this.x++
break
case 'S':
this.y --
break
case 'W':
this.x--
break
default:
this.y++
}
return this
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment