Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nina's Tic-Tac-Glow #32

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ab4d51f
new game initialized with two players
miriam-cortes Dec 13, 2016
6520440
test players symbol is assigned correctly
miriam-cortes Dec 13, 2016
ed5aadb
added tests for players and play in game
ninamutty Dec 13, 2016
0fbda73
game play tests complete
ninamutty Dec 13, 2016
bfcc8da
hasWon function completeded - need to test in play
ninamutty Dec 13, 2016
6227518
game basics complete and tested
ninamutty Dec 13, 2016
cbdf914
added board display in terminal
ninamutty Dec 13, 2016
691c0cf
tie games handled
ninamutty Dec 13, 2016
efc4980
changed player name to constructor
ninamutty Dec 13, 2016
1c693e0
tournment files
ninamutty Dec 13, 2016
0684610
commented tests
ninamutty Dec 13, 2016
3c9e578
fixed the problems kari has with us
ninamutty Dec 14, 2016
a89dc98
removed a couple files and edited index file
ninamutty Dec 16, 2016
2ced8d2
files set up
ninamutty Dec 16, 2016
0c6ded1
moved app.js out of src/app and into src/
ninamutty Dec 16, 2016
a2f8843
styling done - added click watcher
ninamutty Dec 19, 2016
fec6945
basic views and models working
ninamutty Dec 19, 2016
1fff387
can create players and click on tiles (an x appears)
ninamutty Dec 19, 2016
a15cfd8
can play very roughly
ninamutty Dec 20, 2016
9aab41f
CAN PLAY...need to keep them from doing more..
ninamutty Dec 20, 2016
d24c5a8
basic game complete - need to cancel click when game is over
ninamutty Dec 20, 2016
fbed5b8
modal showing
ninamutty Dec 20, 2016
b84bbb4
api format set
ninamutty Dec 20, 2016
13e2358
SENDS API POST REQUESTS
ninamutty Dec 21, 2016
384812a
tie send
ninamutty Dec 21, 2016
e276b73
can keep playling games
ninamutty Dec 21, 2016
07aff6b
added music for the modal
ninamutty Dec 21, 2016
1b1230a
deleted
ninamutty Dec 21, 2016
6bbdd3a
testing is failing
ninamutty Dec 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
game basics complete and tested
  • Loading branch information
ninamutty committed Dec 13, 2016
commit 6227518c2f11e27ef5e869a154838bc4410e308b
27 changes: 26 additions & 1 deletion spec/game.spec.js
Original file line number Diff line number Diff line change
@@ -85,7 +85,32 @@ describe('Game', function() {
expect(newGame.allPlayers[1].turn).toEqual(true);
});

// it ('should')
it ('should set the winner', function() {
var newGame = new Game();
newGame.players("Mario","Luigi");
newGame.play(1); // player 1
newGame.play(4); // player 2
newGame.play(2); // player 1
newGame.play(5); // player 2

expect(newGame.allPlayers[0].winner).toEqual(false);
newGame.play(3); // player 1
expect(newGame.allPlayers[0].winner).toEqual(true);
expect(newGame.allPlayers[1].winner).toEqual(false);

});

it('should not allow a play if there is a winner', function() {
var newGame = new Game();
newGame.players("Mario","Luigi");
newGame.play(1); // player 1
newGame.play(4); // player 2
newGame.play(2); // player 1
newGame.play(5); // player 2
newGame.play(3); // player 1

expect(function() {newGame.play(8)}).toThrow(new Error("The Game is Over"))
})
}); // close describe play

describe('hasWon', function() {
15 changes: 4 additions & 11 deletions src/game.js
Original file line number Diff line number Diff line change
@@ -35,12 +35,15 @@ Game.prototype.players = function (player1, player2) {

Game.prototype.play = function (location) {
// console.log(this.allPlayers);
if (this.allPlayers[0].winner == true || this.allPlayers[1].winner == true) {
throw new Error("The Game is Over");
}

if (this.board[location] !== null) {
return this.board;
}

for (var player in this.allPlayers) {
// console.log(">>>>>" + this.allPlayers[player].name);
if (this.allPlayers[player].turn) {
this.board[location] = this.allPlayers[player].symbol
this.allPlayers[player].turn = false;
@@ -81,14 +84,4 @@ Game.prototype.hasWon = function () {




// var newGame = new Game();
// var players = newGame.players("Mario", "Luigi");
// console.log(players[0].name);






export default Game;