Last active
September 16, 2015 07:30
-
-
Save timkellogg/ea3b3db7711e4e28e6dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Player (mark) { | |
this.mark = mark | |
}; | |
function Space (x,y) { | |
this.coordinates = [x,y] | |
this.markedBy = undefined | |
}; | |
Space.prototype.marked = function(player) { | |
this.markedBy = player; | |
}; | |
function Board () { | |
spaces = []; | |
for (var x = 0; x < 2; x ++) { | |
for (var y = 0; y < 2; y++ ) { | |
spaces.push(new Space(x,y) ); | |
}; | |
}; | |
console.log(spaces); | |
}; | |
SPECS | |
describe('Player', function() { | |
it("returns the player's mark", function() { | |
var testPlayer = new Player("X"); | |
expect(testPlayer.mark).to.equal("X"); | |
}); | |
}); | |
describe("Space", function() { | |
it("returns the coordinates of the space", function() { | |
var testSpace = new Space(1,2); | |
expect(testSpace.coordinates[0]).to.equal(1); | |
expect(testSpace.coordinates[1]).to.equal(2); | |
}); | |
it("returns the player it's filled with when marked", function() { | |
var testPlayer = new Player("X"); | |
var testSpace = new Space(1,2); | |
testSpace.marked(testPlayer); | |
expect(testSpace.markedBy).to.equal(testPlayer); | |
}); | |
}); | |
describe("Board", function() { | |
it("creates a board with 3 rows of spaces", function() { | |
var testBoard = new Board(); | |
}); | |
}); | |
// describe(Board) do | |
// it("creates 9 spaces when it is initialized") do # You write the rest! | |
// end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment