Commit 64727dd5 authored by Stefanie Hasler's avatar Stefanie Hasler
Browse files

tcr

parent ab6b5e4f
...@@ -13,6 +13,9 @@ class MarsRover { ...@@ -13,6 +13,9 @@ class MarsRover {
if (this.dir === 'E') { if (this.dir === 'E') {
this.x++ this.x++
} }
else if (this.dir === 'S') {
this.y--
}
else { else {
this.y++ this.y++
} }
...@@ -65,4 +68,8 @@ describe("MarsRover", () => { ...@@ -65,4 +68,8 @@ describe("MarsRover", () => {
it('should turn right, move forward, and have moved east', () => { it('should turn right, move forward, and have moved east', () => {
expect(new MarsRover().right().forward().pos()).to.equal('1,0,E') expect(new MarsRover().right().forward().pos()).to.equal('1,0,E')
}) })
it('should turn right twice, move forward, and have moved south', () => {
expect(new MarsRover().right().right().forward().pos()).to.equal('0,-1,S')
})
}) })
\ No newline at end of file
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