From e336b2aafaf50a65132cb306ca97d4f25e9d227a Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 13 Dec 2016 11:58:17 -0800 Subject: [PATCH 01/40] added game.js to src --- src/game.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/game.js diff --git a/src/game.js b/src/game.js new file mode 100644 index 0000000..e69de29 From 5b721aaec402ee6f02274eff3fcc9c4c65fa1e2b Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 13 Dec 2016 13:32:44 -0800 Subject: [PATCH 02/40] created Game, player1, player2, and gameBoard objects --- src/game.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/game.js b/src/game.js index e69de29..c594c84 100644 --- a/src/game.js +++ b/src/game.js @@ -0,0 +1,40 @@ +var Game = function() { + this.board = new gameBoard(); + this.player1 = new Player1(); + this.player2 = new Player2(); + console.log(this.board); + console.log(this.player1); + console.log(this.player2); +}; + +var gameBoard = function() { + this.board = []; + this.board[0] = [null, null, null]; + this.board[1] = [null, null, null]; + this.board[2] = [null, null, null]; +}; + +var Player1 = function() { + this.marker = "X"; + this.turnCounter = true; +}; + +var Player2 = function() { + this.marker = "O"; + this.turnCounter = false; +}; +// +// //totalScore(): Function which sums up and returns the score of the players words +// Player.prototype.totalScore = function() { +// var playerWords = this.plays; +// var totalScore = 0; +// +// for (var i = 0; i < playerWords.length; i++) { +// var wordScore = Scrabble.score(playerWords[i]); +// totalScore += wordScore; +// } +// return totalScore; +// }; + +// DO NOT REMOVE THIS +export default Game; From 4fdf13c668d2ccc568ec6aa2ab3dd40b5d8ecfab Mon Sep 17 00:00:00 2001 From: Yasmin Date: Tue, 13 Dec 2016 14:18:01 -0800 Subject: [PATCH 03/40] Added spec file with some tests, started prototype functions for Game --- spec/game.spec.js | 22 ++++++++++++++++++++++ src/game.js | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 spec/game.spec.js diff --git a/spec/game.spec.js b/spec/game.spec.js new file mode 100644 index 0000000..692c251 --- /dev/null +++ b/spec/game.spec.js @@ -0,0 +1,22 @@ +import Game from 'game'; +import gameBoard from 'game'; + +describe('Game', function() { + var testGame = new Game(); + var testBoard = new gameBoard(); + + it("should create a gameBoard with initialized", function() { + expect(testGame.board).toBeDefined(); + expect(testGame.board).toEqual(testBoard.board); + }); + + it('should initialize the correct Player for player1', function() { + expect(testGame.player1.marker).toEqual("X"); + expect(testGame.player1.turnCounter).toEqual(true); + }); + + it('should initialize the correct Player for player2', function() { + expect(testGame.player2.marker).toEqual("O"); + expect(testGame.player2.turnCounter).toEqual(false); + }); +}); diff --git a/src/game.js b/src/game.js index c594c84..77ec6a1 100644 --- a/src/game.js +++ b/src/game.js @@ -2,16 +2,45 @@ var Game = function() { this.board = new gameBoard(); this.player1 = new Player1(); this.player2 = new Player2(); + this.gameCounter = true; console.log(this.board); console.log(this.player1); console.log(this.player2); + +}; + +Game.prototype.playTurn = function(location) { + var player = whichPlayer(); + if (valid) { + location = + } +}; + +var whichPlayer = function() { + if (this.gameCounter == true) { + return this.player1 + } else { + return this.player2 + } +}; + +var valid = function(location) { + if (this.board location == null) { + return true + } else { + return false + } }; var gameBoard = function() { this.board = []; - this.board[0] = [null, null, null]; - this.board[1] = [null, null, null]; - this.board[2] = [null, null, null]; + this.board[0] = ['top0', 'top1', 'top2']; + this.board[1] = ['mid0', 'mid1', 'mid2']; + this.board[2] = ['bot0', 'bot1', 'bot2']; + + // this.board[0] = [null, null, null]; + // this.board[1] = [null, null, null]; + // this.board[2] = [null, null, null]; }; var Player1 = function() { From 0b6237d64283057a566d08883b93520121bf8663 Mon Sep 17 00:00:00 2001 From: Yasmin Date: Tue, 13 Dec 2016 15:07:46 -0800 Subject: [PATCH 04/40] WIP: Game.prototype.play function --- spec/game.spec.js | 2 ++ src/game.js | 52 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 692c251..f7e1d1d 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -8,6 +8,8 @@ describe('Game', function() { it("should create a gameBoard with initialized", function() { expect(testGame.board).toBeDefined(); expect(testGame.board).toEqual(testBoard.board); + expect(testGame.board).toEqual(jasmine.any(Array)); + }); it('should initialize the correct Player for player1', function() { diff --git a/src/game.js b/src/game.js index 77ec6a1..4f60317 100644 --- a/src/game.js +++ b/src/game.js @@ -9,12 +9,12 @@ var Game = function() { }; -Game.prototype.playTurn = function(location) { - var player = whichPlayer(); - if (valid) { - location = - } -}; +// Game.prototype.playTurn = function(location) { +// var player = whichPlayer(); +// if (valid) { +// location = +// } +// }; var whichPlayer = function() { if (this.gameCounter == true) { @@ -25,22 +25,48 @@ var whichPlayer = function() { }; var valid = function(location) { - if (this.board location == null) { + + if (this.board != 'X' && this.board != 'O') { return true } else { return false } }; +// var locationId = function(location) { +// var column = location[1]; +// if (location[0] == 'A') { +// console.log(column); +// console.log(this.board[0][column]); +// return this.board[0][column] +// } +// }; + var gameBoard = function() { this.board = []; - this.board[0] = ['top0', 'top1', 'top2']; - this.board[1] = ['mid0', 'mid1', 'mid2']; - this.board[2] = ['bot0', 'bot1', 'bot2']; + this.board[0] = ['A0', 'A1', 'A2']; + this.board[1] = ['B0', 'B1', 'B2']; + this.board[2] = ['C0', 'C1', 'C2']; - // this.board[0] = [null, null, null]; - // this.board[1] = [null, null, null]; - // this.board[2] = [null, null, null]; + this.locationId = function(location) { + var column = location[1]; + if (location[0] == 'A') { + console.log(column); + console.log(this.board[0][column]); + return this.board[0][column] + } + }; + // this.boardLocation = { + // 'top0': [0][0], + // 'top1': [0][1], + // 'top2': [0][2], + // 'mid0': [1][0], + // 'mid1': [1][1], + // 'mid2': [1][2], + // 'bot0': [2][0], + // 'bot1': [2][1], + // 'bot2': [2][2] + // } }; var Player1 = function() { From e5a4b34ce9a10ce8dc6c481dd88d6818b186938f Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 13 Dec 2016 15:59:27 -0800 Subject: [PATCH 05/40] WIP: Plays & wrote more tests --- spec/game.spec.js | 26 +++++++++++-- src/game.js | 93 ++++++++++++++++++++--------------------------- 2 files changed, 61 insertions(+), 58 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index f7e1d1d..5497c5f 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -1,15 +1,14 @@ import Game from 'game'; -import gameBoard from 'game'; +import GameBoard from 'game'; describe('Game', function() { var testGame = new Game(); - var testBoard = new gameBoard(); + var testBoard = new GameBoard(); it("should create a gameBoard with initialized", function() { expect(testGame.board).toBeDefined(); expect(testGame.board).toEqual(testBoard.board); - expect(testGame.board).toEqual(jasmine.any(Array)); - + expect(testGame.board.gameBoard).toEqual(jasmine.any(Array)); }); it('should initialize the correct Player for player1', function() { @@ -21,4 +20,23 @@ describe('Game', function() { expect(testGame.player2.marker).toEqual("O"); expect(testGame.player2.turnCounter).toEqual(false); }); + + describe('whichPlayer', function() { + var testGame2 = new Game(); + testGame2.gameCounter = false; + + it('should return Player1 for a new game because counter equals true', function(){ + expect(testGame.whichPlayer()).toEqual(testGame.player1); + }); + + it('should return Player2 if gameCounter equals false', function(){ + expect(testGame2.whichPlayer()).toEqual(testGame.player2); + }); + }); + + describe('Valid', function() { + + + }); + }); diff --git a/src/game.js b/src/game.js index 4f60317..160b8c5 100644 --- a/src/game.js +++ b/src/game.js @@ -1,12 +1,11 @@ var Game = function() { - this.board = new gameBoard(); + this.board = new GameBoard(); this.player1 = new Player1(); this.player2 = new Player2(); this.gameCounter = true; console.log(this.board); console.log(this.player1); console.log(this.player2); - }; // Game.prototype.playTurn = function(location) { @@ -16,57 +15,54 @@ var Game = function() { // } // }; -var whichPlayer = function() { - if (this.gameCounter == true) { - return this.player1 +Game.prototype.whichPlayer = function() { + if (this.gameCounter === true) { + return this.player1; } else { - return this.player2 + return this.player2; } }; -var valid = function(location) { +Game.prototype.valid = function(location) { - if (this.board != 'X' && this.board != 'O') { - return true - } else { - return false - } + var locationValue = this.board.locationValue(location); + if (locationValue != 'X' && locationValue != 'O') { + return true; + } else { + return false; + } }; -// var locationId = function(location) { -// var column = location[1]; -// if (location[0] == 'A') { -// console.log(column); -// console.log(this.board[0][column]); -// return this.board[0][column] +// Game.prototype.valid = function(location) { +// if (this.board.gameBoard.includes(location)) { +// return true; +// } else { +// return false; // } // }; -var gameBoard = function() { - this.board = []; - this.board[0] = ['A0', 'A1', 'A2']; - this.board[1] = ['B0', 'B1', 'B2']; - this.board[2] = ['C0', 'C1', 'C2']; +var GameBoard = function() { + this.gameBoard = []; + this.gameBoard[0] = ['A0', 'A1', 'O']; + this.gameBoard[1] = ['B0', 'X', 'B2']; + this.gameBoard[2] = ['C0', 'C1', 'C2']; +}; - this.locationId = function(location) { - var column = location[1]; - if (location[0] == 'A') { - console.log(column); - console.log(this.board[0][column]); - return this.board[0][column] - } - }; - // this.boardLocation = { - // 'top0': [0][0], - // 'top1': [0][1], - // 'top2': [0][2], - // 'mid0': [1][0], - // 'mid1': [1][1], - // 'mid2': [1][2], - // 'bot0': [2][0], - // 'bot1': [2][1], - // 'bot2': [2][2] - // } +GameBoard.prototype.locationValue = function(location) { + var column = location[1]; + if (location[0] == 'A') { + console.log(column); + console.log(this.board[0][column]); + return this.board[0][column]; + } else if (location[0] == 'B') { + console.log(column); + console.log(this.board[1][column]); + return this.board[1][column]; + } else if (location[0] == 'C') { + console.log(column); + console.log(this.board[2][column]); + return this.board[2][column]; + } }; var Player1 = function() { @@ -78,18 +74,7 @@ var Player2 = function() { this.marker = "O"; this.turnCounter = false; }; -// -// //totalScore(): Function which sums up and returns the score of the players words -// Player.prototype.totalScore = function() { -// var playerWords = this.plays; -// var totalScore = 0; -// -// for (var i = 0; i < playerWords.length; i++) { -// var wordScore = Scrabble.score(playerWords[i]); -// totalScore += wordScore; -// } -// return totalScore; -// }; + // DO NOT REMOVE THIS export default Game; From 5d127a63f0ae172b9c6ff2f7e23f867bf08cd65d Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 09:48:04 -0800 Subject: [PATCH 06/40] revamped game.valid function to simplify code and to take two inputs --- src/game.js | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/game.js b/src/game.js index 160b8c5..f76846f 100644 --- a/src/game.js +++ b/src/game.js @@ -23,9 +23,10 @@ Game.prototype.whichPlayer = function() { } }; -Game.prototype.valid = function(location) { +Game.prototype.valid = function(row,column) { - var locationValue = this.board.locationValue(location); + var locationValue = this.board.gameBoard[row][column]; + console.log(locationValue); if (locationValue != 'X' && locationValue != 'O') { return true; } else { @@ -43,27 +44,27 @@ Game.prototype.valid = function(location) { var GameBoard = function() { this.gameBoard = []; - this.gameBoard[0] = ['A0', 'A1', 'O']; - this.gameBoard[1] = ['B0', 'X', 'B2']; - this.gameBoard[2] = ['C0', 'C1', 'C2']; + this.gameBoard[0] = [ null, null, 'O']; + this.gameBoard[1] = [ null, 'X', null]; + this.gameBoard[2] = [ null, null, null]; }; -GameBoard.prototype.locationValue = function(location) { - var column = location[1]; - if (location[0] == 'A') { - console.log(column); - console.log(this.board[0][column]); - return this.board[0][column]; - } else if (location[0] == 'B') { - console.log(column); - console.log(this.board[1][column]); - return this.board[1][column]; - } else if (location[0] == 'C') { - console.log(column); - console.log(this.board[2][column]); - return this.board[2][column]; - } -}; +// GameBoard.prototype.locationValue = function(location) { +// var column = location[1]; +// if (location[0] == 'A') { +// console.log(column); +// console.log(this.board[0][column]); +// return this.board[0][column]; +// } else if (location[0] == 'B') { +// console.log(column); +// console.log(this.board[1][column]); +// return this.board[1][column]; +// } else if (location[0] == 'C') { +// console.log(column); +// console.log(this.board[2][column]); +// return this.board[2][column]; +// } +// }; var Player1 = function() { this.marker = "X"; From 8fa71be1bf0bf176e5119e783fac342b857617f9 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 10:02:18 -0800 Subject: [PATCH 07/40] added test for Game.valid function --- spec/game.spec.js | 15 ++++++++++++++- src/game.js | 31 +++++-------------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 5497c5f..fdf91ee 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -34,8 +34,21 @@ describe('Game', function() { }); }); - describe('Valid', function() { + describe('valid', function() { + var testGame3 = new Game (); + testGame3.board.gameBoard[0][2] = "X"; + it('should handle an invalid location entry appropriately', function() { + expect(testGame3.valid(4,4)).toEqual("that's not a valid location"); + }); + + it('should return true if a location is unoccupied(still equal to null)', function() { + expect(testGame3.valid(0,0)).toEqual(true); + }); + + it('should return false if a location is occupied by either an X or O', function() { + expect(testGame3.valid(0,2)).toEqual(false); + }); }); diff --git a/src/game.js b/src/game.js index f76846f..4bce03b 100644 --- a/src/game.js +++ b/src/game.js @@ -24,7 +24,10 @@ Game.prototype.whichPlayer = function() { }; Game.prototype.valid = function(row,column) { - + if((row > 2) || (column > 2)) { + console.log(row + "," + column + " is not a valid location"); + return "that's not a valid location"; + } else { var locationValue = this.board.gameBoard[row][column]; console.log(locationValue); if (locationValue != 'X' && locationValue != 'O') { @@ -32,16 +35,9 @@ Game.prototype.valid = function(row,column) { } else { return false; } + } }; -// Game.prototype.valid = function(location) { -// if (this.board.gameBoard.includes(location)) { -// return true; -// } else { -// return false; -// } -// }; - var GameBoard = function() { this.gameBoard = []; this.gameBoard[0] = [ null, null, 'O']; @@ -49,23 +45,6 @@ var GameBoard = function() { this.gameBoard[2] = [ null, null, null]; }; -// GameBoard.prototype.locationValue = function(location) { -// var column = location[1]; -// if (location[0] == 'A') { -// console.log(column); -// console.log(this.board[0][column]); -// return this.board[0][column]; -// } else if (location[0] == 'B') { -// console.log(column); -// console.log(this.board[1][column]); -// return this.board[1][column]; -// } else if (location[0] == 'C') { -// console.log(column); -// console.log(this.board[2][column]); -// return this.board[2][column]; -// } -// }; - var Player1 = function() { this.marker = "X"; this.turnCounter = true; From b2dafbda734327f4c7bc0c194c6acceac48d0f78 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 10:33:41 -0800 Subject: [PATCH 08/40] wrote tests for Game.playTurn function --- spec/game.spec.js | 38 ++++++++++++++++++++++++++++++++++++-- src/game.js | 27 +++++++++++++++++++++------ 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index fdf91ee..7b6ea8a 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -35,7 +35,7 @@ describe('Game', function() { }); describe('valid', function() { - var testGame3 = new Game (); + var testGame3 = new Game(); testGame3.board.gameBoard[0][2] = "X"; it('should handle an invalid location entry appropriately', function() { @@ -49,7 +49,41 @@ describe('Game', function() { it('should return false if a location is occupied by either an X or O', function() { expect(testGame3.valid(0,2)).toEqual(false); }); - }); + describe('playTurn', function() { + var testGame4 = new Game(); + + it('should add a player1 marker (X) if the space is open', function() { + expect(testGame4.board.gameBoard[0][0]).toEqual(null); + expect(testGame4.gameCounter).toEqual(true); + expect(testGame4.turnCounter).toEqual(0); + + + testGame4.playTurn(0,0); + expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.turnCounter).toEqual(1); + expect(testGame4.board.gameBoard[0][0]).toEqual('X'); + }); + + it('should not add a players marker if the space is taken', function() { + expect(testGame4.board.gameBoard[0][0]).toEqual('X'); + expect(testGame4.gameCounter).toEqual(false); + + testGame4.playTurn(0,0); + expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.turnCounter).toEqual(1); + expect(testGame4.board.gameBoard[0][0]).toEqual('X'); + }); + + it('should add player2 marker (O) if the space is open', function() { + expect(testGame4.board.gameBoard[2][2]).toEqual(null); + expect(testGame4.gameCounter).toEqual(false); + + testGame4.playTurn(2,2); + expect(testGame4.gameCounter).toEqual(true); + expect(testGame4.turnCounter).toEqual(2); + expect(testGame4.board.gameBoard[2][2]).toEqual('O'); + }); + }); }); diff --git a/src/game.js b/src/game.js index 4bce03b..75f0186 100644 --- a/src/game.js +++ b/src/game.js @@ -3,17 +3,32 @@ var Game = function() { this.player1 = new Player1(); this.player2 = new Player2(); this.gameCounter = true; + this.turnCounter = 0; console.log(this.board); console.log(this.player1); console.log(this.player2); }; -// Game.prototype.playTurn = function(location) { -// var player = whichPlayer(); -// if (valid) { -// location = -// } -// }; +Game.prototype.playTurn = function(row, column) { + // console.log(this.whichPlayer()); + var player = this.whichPlayer(); + // console.log(this.valid(row, column)); + if (this.valid(row, column)) { + this.board.gameBoard[row][column] = player.marker; + if (player == this.player1) { + this.gameCounter = false; + this.turnCounter++ ; + } else { + this.gameCounter = true; + this.turnCounter++ ; + } + } else { + console.log("That position is already taken, go Again"); + } + console.log(this.board.gameBoard); + console.log(this.gameCounter); + console.log(this.turnCounter); +}; Game.prototype.whichPlayer = function() { if (this.gameCounter === true) { From 67cbe00e66324692c6ab5909dc29fa87e76b8543 Mon Sep 17 00:00:00 2001 From: Yasmin Date: Wed, 14 Dec 2016 11:42:08 -0800 Subject: [PATCH 09/40] Added the GameBoard.hasWon() function and tests) --- spec/game.spec.js | 89 +++++++++++++++++++++++++++++++++++++++++++++++ src/game.js | 28 +++++++++++++-- 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 7b6ea8a..5b7a0f3 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -86,4 +86,93 @@ describe('Game', function() { expect(testGame4.board.gameBoard[2][2]).toEqual('O'); }); }); + +}); + +describe('GameBoard', function() { + describe('hasWon', function() { + //Rows + var testRow0 = new Game(); + testRow0.board.gameBoard[0][0] = "X"; + testRow0.board.gameBoard[0][1] = "X"; + testRow0.board.gameBoard[0][2] = "X"; + + it('should return true if a player has won Row0', function() { + expect(testRow0.board.hasWon()).toEqual(true); + }); + + var testRow1 = new Game(); + testRow1.board.gameBoard[1][0] = "X"; + testRow1.board.gameBoard[1][1] = "X"; + testRow1.board.gameBoard[1][2] = "X"; + + it('should return true if a player has won Row1', function() { + expect(testRow1.board.hasWon()).toEqual(true); + }); + + var testRow2 = new Game(); + testRow2.board.gameBoard[2][0] = "X"; + testRow2.board.gameBoard[2][1] = "X"; + testRow2.board.gameBoard[2][2] = "X"; + + it('should return true if a player has won Row2', function() { + expect(testRow2.board.hasWon()).toEqual(true); + }); + + //Columns + var testColumn0 = new Game(); + testColumn0.board.gameBoard[0][0] = "X"; + testColumn0.board.gameBoard[1][0] = "X"; + testColumn0.board.gameBoard[2][0] = "X"; + + it('should return true if a player has won Column0', function() { + expect(testColumn0.board.hasWon()).toEqual(true); + }); + + var testColumn1 = new Game(); + testColumn1.board.gameBoard[0][1] = "X"; + testColumn1.board.gameBoard[1][1] = "X"; + testColumn1.board.gameBoard[2][1] = "X"; + + it('should return true if a player has won Column1', function() { + expect(testColumn1.board.hasWon()).toEqual(true); + }); + + var testColumn2 = new Game(); + testColumn2.board.gameBoard[0][2] = "X"; + testColumn2.board.gameBoard[1][2] = "X"; + testColumn2.board.gameBoard[2][2] = "X"; + + it('should return true if a player has won Column2', function() { + expect(testColumn2.board.hasWon()).toEqual(true); + }); + + //Diagonals + var testDiag1 = new Game(); + testDiag1.board.gameBoard[0][0] = "X"; + testDiag1.board.gameBoard[1][1] = "X"; + testDiag1.board.gameBoard[2][2] = "X"; + + it('should return true if a player has won Diag1', function() { + expect(testDiag1.board.hasWon()).toEqual(true); + }); + + var testDiag2 = new Game(); + testDiag2.board.gameBoard[0][2] = "X"; + testDiag2.board.gameBoard[1][1] = "X"; + testDiag2.board.gameBoard[2][0] = "X"; + + it('should return true if a player has won Diag2', function() { + expect(testDiag2.board.hasWon()).toEqual(true); + }); + + var hasNotWonGame = new Game(); + hasNotWonGame.board.gameBoard[0][2] = "X"; + hasNotWonGame.board.gameBoard[1][1] = "X"; + hasNotWonGame.board.gameBoard[2][0] = "O"; + + it("should return false if a player hasn't won", function() { + expect(hasNotWonGame.board.hasWon()).toEqual(false); + }); + }); }); diff --git a/src/game.js b/src/game.js index 75f0186..fce50d0 100644 --- a/src/game.js +++ b/src/game.js @@ -55,11 +55,35 @@ Game.prototype.valid = function(row,column) { var GameBoard = function() { this.gameBoard = []; - this.gameBoard[0] = [ null, null, 'O']; - this.gameBoard[1] = [ null, 'X', null]; + this.gameBoard[0] = [ null, null, null]; + this.gameBoard[1] = [ null, null, null]; this.gameBoard[2] = [ null, null, null]; }; +GameBoard.prototype.hasWon = function () { + // var board = this.gameBoard; + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if ((row0[0] == row0[1] && row0[1] == row0[2]) || + (row1[0] == row1[1] && row1[1] == row1[2]) || + (row2[0] == row2[1] && row2[1] == row2[2])) { + console.log("true"); + return true; + } else if ((row0[0] == row1[0] && row1[0] == row2[0]) || + (row0[1] == row1[1] && row1[1] == row2[1]) || + (row0[2] == row1[2] && row1[2] == row2[2])) { + console.log("true"); + return true; + } else if ((row0[0] == row1[1] && row1[1] == row2[2]) || (row0[2] == row1[1] && row1[1] == row2[0])) { + console.log("true"); + return true; + } else { + return false; + } +}; + var Player1 = function() { this.marker = "X"; this.turnCounter = true; From e7dfca1300c206ef9962d58254df9319c268983a Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 12:31:38 -0800 Subject: [PATCH 10/40] added tests to playTurn and hasWon and aTie & add tie functionality to playTurn and hasWon functions & added gamestop if there has already been a winner --- spec/game.spec.js | 59 ++++++++++++++++++++++++++++++++++++++++- src/game.js | 67 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 110 insertions(+), 16 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 5b7a0f3..e5d45c3 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -85,8 +85,22 @@ describe('Game', function() { expect(testGame4.turnCounter).toEqual(2); expect(testGame4.board.gameBoard[2][2]).toEqual('O'); }); - }); + var testWinner = new Game(); + testWinner.turnCounter = 4; + testWinner.board.gameBoard[0][0] = "X"; + testWinner.board.gameBoard[0][1] = "X"; + + it('should return a winner if someone has won after their turn', function() { + console.log(testWinner.winner); + expect(testWinner.playTurn(0,2)).toEqual(testWinner.player1.name); + console.log(testWinner.winner); + }); + + it('should return a Game Over if game is already won and you try to play a turn', function() { + expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.winner.name + " won."); + }); + }); }); describe('GameBoard', function() { @@ -174,5 +188,48 @@ describe('GameBoard', function() { it("should return false if a player hasn't won", function() { expect(hasNotWonGame.board.hasWon()).toEqual(false); }); + + var testReturnsTie = new Game(); + testReturnsTie.board.gameBoard[0][0] = "X"; + testReturnsTie.board.gameBoard[0][1] = "X"; + testReturnsTie.board.gameBoard[0][2] = "O"; + testReturnsTie.board.gameBoard[1][0] = "O"; + testReturnsTie.board.gameBoard[1][1] = "X"; + testReturnsTie.board.gameBoard[1][2] = "X"; + testReturnsTie.board.gameBoard[2][0] = "X"; + testReturnsTie.board.gameBoard[2][1] = "O"; + testReturnsTie.board.gameBoard[2][2] = "O"; + + it("should return tie if gameboard is full and no winner", function() { + expect(testReturnsTie.board.hasWon()).toEqual("tie"); + }); + + }); + + describe('aTie', function() { + var testYesATie = new Game(); + testYesATie.board.gameBoard[0][0] = "X"; + testYesATie.board.gameBoard[0][1] = "X"; + testYesATie.board.gameBoard[0][2] = "O"; + testYesATie.board.gameBoard[1][0] = "O"; + testYesATie.board.gameBoard[1][1] = "X"; + testYesATie.board.gameBoard[1][2] = "X"; + testYesATie.board.gameBoard[2][0] = "X"; + testYesATie.board.gameBoard[2][1] = "O"; + testYesATie.board.gameBoard[2][2] = "O"; + + it("should return true if no location has a value of null therefor the gameboard is full", function() { + expect(testYesATie.board.aTie()).toEqual(true); + }); + + var testNotATie = new Game(); + testNotATie.board.gameBoard[0][0] = "X"; + testNotATie.board.gameBoard[0][1] = "X"; + testNotATie.board.gameBoard[0][2] = null; + + + it("should return true if no location has a value of null therefor the gameboard is full", function() { + expect(testNotATie.board.aTie()).toEqual(false); + }); }); }); diff --git a/src/game.js b/src/game.js index fce50d0..7ab898f 100644 --- a/src/game.js +++ b/src/game.js @@ -4,30 +4,49 @@ var Game = function() { this.player2 = new Player2(); this.gameCounter = true; this.turnCounter = 0; + this.winner = null; console.log(this.board); console.log(this.player1); console.log(this.player2); }; Game.prototype.playTurn = function(row, column) { - // console.log(this.whichPlayer()); - var player = this.whichPlayer(); - // console.log(this.valid(row, column)); - if (this.valid(row, column)) { - this.board.gameBoard[row][column] = player.marker; - if (player == this.player1) { - this.gameCounter = false; - this.turnCounter++ ; + if(this.winner !== null) { + console.log("Game is Over " + this.winner.name + " won."); + return "Game is Over " + this.winner.name + " won."; + } else { + // console.log(this.whichPlayer()); + var player = this.whichPlayer(); + // console.log(this.valid(row, column)); + if (this.valid(row, column)) { + this.board.gameBoard[row][column] = player.marker; + + if (player == this.player1) { + this.gameCounter = false; + this.turnCounter++ ; + } else { + this.gameCounter = true; + this.turnCounter++ ; + } + + if(this.turnCounter >= 5) { + if(this.board.hasWon() === true) { + console.log(player + " you're the Winner!!!"); + this.winner = player; + return player.name; + } else if(this.board.hasWon() === "tie"){ + console.log("Cat's Game"); + return "Cat's Game, it's a tie."; + } + } + } else { - this.gameCounter = true; - this.turnCounter++ ; + console.log("That position is already taken, go Again"); } - } else { - console.log("That position is already taken, go Again"); + console.log(this.board.gameBoard); + console.log(this.gameCounter); + console.log(this.turnCounter); } - console.log(this.board.gameBoard); - console.log(this.gameCounter); - console.log(this.turnCounter); }; Game.prototype.whichPlayer = function() { @@ -80,18 +99,36 @@ GameBoard.prototype.hasWon = function () { console.log("true"); return true; } else { + if(this.aTie()){ + return "tie"; + } else { + return false; + } + } +}; + +GameBoard.prototype.aTie = function() { + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if((row0.includes(null)) || (row1.includes(null)) || (row2.includes(null))) { return false; + } else { + return true; } }; var Player1 = function() { this.marker = "X"; this.turnCounter = true; + this.name = "player1"; }; var Player2 = function() { this.marker = "O"; this.turnCounter = false; + this.name = "player2"; }; From 0b4ee9f4e406e026a4bc33d6c653e99a3503e582 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 13:46:34 -0800 Subject: [PATCH 11/40] fixed bug in valid function --- spec/game.spec.js | 2 +- src/game.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index e5d45c3..891d528 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -39,7 +39,7 @@ describe('Game', function() { testGame3.board.gameBoard[0][2] = "X"; it('should handle an invalid location entry appropriately', function() { - expect(testGame3.valid(4,4)).toEqual("that's not a valid location"); + expect(testGame3.valid(4,4)).toEqual(false); }); it('should return true if a location is unoccupied(still equal to null)', function() { diff --git a/src/game.js b/src/game.js index 7ab898f..289da91 100644 --- a/src/game.js +++ b/src/game.js @@ -6,8 +6,8 @@ var Game = function() { this.turnCounter = 0; this.winner = null; console.log(this.board); - console.log(this.player1); - console.log(this.player2); + // console.log(this.player1); + // console.log(this.player2); }; Game.prototype.playTurn = function(row, column) { @@ -35,15 +35,15 @@ Game.prototype.playTurn = function(row, column) { this.winner = player; return player.name; } else if(this.board.hasWon() === "tie"){ - console.log("Cat's Game"); - return "Cat's Game, it's a tie."; + console.log("Cat's Game, it's a tie."); + return "Cat's Game."; } } } else { console.log("That position is already taken, go Again"); } - console.log(this.board.gameBoard); + console.log(this.board); console.log(this.gameCounter); console.log(this.turnCounter); } @@ -60,7 +60,7 @@ Game.prototype.whichPlayer = function() { Game.prototype.valid = function(row,column) { if((row > 2) || (column > 2)) { console.log(row + "," + column + " is not a valid location"); - return "that's not a valid location"; + return false; } else { var locationValue = this.board.gameBoard[row][column]; console.log(locationValue); From f7026ed9f84485fcb701a6668d8d53c661d6920c Mon Sep 17 00:00:00 2001 From: Yasmin Date: Wed, 14 Dec 2016 14:18:39 -0800 Subject: [PATCH 12/40] WIP: playTurn and test in the event of a tie --- spec/game.spec.js | 15 +++++++++++++++ src/game.js | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index e5d45c3..eb4d0fd 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -100,6 +100,21 @@ describe('Game', function() { it('should return a Game Over if game is already won and you try to play a turn', function() { expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.winner.name + " won."); }); + + // var testTieResult = new Game(); + // testTieResult.board.gameBoard[0][0] = "X"; + // testTieResult.board.gameBoard[0][1] = "X"; + // testTieResult.board.gameBoard[0][2] = "O"; + // testTieResult.board.gameBoard[1][0] = "O"; + // testTieResult.board.gameBoard[1][1] = "X"; + // testTieResult.board.gameBoard[1][2] = "X"; + // testTieResult.board.gameBoard[2][0] = "X"; + // testTieResult.board.gameBoard[2][1] = "O"; + // // testTieResult.board.gameBoard[2][2] = "O"; + // + // it("should return a string (Cat's Game, it's a tie.) in the case of a tie", function() { + // expect(testTieResult.playTurn(2,2)).toEqual("Cat's Game, it's a tie."); + // }) }); }); diff --git a/src/game.js b/src/game.js index 7ab898f..70d26a9 100644 --- a/src/game.js +++ b/src/game.js @@ -36,7 +36,7 @@ Game.prototype.playTurn = function(row, column) { return player.name; } else if(this.board.hasWon() === "tie"){ console.log("Cat's Game"); - return "Cat's Game, it's a tie."; + // return "Cat's Game, it's a tie."; } } From 0cc67e0ccc8b4da573c4c0ce0f6be27e1213f244 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 14 Dec 2016 15:12:43 -0800 Subject: [PATCH 13/40] added test to capture 3 nulls in a row bug but code still has bug --- spec/game.spec.js | 14 ++++++++++++++ src/game.js | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index e6d2c14..a51b2c5 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -176,6 +176,20 @@ describe('GameBoard', function() { expect(testColumn2.board.hasWon()).toEqual(true); }); + //>>>> + var test3Nulls = new Game(); + test3Nulls.playTurn(1,2); + test3Nulls.playTurn(0,0); + test3Nulls.playTurn(2,0); + test3Nulls.playTurn(1,2); + test3Nulls.playTurn(0,2); + test3Nulls.playTurn(2,2); + it('should return false if a player has not won but there have been 5 rounds and there are 3 nulls in a row', function() { + console.log(test3Nulls.winner.name); + + expect(test3Nulls.board.hasWon()).toEqual(false); + }); + //Diagonals var testDiag1 = new Game(); testDiag1.board.gameBoard[0][0] = "X"; diff --git a/src/game.js b/src/game.js index 289da91..c5de1d3 100644 --- a/src/game.js +++ b/src/game.js @@ -31,12 +31,12 @@ Game.prototype.playTurn = function(row, column) { if(this.turnCounter >= 5) { if(this.board.hasWon() === true) { - console.log(player + " you're the Winner!!!"); + console.log(player.name + " you're the Winner!!!"); this.winner = player; - return player.name; - } else if(this.board.hasWon() === "tie"){ + // return player.name; + } else if(this.board.hasWon() === "tie") { console.log("Cat's Game, it's a tie."); - return "Cat's Game."; + // return "Cat's Game."; } } @@ -44,8 +44,8 @@ Game.prototype.playTurn = function(row, column) { console.log("That position is already taken, go Again"); } console.log(this.board); - console.log(this.gameCounter); - console.log(this.turnCounter); + console.log("who's turn: " + this.gameCounter); + console.log("round number: " + this.turnCounter); } }; @@ -63,7 +63,7 @@ Game.prototype.valid = function(row,column) { return false; } else { var locationValue = this.board.gameBoard[row][column]; - console.log(locationValue); + console.log("in valid, location value = " + locationValue); if (locationValue != 'X' && locationValue != 'O') { return true; } else { @@ -79,24 +79,41 @@ var GameBoard = function() { this.gameBoard[2] = [ null, null, null]; }; -GameBoard.prototype.hasWon = function () { +GameBoard.prototype.hasWon = function() { // var board = this.gameBoard; var row0 = this.gameBoard[0]; var row1 = this.gameBoard[1]; var row2 = this.gameBoard[2]; + //rows if ((row0[0] == row0[1] && row0[1] == row0[2]) || (row1[0] == row1[1] && row1[1] == row1[2]) || (row2[0] == row2[1] && row2[1] == row2[2])) { - console.log("true"); + console.log("is there a winner1: " + true); return true; + + //columns } else if ((row0[0] == row1[0] && row1[0] == row2[0]) || (row0[1] == row1[1] && row1[1] == row2[1]) || (row0[2] == row1[2] && row1[2] == row2[2])) { - console.log("true"); + console.log("00 " + row0[0]); + console.log("10 " + row1[0]); + console.log("20 " + row2[0]); + + console.log("01 " + row0[1]); + console.log("11 " + row1[1]); + console.log("21 " + row2[1]); + + console.log("02 " + row0[2]); + console.log("12 " + row1[2]); + console.log("22 " + row2[2]); + + console.log("is there a winner2: " + true); return true; + + //Diagonals } else if ((row0[0] == row1[1] && row1[1] == row2[2]) || (row0[2] == row1[1] && row1[1] == row2[0])) { - console.log("true"); + console.log("is there a winner3: " + true); return true; } else { if(this.aTie()){ From 1e52381986cb86c8531e12986a39c5b3f92fb920 Mon Sep 17 00:00:00 2001 From: Yasmin Date: Wed, 14 Dec 2016 15:15:53 -0800 Subject: [PATCH 14/40] found the bug in hasWon --- spec/game.spec.js | 12 ++++++++++++ src/game.js | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index e6d2c14..b0f80f5 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -195,6 +195,18 @@ describe('GameBoard', function() { expect(testDiag2.board.hasWon()).toEqual(true); }); + //Buggy situation + var findBug = new Game(); + findBug.board.gameBoard[0][0] = "O"; + findBug.board.gameBoard[0][2] = "O"; + findBug.board.gameBoard[2][0] = "X"; + findBug.board.gameBoard[2][2] = "X"; + findBug.board.gameBoard[1][2] = "X"; + + it('should return false when a player hasnt won', function() { + expect(findBug.board.hasWon()).toEqual(false); + }) + var hasNotWonGame = new Game(); hasNotWonGame.board.gameBoard[0][2] = "X"; hasNotWonGame.board.gameBoard[1][1] = "X"; diff --git a/src/game.js b/src/game.js index 289da91..a3855bc 100644 --- a/src/game.js +++ b/src/game.js @@ -85,18 +85,18 @@ GameBoard.prototype.hasWon = function () { var row1 = this.gameBoard[1]; var row2 = this.gameBoard[2]; - if ((row0[0] == row0[1] && row0[1] == row0[2]) || - (row1[0] == row1[1] && row1[1] == row1[2]) || - (row2[0] == row2[1] && row2[1] == row2[2])) { - console.log("true"); + if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] != null) || + (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] != null) || + (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] != null)) { + console.log("Winner in a row"); return true; - } else if ((row0[0] == row1[0] && row1[0] == row2[0]) || - (row0[1] == row1[1] && row1[1] == row2[1]) || - (row0[2] == row1[2] && row1[2] == row2[2])) { - console.log("true"); + } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] != null) || + (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] != null) || + (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] != null)) { + console.log("Winner in a column"); return true; - } else if ((row0[0] == row1[1] && row1[1] == row2[2]) || (row0[2] == row1[1] && row1[1] == row2[0])) { - console.log("true"); + } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] != null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] != null)) { + console.log("Winner in a diagonal"); return true; } else { if(this.aTie()){ From 7b4e1f60e588b9060ed4f0d9aceef24938deffc6 Mon Sep 17 00:00:00 2001 From: Yasmin Date: Wed, 14 Dec 2016 15:24:51 -0800 Subject: [PATCH 15/40] Tests are passing --- spec/game.spec.js | 3 +-- src/game.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 0e1cacd..79c7a99 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -185,8 +185,7 @@ describe('GameBoard', function() { test3Nulls.playTurn(0,2); test3Nulls.playTurn(2,2); it('should return false if a player has not won but there have been 5 rounds and there are 3 nulls in a row', function() { - console.log(test3Nulls.winner.name); - + expect(test3Nulls.winner).toEqual(null); expect(test3Nulls.board.hasWon()).toEqual(false); }); diff --git a/src/game.js b/src/game.js index b64d92f..74714e3 100644 --- a/src/game.js +++ b/src/game.js @@ -31,9 +31,9 @@ Game.prototype.playTurn = function(row, column) { if(this.turnCounter >= 5) { if(this.board.hasWon() === true) { - console.log(player.name + " you're the Winner!!!"); + console.log(player + " you're the Winner!!!"); this.winner = player; - // return player.name; + return player.name; } else if(this.board.hasWon() === "tie") { console.log("Cat's Game, it's a tie."); // return "Cat's Game."; From 7caaa29eaef6ce394241b70d1a93071c1d0abcae Mon Sep 17 00:00:00 2001 From: Yasmin Date: Wed, 14 Dec 2016 15:44:15 -0800 Subject: [PATCH 16/40] Deleted an unnecessary test after changing playTurn in the event of a tie --- spec/game.spec.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 79c7a99..19f5e3c 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -100,21 +100,6 @@ describe('Game', function() { it('should return a Game Over if game is already won and you try to play a turn', function() { expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.winner.name + " won."); }); - - // var testTieResult = new Game(); - // testTieResult.board.gameBoard[0][0] = "X"; - // testTieResult.board.gameBoard[0][1] = "X"; - // testTieResult.board.gameBoard[0][2] = "O"; - // testTieResult.board.gameBoard[1][0] = "O"; - // testTieResult.board.gameBoard[1][1] = "X"; - // testTieResult.board.gameBoard[1][2] = "X"; - // testTieResult.board.gameBoard[2][0] = "X"; - // testTieResult.board.gameBoard[2][1] = "O"; - // // testTieResult.board.gameBoard[2][2] = "O"; - // - // it("should return a string (Cat's Game, it's a tie.) in the case of a tie", function() { - // expect(testTieResult.playTurn(2,2)).toEqual("Cat's Game, it's a tie."); - // }) }); }); From 74a99dbbfd9b2c6feb3fa20769107ea0019a4295 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Fri, 16 Dec 2016 14:44:12 -0800 Subject: [PATCH 17/40] added extra = to != in has won function --- src/game.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game.js b/src/game.js index 74714e3..83811c9 100644 --- a/src/game.js +++ b/src/game.js @@ -85,17 +85,17 @@ GameBoard.prototype.hasWon = function() { var row1 = this.gameBoard[1]; var row2 = this.gameBoard[2]; - if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] != null) || - (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] != null) || - (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] != null)) { + if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== null) || + (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== null) || + (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== null)) { console.log("Winner in a row"); return true; - } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] != null) || - (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] != null) || - (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] != null)) { + } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== null) || + (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== null) || + (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== null)) { console.log("Winner in a column"); return true; - } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] != null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] != null)) { + } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== null)) { console.log("Winner in a diagonal"); return true; } else { From 5941707bc577653757c9f3b3ac750481f1e95d46 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Fri, 16 Dec 2016 15:06:56 -0800 Subject: [PATCH 18/40] file structure set up --- src/.keep | 0 src/app/app.js | 8 ++ src/{ => app/models}/game.js | 0 src/app/views/app_view.js | 3 + src/app/views/game_view.js | 3 + src/app/views/player_view.js | 3 + src/app/views/space_board_view.js | 3 + src/app/views/space_view.js | 4 + src/backup.js | 136 ++++++++++++++++++++++++++++++ 9 files changed, 160 insertions(+) delete mode 100644 src/.keep create mode 100644 src/app/app.js rename src/{ => app/models}/game.js (100%) create mode 100644 src/app/views/app_view.js create mode 100644 src/app/views/game_view.js create mode 100644 src/app/views/player_view.js create mode 100644 src/app/views/space_board_view.js create mode 100644 src/app/views/space_view.js create mode 100644 src/backup.js diff --git a/src/.keep b/src/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/app.js b/src/app/app.js new file mode 100644 index 0000000..f61b010 --- /dev/null +++ b/src/app/app.js @@ -0,0 +1,8 @@ +// import Application from 'app/models/application'; **** DO WE NEED THIS???? +import ApplicationView from 'app/views/app_view'; +import $ from 'jquery'; + + +$(document).ready(function() { + +}); diff --git a/src/game.js b/src/app/models/game.js similarity index 100% rename from src/game.js rename to src/app/models/game.js diff --git a/src/app/views/app_view.js b/src/app/views/app_view.js new file mode 100644 index 0000000..12c5123 --- /dev/null +++ b/src/app/views/app_view.js @@ -0,0 +1,3 @@ + + +export default AppView; diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js new file mode 100644 index 0000000..5031919 --- /dev/null +++ b/src/app/views/game_view.js @@ -0,0 +1,3 @@ + + +export default GameView; diff --git a/src/app/views/player_view.js b/src/app/views/player_view.js new file mode 100644 index 0000000..723f6bd --- /dev/null +++ b/src/app/views/player_view.js @@ -0,0 +1,3 @@ + + +export default PlayerView; diff --git a/src/app/views/space_board_view.js b/src/app/views/space_board_view.js new file mode 100644 index 0000000..3294ccd --- /dev/null +++ b/src/app/views/space_board_view.js @@ -0,0 +1,3 @@ + + +export default SpaceBoardView; diff --git a/src/app/views/space_view.js b/src/app/views/space_view.js new file mode 100644 index 0000000..fc0e128 --- /dev/null +++ b/src/app/views/space_view.js @@ -0,0 +1,4 @@ + + + +export default SpaceView; diff --git a/src/backup.js b/src/backup.js new file mode 100644 index 0000000..83811c9 --- /dev/null +++ b/src/backup.js @@ -0,0 +1,136 @@ +var Game = function() { + this.board = new GameBoard(); + this.player1 = new Player1(); + this.player2 = new Player2(); + this.gameCounter = true; + this.turnCounter = 0; + this.winner = null; + console.log(this.board); + // console.log(this.player1); + // console.log(this.player2); +}; + +Game.prototype.playTurn = function(row, column) { + if(this.winner !== null) { + console.log("Game is Over " + this.winner.name + " won."); + return "Game is Over " + this.winner.name + " won."; + } else { + // console.log(this.whichPlayer()); + var player = this.whichPlayer(); + // console.log(this.valid(row, column)); + if (this.valid(row, column)) { + this.board.gameBoard[row][column] = player.marker; + + if (player == this.player1) { + this.gameCounter = false; + this.turnCounter++ ; + } else { + this.gameCounter = true; + this.turnCounter++ ; + } + + if(this.turnCounter >= 5) { + if(this.board.hasWon() === true) { + console.log(player + " you're the Winner!!!"); + this.winner = player; + return player.name; + } else if(this.board.hasWon() === "tie") { + console.log("Cat's Game, it's a tie."); + // return "Cat's Game."; + } + } + + } else { + console.log("That position is already taken, go Again"); + } + console.log(this.board); + console.log("who's turn: " + this.gameCounter); + console.log("round number: " + this.turnCounter); + } +}; + +Game.prototype.whichPlayer = function() { + if (this.gameCounter === true) { + return this.player1; + } else { + return this.player2; + } +}; + +Game.prototype.valid = function(row,column) { + if((row > 2) || (column > 2)) { + console.log(row + "," + column + " is not a valid location"); + return false; + } else { + var locationValue = this.board.gameBoard[row][column]; + console.log("in valid, location value = " + locationValue); + if (locationValue != 'X' && locationValue != 'O') { + return true; + } else { + return false; + } + } +}; + +var GameBoard = function() { + this.gameBoard = []; + this.gameBoard[0] = [ null, null, null]; + this.gameBoard[1] = [ null, null, null]; + this.gameBoard[2] = [ null, null, null]; +}; + +GameBoard.prototype.hasWon = function() { + // var board = this.gameBoard; + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== null) || + (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== null) || + (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== null)) { + console.log("Winner in a row"); + return true; + } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== null) || + (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== null) || + (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== null)) { + console.log("Winner in a column"); + return true; + } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== null)) { + console.log("Winner in a diagonal"); + return true; + } else { + if(this.aTie()){ + return "tie"; + } else { + return false; + } + } +}; + +GameBoard.prototype.aTie = function() { + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if((row0.includes(null)) || (row1.includes(null)) || (row2.includes(null))) { + return false; + } else { + return true; + } +}; + +var Player1 = function() { + this.marker = "X"; + this.turnCounter = true; + this.name = "player1"; +}; + +var Player2 = function() { + this.marker = "O"; + this.turnCounter = false; + this.name = "player2"; +}; + + +// DO NOT REMOVE THIS +export default Game; From 16cb0eb8efd2acda04806f24b606adcf42d00d4a Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Fri, 16 Dec 2016 15:09:01 -0800 Subject: [PATCH 19/40] moved app.js to src folder from app folder --- src/{app => }/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/{app => }/app.js (72%) diff --git a/src/app/app.js b/src/app.js similarity index 72% rename from src/app/app.js rename to src/app.js index f61b010..32a0404 100644 --- a/src/app/app.js +++ b/src/app.js @@ -1,5 +1,5 @@ // import Application from 'app/models/application'; **** DO WE NEED THIS???? -import ApplicationView from 'app/views/app_view'; +// import ApplicationView from 'app/views/app_view'; import $ from 'jquery'; From e8557da5f014c9f1c7a9d2435e0b842ba06a0bc8 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Fri, 16 Dec 2016 16:01:46 -0800 Subject: [PATCH 20/40] working on css and html for index page --- build/css/app.css | 32 + build/css/foundation.css | 4226 ++++++++++++++++++++++++++++++++++++++ build/index.html | 60 + 3 files changed, 4318 insertions(+) create mode 100644 build/css/app.css create mode 100644 build/css/foundation.css diff --git a/build/css/app.css b/build/css/app.css new file mode 100644 index 0000000..4370887 --- /dev/null +++ b/build/css/app.css @@ -0,0 +1,32 @@ + +body { + /*background-color: blacks; + color: white; + font-family: 'Nunito Sans', sans-serif;*/ +} + +h1 { + font-size: 36px; +} + +#space-board-view { + width: 35%; + text-align: center; +} + +table { + border-collapse: collapse; + border-style: hidden; +} + +table td { + border: 1px solid black; +} + +table tr:nth-of-type(even) { + background-color: transparent !important; +} + +td { + font-size: 600%; +} diff --git a/build/css/foundation.css b/build/css/foundation.css new file mode 100644 index 0000000..c59eaf5 --- /dev/null +++ b/build/css/foundation.css @@ -0,0 +1,4226 @@ +@charset "UTF-8"; +/** + * Foundation for Sites by ZURB + * Version 6.2.4 + * foundation.zurb.com + * Licensed under MIT Open Source + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS and IE text size adjust after device orientation change, + * without disabling user zoom. + */ +html { + font-family: sans-serif; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ } + +/** + * Remove default margin. + */ +body { + margin: 0; } + +/* HTML5 display definitions + ========================================================================== */ +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; } + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ + vertical-align: baseline; + /* 2 */ } + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +audio:not([controls]) { + display: none; + height: 0; } + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. + */ +[hidden], +template { + display: none; } + +/* Links + ========================================================================== */ +/** + * Remove the gray background color from active links in IE 10. + */ +a { + background-color: transparent; } + +/** + * Improve readability of focused elements when they are also in an + * active/hover state. + */ +a:active, +a:hover { + outline: 0; } + +/* Text-level semantics + ========================================================================== */ +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ +abbr[title] { + border-bottom: 1px dotted; } + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ +b, +strong { + font-weight: bold; } + +/** + * Address styling not present in Safari and Chrome. + */ +dfn { + font-style: italic; } + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ +h1 { + font-size: 2em; + margin: 0.67em 0; } + +/** + * Address styling not present in IE 8/9. + */ +mark { + background: #ff0; + color: #000; } + +/** + * Address inconsistent and variable font size in all browsers. + */ +small { + font-size: 80%; } + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +/* Embedded content + ========================================================================== */ +/** + * Remove border when inside `a` element in IE 8/9/10. + */ +img { + border: 0; } + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +svg:not(:root) { + overflow: hidden; } + +/* Grouping content + ========================================================================== */ +/** + * Address margin not present in IE 8/9 and Safari. + */ +figure { + margin: 1em 40px; } + +/** + * Address differences between Firefox and other browsers. + */ +hr { + box-sizing: content-box; + height: 0; } + +/** + * Contain overflow in all browsers. + */ +pre { + overflow: auto; } + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; } + +/* Forms + ========================================================================== */ +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +button, +input, +optgroup, +select, +textarea { + color: inherit; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ } + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +button { + overflow: visible; } + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +button, +select { + text-transform: none; } + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ } + +/** + * Re-set default cursor for disabled elements. + */ +button[disabled], +html input[disabled] { + cursor: not-allowed; } + +/** + * Remove inner padding and border in Firefox 4+. + */ +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; } + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ +input { + line-height: normal; } + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; } + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. + */ +input[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + box-sizing: content-box; + /* 2 */ } + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +/** + * Define consistent border, margin, and padding. + * [NOTE] We don't enable this ruleset in Foundation, because we want the
element to have plain styling. + */ +/* fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; + } */ +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ +legend { + border: 0; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ +textarea { + overflow: auto; } + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +optgroup { + font-weight: bold; } + +/* Tables + ========================================================================== */ +/** + * Remove most spacing between table cells. + */ +table { + border-collapse: collapse; + border-spacing: 0; } + +td, +th { + padding: 0; } + +.foundation-mq { + font-family: "small=0em&medium=40em&large=64em&xlarge=75em&xxlarge=90em"; } + +html { + font-size: 100%; + box-sizing: border-box; } + +*, +*::before, +*::after { + box-sizing: inherit; } + +body { + padding: 0; + margin: 0; + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: normal; + line-height: 1.5; + color: #0a0a0a; + background: #fefefe; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } + +img { + max-width: 100%; + height: auto; + -ms-interpolation-mode: bicubic; + display: inline-block; + vertical-align: middle; } + +textarea { + height: auto; + min-height: 50px; + border-radius: 0; } + +select { + width: 100%; + border-radius: 0; } + +#map_canvas img, +#map_canvas embed, +#map_canvas object, +.map_canvas img, +.map_canvas embed, +.map_canvas object, +.mqa-display img, +.mqa-display embed, +.mqa-display object { + max-width: none !important; } + +button { + -webkit-appearance: none; + -moz-appearance: none; + background: transparent; + padding: 0; + border: 0; + border-radius: 0; + line-height: 1; } + [data-whatinput='mouse'] button { + outline: 0; } + +.is-visible { + display: block !important; } + +.is-hidden { + display: none !important; } + +.row { + max-width: 75rem; + margin-left: auto; + margin-right: auto; } + .row::before, .row::after { + content: ' '; + display: table; } + .row::after { + clear: both; } + .row.collapse > .column, .row.collapse > .columns { + padding-left: 0; + padding-right: 0; } + .row .row { + margin-left: -0.625rem; + margin-right: -0.625rem; } + @media screen and (min-width: 40em) { + .row .row { + margin-left: -0.9375rem; + margin-right: -0.9375rem; } } + .row .row.collapse { + margin-left: 0; + margin-right: 0; } + .row.expanded { + max-width: none; } + .row.expanded .row { + margin-left: auto; + margin-right: auto; } + +.column, .columns { + width: 100%; + float: left; + padding-left: 0.625rem; + padding-right: 0.625rem; } + @media screen and (min-width: 40em) { + .column, .columns { + padding-left: 0.9375rem; + padding-right: 0.9375rem; } } + .column:last-child:not(:first-child), .columns:last-child:not(:first-child) { + float: right; } + .column.end:last-child:last-child, .end.columns:last-child:last-child { + float: left; } + +.column.row.row, .row.row.columns { + float: none; } + +.row .column.row.row, .row .row.row.columns { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; } + +.small-1 { + width: 8.33333%; } + +.small-push-1 { + position: relative; + left: 8.33333%; } + +.small-pull-1 { + position: relative; + left: -8.33333%; } + +.small-offset-0 { + margin-left: 0%; } + +.small-2 { + width: 16.66667%; } + +.small-push-2 { + position: relative; + left: 16.66667%; } + +.small-pull-2 { + position: relative; + left: -16.66667%; } + +.small-offset-1 { + margin-left: 8.33333%; } + +.small-3 { + width: 25%; } + +.small-push-3 { + position: relative; + left: 25%; } + +.small-pull-3 { + position: relative; + left: -25%; } + +.small-offset-2 { + margin-left: 16.66667%; } + +.small-4 { + width: 33.33333%; } + +.small-push-4 { + position: relative; + left: 33.33333%; } + +.small-pull-4 { + position: relative; + left: -33.33333%; } + +.small-offset-3 { + margin-left: 25%; } + +.small-5 { + width: 41.66667%; } + +.small-push-5 { + position: relative; + left: 41.66667%; } + +.small-pull-5 { + position: relative; + left: -41.66667%; } + +.small-offset-4 { + margin-left: 33.33333%; } + +.small-6 { + width: 50%; } + +.small-push-6 { + position: relative; + left: 50%; } + +.small-pull-6 { + position: relative; + left: -50%; } + +.small-offset-5 { + margin-left: 41.66667%; } + +.small-7 { + width: 58.33333%; } + +.small-push-7 { + position: relative; + left: 58.33333%; } + +.small-pull-7 { + position: relative; + left: -58.33333%; } + +.small-offset-6 { + margin-left: 50%; } + +.small-8 { + width: 66.66667%; } + +.small-push-8 { + position: relative; + left: 66.66667%; } + +.small-pull-8 { + position: relative; + left: -66.66667%; } + +.small-offset-7 { + margin-left: 58.33333%; } + +.small-9 { + width: 75%; } + +.small-push-9 { + position: relative; + left: 75%; } + +.small-pull-9 { + position: relative; + left: -75%; } + +.small-offset-8 { + margin-left: 66.66667%; } + +.small-10 { + width: 83.33333%; } + +.small-push-10 { + position: relative; + left: 83.33333%; } + +.small-pull-10 { + position: relative; + left: -83.33333%; } + +.small-offset-9 { + margin-left: 75%; } + +.small-11 { + width: 91.66667%; } + +.small-push-11 { + position: relative; + left: 91.66667%; } + +.small-pull-11 { + position: relative; + left: -91.66667%; } + +.small-offset-10 { + margin-left: 83.33333%; } + +.small-12 { + width: 100%; } + +.small-offset-11 { + margin-left: 91.66667%; } + +.small-up-1 > .column, .small-up-1 > .columns { + width: 100%; + float: left; } + .small-up-1 > .column:nth-of-type(1n), .small-up-1 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-1 > .column:nth-of-type(1n+1), .small-up-1 > .columns:nth-of-type(1n+1) { + clear: both; } + .small-up-1 > .column:last-child, .small-up-1 > .columns:last-child { + float: left; } + +.small-up-2 > .column, .small-up-2 > .columns { + width: 50%; + float: left; } + .small-up-2 > .column:nth-of-type(1n), .small-up-2 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-2 > .column:nth-of-type(2n+1), .small-up-2 > .columns:nth-of-type(2n+1) { + clear: both; } + .small-up-2 > .column:last-child, .small-up-2 > .columns:last-child { + float: left; } + +.small-up-3 > .column, .small-up-3 > .columns { + width: 33.33333%; + float: left; } + .small-up-3 > .column:nth-of-type(1n), .small-up-3 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-3 > .column:nth-of-type(3n+1), .small-up-3 > .columns:nth-of-type(3n+1) { + clear: both; } + .small-up-3 > .column:last-child, .small-up-3 > .columns:last-child { + float: left; } + +.small-up-4 > .column, .small-up-4 > .columns { + width: 25%; + float: left; } + .small-up-4 > .column:nth-of-type(1n), .small-up-4 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-4 > .column:nth-of-type(4n+1), .small-up-4 > .columns:nth-of-type(4n+1) { + clear: both; } + .small-up-4 > .column:last-child, .small-up-4 > .columns:last-child { + float: left; } + +.small-up-5 > .column, .small-up-5 > .columns { + width: 20%; + float: left; } + .small-up-5 > .column:nth-of-type(1n), .small-up-5 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-5 > .column:nth-of-type(5n+1), .small-up-5 > .columns:nth-of-type(5n+1) { + clear: both; } + .small-up-5 > .column:last-child, .small-up-5 > .columns:last-child { + float: left; } + +.small-up-6 > .column, .small-up-6 > .columns { + width: 16.66667%; + float: left; } + .small-up-6 > .column:nth-of-type(1n), .small-up-6 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-6 > .column:nth-of-type(6n+1), .small-up-6 > .columns:nth-of-type(6n+1) { + clear: both; } + .small-up-6 > .column:last-child, .small-up-6 > .columns:last-child { + float: left; } + +.small-up-7 > .column, .small-up-7 > .columns { + width: 14.28571%; + float: left; } + .small-up-7 > .column:nth-of-type(1n), .small-up-7 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-7 > .column:nth-of-type(7n+1), .small-up-7 > .columns:nth-of-type(7n+1) { + clear: both; } + .small-up-7 > .column:last-child, .small-up-7 > .columns:last-child { + float: left; } + +.small-up-8 > .column, .small-up-8 > .columns { + width: 12.5%; + float: left; } + .small-up-8 > .column:nth-of-type(1n), .small-up-8 > .columns:nth-of-type(1n) { + clear: none; } + .small-up-8 > .column:nth-of-type(8n+1), .small-up-8 > .columns:nth-of-type(8n+1) { + clear: both; } + .small-up-8 > .column:last-child, .small-up-8 > .columns:last-child { + float: left; } + +.small-collapse > .column, .small-collapse > .columns { + padding-left: 0; + padding-right: 0; } + +.small-collapse .row { + margin-left: 0; + margin-right: 0; } + +.expanded.row .small-collapse.row { + margin-left: 0; + margin-right: 0; } + +.small-uncollapse > .column, .small-uncollapse > .columns { + padding-left: 0.625rem; + padding-right: 0.625rem; } + +.small-centered { + margin-left: auto; + margin-right: auto; } + .small-centered, .small-centered:last-child:not(:first-child) { + float: none; + clear: both; } + +.small-uncentered, +.small-push-0, +.small-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } + +@media screen and (min-width: 40em) { + .medium-1 { + width: 8.33333%; } + .medium-push-1 { + position: relative; + left: 8.33333%; } + .medium-pull-1 { + position: relative; + left: -8.33333%; } + .medium-offset-0 { + margin-left: 0%; } + .medium-2 { + width: 16.66667%; } + .medium-push-2 { + position: relative; + left: 16.66667%; } + .medium-pull-2 { + position: relative; + left: -16.66667%; } + .medium-offset-1 { + margin-left: 8.33333%; } + .medium-3 { + width: 25%; } + .medium-push-3 { + position: relative; + left: 25%; } + .medium-pull-3 { + position: relative; + left: -25%; } + .medium-offset-2 { + margin-left: 16.66667%; } + .medium-4 { + width: 33.33333%; } + .medium-push-4 { + position: relative; + left: 33.33333%; } + .medium-pull-4 { + position: relative; + left: -33.33333%; } + .medium-offset-3 { + margin-left: 25%; } + .medium-5 { + width: 41.66667%; } + .medium-push-5 { + position: relative; + left: 41.66667%; } + .medium-pull-5 { + position: relative; + left: -41.66667%; } + .medium-offset-4 { + margin-left: 33.33333%; } + .medium-6 { + width: 50%; } + .medium-push-6 { + position: relative; + left: 50%; } + .medium-pull-6 { + position: relative; + left: -50%; } + .medium-offset-5 { + margin-left: 41.66667%; } + .medium-7 { + width: 58.33333%; } + .medium-push-7 { + position: relative; + left: 58.33333%; } + .medium-pull-7 { + position: relative; + left: -58.33333%; } + .medium-offset-6 { + margin-left: 50%; } + .medium-8 { + width: 66.66667%; } + .medium-push-8 { + position: relative; + left: 66.66667%; } + .medium-pull-8 { + position: relative; + left: -66.66667%; } + .medium-offset-7 { + margin-left: 58.33333%; } + .medium-9 { + width: 75%; } + .medium-push-9 { + position: relative; + left: 75%; } + .medium-pull-9 { + position: relative; + left: -75%; } + .medium-offset-8 { + margin-left: 66.66667%; } + .medium-10 { + width: 83.33333%; } + .medium-push-10 { + position: relative; + left: 83.33333%; } + .medium-pull-10 { + position: relative; + left: -83.33333%; } + .medium-offset-9 { + margin-left: 75%; } + .medium-11 { + width: 91.66667%; } + .medium-push-11 { + position: relative; + left: 91.66667%; } + .medium-pull-11 { + position: relative; + left: -91.66667%; } + .medium-offset-10 { + margin-left: 83.33333%; } + .medium-12 { + width: 100%; } + .medium-offset-11 { + margin-left: 91.66667%; } + .medium-up-1 > .column, .medium-up-1 > .columns { + width: 100%; + float: left; } + .medium-up-1 > .column:nth-of-type(1n), .medium-up-1 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-1 > .column:nth-of-type(1n+1), .medium-up-1 > .columns:nth-of-type(1n+1) { + clear: both; } + .medium-up-1 > .column:last-child, .medium-up-1 > .columns:last-child { + float: left; } + .medium-up-2 > .column, .medium-up-2 > .columns { + width: 50%; + float: left; } + .medium-up-2 > .column:nth-of-type(1n), .medium-up-2 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-2 > .column:nth-of-type(2n+1), .medium-up-2 > .columns:nth-of-type(2n+1) { + clear: both; } + .medium-up-2 > .column:last-child, .medium-up-2 > .columns:last-child { + float: left; } + .medium-up-3 > .column, .medium-up-3 > .columns { + width: 33.33333%; + float: left; } + .medium-up-3 > .column:nth-of-type(1n), .medium-up-3 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-3 > .column:nth-of-type(3n+1), .medium-up-3 > .columns:nth-of-type(3n+1) { + clear: both; } + .medium-up-3 > .column:last-child, .medium-up-3 > .columns:last-child { + float: left; } + .medium-up-4 > .column, .medium-up-4 > .columns { + width: 25%; + float: left; } + .medium-up-4 > .column:nth-of-type(1n), .medium-up-4 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-4 > .column:nth-of-type(4n+1), .medium-up-4 > .columns:nth-of-type(4n+1) { + clear: both; } + .medium-up-4 > .column:last-child, .medium-up-4 > .columns:last-child { + float: left; } + .medium-up-5 > .column, .medium-up-5 > .columns { + width: 20%; + float: left; } + .medium-up-5 > .column:nth-of-type(1n), .medium-up-5 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-5 > .column:nth-of-type(5n+1), .medium-up-5 > .columns:nth-of-type(5n+1) { + clear: both; } + .medium-up-5 > .column:last-child, .medium-up-5 > .columns:last-child { + float: left; } + .medium-up-6 > .column, .medium-up-6 > .columns { + width: 16.66667%; + float: left; } + .medium-up-6 > .column:nth-of-type(1n), .medium-up-6 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-6 > .column:nth-of-type(6n+1), .medium-up-6 > .columns:nth-of-type(6n+1) { + clear: both; } + .medium-up-6 > .column:last-child, .medium-up-6 > .columns:last-child { + float: left; } + .medium-up-7 > .column, .medium-up-7 > .columns { + width: 14.28571%; + float: left; } + .medium-up-7 > .column:nth-of-type(1n), .medium-up-7 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-7 > .column:nth-of-type(7n+1), .medium-up-7 > .columns:nth-of-type(7n+1) { + clear: both; } + .medium-up-7 > .column:last-child, .medium-up-7 > .columns:last-child { + float: left; } + .medium-up-8 > .column, .medium-up-8 > .columns { + width: 12.5%; + float: left; } + .medium-up-8 > .column:nth-of-type(1n), .medium-up-8 > .columns:nth-of-type(1n) { + clear: none; } + .medium-up-8 > .column:nth-of-type(8n+1), .medium-up-8 > .columns:nth-of-type(8n+1) { + clear: both; } + .medium-up-8 > .column:last-child, .medium-up-8 > .columns:last-child { + float: left; } + .medium-collapse > .column, .medium-collapse > .columns { + padding-left: 0; + padding-right: 0; } + .medium-collapse .row { + margin-left: 0; + margin-right: 0; } + .expanded.row .medium-collapse.row { + margin-left: 0; + margin-right: 0; } + .medium-uncollapse > .column, .medium-uncollapse > .columns { + padding-left: 0.9375rem; + padding-right: 0.9375rem; } + .medium-centered { + margin-left: auto; + margin-right: auto; } + .medium-centered, .medium-centered:last-child:not(:first-child) { + float: none; + clear: both; } + .medium-uncentered, + .medium-push-0, + .medium-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } } + +@media screen and (min-width: 64em) { + .large-1 { + width: 8.33333%; } + .large-push-1 { + position: relative; + left: 8.33333%; } + .large-pull-1 { + position: relative; + left: -8.33333%; } + .large-offset-0 { + margin-left: 0%; } + .large-2 { + width: 16.66667%; } + .large-push-2 { + position: relative; + left: 16.66667%; } + .large-pull-2 { + position: relative; + left: -16.66667%; } + .large-offset-1 { + margin-left: 8.33333%; } + .large-3 { + width: 25%; } + .large-push-3 { + position: relative; + left: 25%; } + .large-pull-3 { + position: relative; + left: -25%; } + .large-offset-2 { + margin-left: 16.66667%; } + .large-4 { + width: 33.33333%; } + .large-push-4 { + position: relative; + left: 33.33333%; } + .large-pull-4 { + position: relative; + left: -33.33333%; } + .large-offset-3 { + margin-left: 25%; } + .large-5 { + width: 41.66667%; } + .large-push-5 { + position: relative; + left: 41.66667%; } + .large-pull-5 { + position: relative; + left: -41.66667%; } + .large-offset-4 { + margin-left: 33.33333%; } + .large-6 { + width: 50%; } + .large-push-6 { + position: relative; + left: 50%; } + .large-pull-6 { + position: relative; + left: -50%; } + .large-offset-5 { + margin-left: 41.66667%; } + .large-7 { + width: 58.33333%; } + .large-push-7 { + position: relative; + left: 58.33333%; } + .large-pull-7 { + position: relative; + left: -58.33333%; } + .large-offset-6 { + margin-left: 50%; } + .large-8 { + width: 66.66667%; } + .large-push-8 { + position: relative; + left: 66.66667%; } + .large-pull-8 { + position: relative; + left: -66.66667%; } + .large-offset-7 { + margin-left: 58.33333%; } + .large-9 { + width: 75%; } + .large-push-9 { + position: relative; + left: 75%; } + .large-pull-9 { + position: relative; + left: -75%; } + .large-offset-8 { + margin-left: 66.66667%; } + .large-10 { + width: 83.33333%; } + .large-push-10 { + position: relative; + left: 83.33333%; } + .large-pull-10 { + position: relative; + left: -83.33333%; } + .large-offset-9 { + margin-left: 75%; } + .large-11 { + width: 91.66667%; } + .large-push-11 { + position: relative; + left: 91.66667%; } + .large-pull-11 { + position: relative; + left: -91.66667%; } + .large-offset-10 { + margin-left: 83.33333%; } + .large-12 { + width: 100%; } + .large-offset-11 { + margin-left: 91.66667%; } + .large-up-1 > .column, .large-up-1 > .columns { + width: 100%; + float: left; } + .large-up-1 > .column:nth-of-type(1n), .large-up-1 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-1 > .column:nth-of-type(1n+1), .large-up-1 > .columns:nth-of-type(1n+1) { + clear: both; } + .large-up-1 > .column:last-child, .large-up-1 > .columns:last-child { + float: left; } + .large-up-2 > .column, .large-up-2 > .columns { + width: 50%; + float: left; } + .large-up-2 > .column:nth-of-type(1n), .large-up-2 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-2 > .column:nth-of-type(2n+1), .large-up-2 > .columns:nth-of-type(2n+1) { + clear: both; } + .large-up-2 > .column:last-child, .large-up-2 > .columns:last-child { + float: left; } + .large-up-3 > .column, .large-up-3 > .columns { + width: 33.33333%; + float: left; } + .large-up-3 > .column:nth-of-type(1n), .large-up-3 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-3 > .column:nth-of-type(3n+1), .large-up-3 > .columns:nth-of-type(3n+1) { + clear: both; } + .large-up-3 > .column:last-child, .large-up-3 > .columns:last-child { + float: left; } + .large-up-4 > .column, .large-up-4 > .columns { + width: 25%; + float: left; } + .large-up-4 > .column:nth-of-type(1n), .large-up-4 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-4 > .column:nth-of-type(4n+1), .large-up-4 > .columns:nth-of-type(4n+1) { + clear: both; } + .large-up-4 > .column:last-child, .large-up-4 > .columns:last-child { + float: left; } + .large-up-5 > .column, .large-up-5 > .columns { + width: 20%; + float: left; } + .large-up-5 > .column:nth-of-type(1n), .large-up-5 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-5 > .column:nth-of-type(5n+1), .large-up-5 > .columns:nth-of-type(5n+1) { + clear: both; } + .large-up-5 > .column:last-child, .large-up-5 > .columns:last-child { + float: left; } + .large-up-6 > .column, .large-up-6 > .columns { + width: 16.66667%; + float: left; } + .large-up-6 > .column:nth-of-type(1n), .large-up-6 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-6 > .column:nth-of-type(6n+1), .large-up-6 > .columns:nth-of-type(6n+1) { + clear: both; } + .large-up-6 > .column:last-child, .large-up-6 > .columns:last-child { + float: left; } + .large-up-7 > .column, .large-up-7 > .columns { + width: 14.28571%; + float: left; } + .large-up-7 > .column:nth-of-type(1n), .large-up-7 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-7 > .column:nth-of-type(7n+1), .large-up-7 > .columns:nth-of-type(7n+1) { + clear: both; } + .large-up-7 > .column:last-child, .large-up-7 > .columns:last-child { + float: left; } + .large-up-8 > .column, .large-up-8 > .columns { + width: 12.5%; + float: left; } + .large-up-8 > .column:nth-of-type(1n), .large-up-8 > .columns:nth-of-type(1n) { + clear: none; } + .large-up-8 > .column:nth-of-type(8n+1), .large-up-8 > .columns:nth-of-type(8n+1) { + clear: both; } + .large-up-8 > .column:last-child, .large-up-8 > .columns:last-child { + float: left; } + .large-collapse > .column, .large-collapse > .columns { + padding-left: 0; + padding-right: 0; } + .large-collapse .row { + margin-left: 0; + margin-right: 0; } + .expanded.row .large-collapse.row { + margin-left: 0; + margin-right: 0; } + .large-uncollapse > .column, .large-uncollapse > .columns { + padding-left: 0.9375rem; + padding-right: 0.9375rem; } + .large-centered { + margin-left: auto; + margin-right: auto; } + .large-centered, .large-centered:last-child:not(:first-child) { + float: none; + clear: both; } + .large-uncentered, + .large-push-0, + .large-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } } + +div, +dl, +dt, +dd, +ul, +ol, +li, +h1, +h2, +h3, +h4, +h5, +h6, +pre, +form, +p, +blockquote, +th, +td { + margin: 0; + padding: 0; } + +p { + font-size: inherit; + line-height: 1.6; + margin-bottom: 1rem; + text-rendering: optimizeLegibility; } + +em, +i { + font-style: italic; + line-height: inherit; } + +strong, +b { + font-weight: bold; + line-height: inherit; } + +small { + font-size: 80%; + line-height: inherit; } + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: normal; + font-style: normal; + color: inherit; + text-rendering: optimizeLegibility; + margin-top: 0; + margin-bottom: 0.5rem; + line-height: 1.4; } + h1 small, + h2 small, + h3 small, + h4 small, + h5 small, + h6 small { + color: #cacaca; + line-height: 0; } + +h1 { + font-size: 1.5rem; } + +h2 { + font-size: 1.25rem; } + +h3 { + font-size: 1.1875rem; } + +h4 { + font-size: 1.125rem; } + +h5 { + font-size: 1.0625rem; } + +h6 { + font-size: 1rem; } + +@media screen and (min-width: 40em) { + h1 { + font-size: 3rem; } + h2 { + font-size: 2.5rem; } + h3 { + font-size: 1.9375rem; } + h4 { + font-size: 1.5625rem; } + h5 { + font-size: 1.25rem; } + h6 { + font-size: 1rem; } } + +a { + color: #2199e8; + text-decoration: none; + line-height: inherit; + cursor: pointer; } + a:hover, a:focus { + color: #1585cf; } + a img { + border: 0; } + +hr { + max-width: 75rem; + height: 0; + border-right: 0; + border-top: 0; + border-bottom: 1px solid #cacaca; + border-left: 0; + margin: 1.25rem auto; + clear: both; } + +ul, +ol, +dl { + line-height: 1.6; + margin-bottom: 1rem; + list-style-position: outside; } + +li { + font-size: inherit; } + +ul { + list-style-type: disc; + margin-left: 1.25rem; } + +ol { + margin-left: 1.25rem; } + +ul ul, ol ul, ul ol, ol ol { + margin-left: 1.25rem; + margin-bottom: 0; } + +dl { + margin-bottom: 1rem; } + dl dt { + margin-bottom: 0.3rem; + font-weight: bold; } + +blockquote { + margin: 0 0 1rem; + padding: 0.5625rem 1.25rem 0 1.1875rem; + border-left: 1px solid #cacaca; } + blockquote, blockquote p { + line-height: 1.6; + color: #8a8a8a; } + +cite { + display: block; + font-size: 0.8125rem; + color: #8a8a8a; } + cite:before { + content: '\2014 \0020'; } + +abbr { + color: #0a0a0a; + cursor: help; + border-bottom: 1px dotted #0a0a0a; } + +code { + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-weight: normal; + color: #0a0a0a; + background-color: #e6e6e6; + border: 1px solid #cacaca; + padding: 0.125rem 0.3125rem 0.0625rem; } + +kbd { + padding: 0.125rem 0.25rem 0; + margin: 0; + background-color: #e6e6e6; + color: #0a0a0a; + font-family: Consolas, "Liberation Mono", Courier, monospace; } + +.subheader { + margin-top: 0.2rem; + margin-bottom: 0.5rem; + font-weight: normal; + line-height: 1.4; + color: #8a8a8a; } + +.lead { + font-size: 125%; + line-height: 1.6; } + +.stat { + font-size: 2.5rem; + line-height: 1; } + p + .stat { + margin-top: -1rem; } + +.no-bullet { + margin-left: 0; + list-style: none; } + +.text-left { + text-align: left; } + +.text-right { + text-align: right; } + +.text-center { + text-align: center; } + +.text-justify { + text-align: justify; } + +@media screen and (min-width: 40em) { + .medium-text-left { + text-align: left; } + .medium-text-right { + text-align: right; } + .medium-text-center { + text-align: center; } + .medium-text-justify { + text-align: justify; } } + +@media screen and (min-width: 64em) { + .large-text-left { + text-align: left; } + .large-text-right { + text-align: right; } + .large-text-center { + text-align: center; } + .large-text-justify { + text-align: justify; } } + +.show-for-print { + display: none !important; } + +@media print { + * { + background: transparent !important; + color: black !important; + box-shadow: none !important; + text-shadow: none !important; } + .show-for-print { + display: block !important; } + .hide-for-print { + display: none !important; } + table.show-for-print { + display: table !important; } + thead.show-for-print { + display: table-header-group !important; } + tbody.show-for-print { + display: table-row-group !important; } + tr.show-for-print { + display: table-row !important; } + td.show-for-print { + display: table-cell !important; } + th.show-for-print { + display: table-cell !important; } + a, + a:visited { + text-decoration: underline; } + a[href]:after { + content: " (" attr(href) ")"; } + .ir a:after, + a[href^='javascript:']:after, + a[href^='#']:after { + content: ''; } + abbr[title]:after { + content: " (" attr(title) ")"; } + pre, + blockquote { + border: 1px solid #8a8a8a; + page-break-inside: avoid; } + thead { + display: table-header-group; } + tr, + img { + page-break-inside: avoid; } + img { + max-width: 100% !important; } + @page { + margin: 0.5cm; } + p, + h2, + h3 { + orphans: 3; + widows: 3; } + h2, + h3 { + page-break-after: avoid; } } + +.button { + display: inline-block; + text-align: center; + line-height: 1; + cursor: pointer; + -webkit-appearance: none; + transition: background-color 0.25s ease-out, color 0.25s ease-out; + vertical-align: middle; + border: 1px solid transparent; + border-radius: 0; + padding: 0.85em 1em; + margin: 0 0 1rem 0; + font-size: 0.9rem; + background-color: #2199e8; + color: #fefefe; } + [data-whatinput='mouse'] .button { + outline: 0; } + .button:hover, .button:focus { + background-color: #1583cc; + color: #fefefe; } + .button.tiny { + font-size: 0.6rem; } + .button.small { + font-size: 0.75rem; } + .button.large { + font-size: 1.25rem; } + .button.expanded { + display: block; + width: 100%; + margin-left: 0; + margin-right: 0; } + .button.primary { + background-color: #2199e8; + color: #fefefe; } + .button.primary:hover, .button.primary:focus { + background-color: #147cc0; + color: #fefefe; } + .button.secondary { + background-color: #777; + color: #fefefe; } + .button.secondary:hover, .button.secondary:focus { + background-color: #5f5f5f; + color: #fefefe; } + .button.success { + background-color: #3adb76; + color: #fefefe; } + .button.success:hover, .button.success:focus { + background-color: #22bb5b; + color: #fefefe; } + .button.warning { + background-color: #ffae00; + color: #fefefe; } + .button.warning:hover, .button.warning:focus { + background-color: #cc8b00; + color: #fefefe; } + .button.alert { + background-color: #ec5840; + color: #fefefe; } + .button.alert:hover, .button.alert:focus { + background-color: #da3116; + color: #fefefe; } + .button.hollow { + border: 1px solid #2199e8; + color: #2199e8; } + .button.hollow, .button.hollow:hover, .button.hollow:focus { + background-color: transparent; } + .button.hollow:hover, .button.hollow:focus { + border-color: #0c4d78; + color: #0c4d78; } + .button.hollow.primary { + border: 1px solid #2199e8; + color: #2199e8; } + .button.hollow.primary:hover, .button.hollow.primary:focus { + border-color: #0c4d78; + color: #0c4d78; } + .button.hollow.secondary { + border: 1px solid #777; + color: #777; } + .button.hollow.secondary:hover, .button.hollow.secondary:focus { + border-color: #3c3c3c; + color: #3c3c3c; } + .button.hollow.success { + border: 1px solid #3adb76; + color: #3adb76; } + .button.hollow.success:hover, .button.hollow.success:focus { + border-color: #157539; + color: #157539; } + .button.hollow.warning { + border: 1px solid #ffae00; + color: #ffae00; } + .button.hollow.warning:hover, .button.hollow.warning:focus { + border-color: #805700; + color: #805700; } + .button.hollow.alert { + border: 1px solid #ec5840; + color: #ec5840; } + .button.hollow.alert:hover, .button.hollow.alert:focus { + border-color: #881f0e; + color: #881f0e; } + .button.disabled, .button[disabled] { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { + background-color: #2199e8; + color: #fefefe; } + .button.disabled.primary, .button[disabled].primary { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled.primary:hover, .button.disabled.primary:focus, .button[disabled].primary:hover, .button[disabled].primary:focus { + background-color: #2199e8; + color: #fefefe; } + .button.disabled.secondary, .button[disabled].secondary { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary:hover, .button[disabled].secondary:focus { + background-color: #777; + color: #fefefe; } + .button.disabled.success, .button[disabled].success { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled.success:hover, .button.disabled.success:focus, .button[disabled].success:hover, .button[disabled].success:focus { + background-color: #3adb76; + color: #fefefe; } + .button.disabled.warning, .button[disabled].warning { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled.warning:hover, .button.disabled.warning:focus, .button[disabled].warning:hover, .button[disabled].warning:focus { + background-color: #ffae00; + color: #fefefe; } + .button.disabled.alert, .button[disabled].alert { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled.alert:hover, .button.disabled.alert:focus, .button[disabled].alert:hover, .button[disabled].alert:focus { + background-color: #ec5840; + color: #fefefe; } + .button.dropdown::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.4em; + border-color: #fefefe transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + position: relative; + top: 0.4em; + float: right; + margin-left: 1em; + display: inline-block; } + .button.arrow-only::after { + margin-left: 0; + float: none; + top: -0.1em; } + +[type='text'], [type='password'], [type='date'], [type='datetime'], [type='datetime-local'], [type='month'], [type='week'], [type='email'], [type='number'], [type='search'], [type='tel'], [type='time'], [type='url'], [type='color'], +textarea { + display: block; + box-sizing: border-box; + width: 100%; + height: 2.4375rem; + padding: 0.5rem; + border: 1px solid #cacaca; + margin: 0 0 1rem; + font-family: inherit; + font-size: 1rem; + color: #0a0a0a; + background-color: #fefefe; + box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); + border-radius: 0; + transition: box-shadow 0.5s, border-color 0.25s ease-in-out; + -webkit-appearance: none; + -moz-appearance: none; } + [type='text']:focus, [type='password']:focus, [type='date']:focus, [type='datetime']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='week']:focus, [type='email']:focus, [type='number']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='url']:focus, [type='color']:focus, + textarea:focus { + border: 1px solid #8a8a8a; + background-color: #fefefe; + outline: none; + box-shadow: 0 0 5px #cacaca; + transition: box-shadow 0.5s, border-color 0.25s ease-in-out; } + +textarea { + max-width: 100%; } + textarea[rows] { + height: auto; } + +input::-webkit-input-placeholder, +textarea::-webkit-input-placeholder { + color: #cacaca; } + +input::-moz-placeholder, +textarea::-moz-placeholder { + color: #cacaca; } + +input:-ms-input-placeholder, +textarea:-ms-input-placeholder { + color: #cacaca; } + +input::placeholder, +textarea::placeholder { + color: #cacaca; } + +input:disabled, input[readonly], +textarea:disabled, +textarea[readonly] { + background-color: #e6e6e6; + cursor: not-allowed; } + +[type='submit'], +[type='button'] { + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; } + +input[type='search'] { + box-sizing: border-box; } + +[type='file'], +[type='checkbox'], +[type='radio'] { + margin: 0 0 1rem; } + +[type='checkbox'] + label, +[type='radio'] + label { + display: inline-block; + margin-left: 0.5rem; + margin-right: 1rem; + margin-bottom: 0; + vertical-align: baseline; } + [type='checkbox'] + label[for], + [type='radio'] + label[for] { + cursor: pointer; } + +label > [type='checkbox'], +label > [type='radio'] { + margin-right: 0.5rem; } + +[type='file'] { + width: 100%; } + +label { + display: block; + margin: 0; + font-size: 0.875rem; + font-weight: normal; + line-height: 1.8; + color: #0a0a0a; } + label.middle { + margin: 0 0 1rem; + padding: 0.5625rem 0; } + +.help-text { + margin-top: -0.5rem; + font-size: 0.8125rem; + font-style: italic; + color: #0a0a0a; } + +.input-group { + display: table; + width: 100%; + margin-bottom: 1rem; } + .input-group > :first-child { + border-radius: 0 0 0 0; } + .input-group > :last-child > * { + border-radius: 0 0 0 0; } + +.input-group-label, .input-group-field, .input-group-button { + margin: 0; + white-space: nowrap; + display: table-cell; + vertical-align: middle; } + +.input-group-label { + text-align: center; + padding: 0 1rem; + background: #e6e6e6; + color: #0a0a0a; + border: 1px solid #cacaca; + white-space: nowrap; + width: 1%; + height: 100%; } + .input-group-label:first-child { + border-right: 0; } + .input-group-label:last-child { + border-left: 0; } + +.input-group-field { + border-radius: 0; + height: 2.5rem; } + +.input-group-button { + padding-top: 0; + padding-bottom: 0; + text-align: center; + height: 100%; + width: 1%; } + .input-group-button a, + .input-group-button input, + .input-group-button button { + margin: 0; } + +.input-group .input-group-button { + display: table-cell; } + +fieldset { + border: 0; + padding: 0; + margin: 0; } + +legend { + margin-bottom: 0.5rem; + max-width: 100%; } + +.fieldset { + border: 1px solid #cacaca; + padding: 1.25rem; + margin: 1.125rem 0; } + .fieldset legend { + background: #fefefe; + padding: 0 0.1875rem; + margin: 0; + margin-left: -0.1875rem; } + +select { + height: 2.4375rem; + padding: 0.5rem; + border: 1px solid #cacaca; + margin: 0 0 1rem; + font-size: 1rem; + font-family: inherit; + line-height: normal; + color: #0a0a0a; + background-color: #fefefe; + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; + background-image: url("data:image/svg+xml;utf8,"); + background-size: 9px 6px; + background-position: right -1rem center; + background-origin: content-box; + background-repeat: no-repeat; + padding-right: 1.5rem; } + @media screen and (min-width: 0\0) { + select { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg=="); } } + select:disabled { + background-color: #e6e6e6; + cursor: not-allowed; } + select::-ms-expand { + display: none; } + select[multiple] { + height: auto; + background-image: none; } + +.is-invalid-input:not(:focus) { + background-color: rgba(236, 88, 64, 0.1); + border-color: #ec5840; } + +.is-invalid-label { + color: #ec5840; } + +.form-error { + display: none; + margin-top: -0.5rem; + margin-bottom: 1rem; + font-size: 0.75rem; + font-weight: bold; + color: #ec5840; } + .form-error.is-visible { + display: block; } + +.accordion { + list-style-type: none; + background: #fefefe; + margin-left: 0; } + +.accordion-item:first-child > :first-child { + border-radius: 0 0 0 0; } + +.accordion-item:last-child > :last-child { + border-radius: 0 0 0 0; } + +.accordion-title { + display: block; + padding: 1.25rem 1rem; + line-height: 1; + font-size: 0.75rem; + color: #2199e8; + position: relative; + border: 1px solid #e6e6e6; + border-bottom: 0; } + :last-child:not(.is-active) > .accordion-title { + border-radius: 0 0 0 0; + border-bottom: 1px solid #e6e6e6; } + .accordion-title:hover, .accordion-title:focus { + background-color: #e6e6e6; } + .accordion-title::before { + content: '+'; + position: absolute; + right: 1rem; + top: 50%; + margin-top: -0.5rem; } + .is-active > .accordion-title::before { + content: '–'; } + +.accordion-content { + padding: 1rem; + display: none; + border: 1px solid #e6e6e6; + border-bottom: 0; + background-color: #fefefe; + color: #0a0a0a; } + :last-child > .accordion-content:last-child { + border-bottom: 1px solid #e6e6e6; } + +.is-accordion-submenu-parent > a { + position: relative; } + .is-accordion-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + position: absolute; + top: 50%; + margin-top: -4px; + right: 1rem; } + +.is-accordion-submenu-parent[aria-expanded='true'] > a::after { + -webkit-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + transform-origin: 50% 50%; + -webkit-transform: scaleY(-1); + -ms-transform: scaleY(-1); + transform: scaleY(-1); } + +.badge { + display: inline-block; + padding: 0.3em; + min-width: 2.1em; + font-size: 0.6rem; + text-align: center; + border-radius: 50%; + background: #2199e8; + color: #fefefe; } + .badge.secondary { + background: #777; + color: #fefefe; } + .badge.success { + background: #3adb76; + color: #fefefe; } + .badge.warning { + background: #ffae00; + color: #fefefe; } + .badge.alert { + background: #ec5840; + color: #fefefe; } + +.breadcrumbs { + list-style: none; + margin: 0 0 1rem 0; } + .breadcrumbs::before, .breadcrumbs::after { + content: ' '; + display: table; } + .breadcrumbs::after { + clear: both; } + .breadcrumbs li { + float: left; + color: #0a0a0a; + font-size: 0.6875rem; + cursor: default; + text-transform: uppercase; } + .breadcrumbs li:not(:last-child)::after { + color: #cacaca; + content: "/"; + margin: 0 0.75rem; + position: relative; + top: 1px; + opacity: 1; } + .breadcrumbs a { + color: #2199e8; } + .breadcrumbs a:hover { + text-decoration: underline; } + .breadcrumbs .disabled { + color: #cacaca; + cursor: not-allowed; } + +.button-group { + margin-bottom: 1rem; + font-size: 0; } + .button-group::before, .button-group::after { + content: ' '; + display: table; } + .button-group::after { + clear: both; } + .button-group .button { + margin: 0; + margin-right: 1px; + margin-bottom: 1px; + font-size: 0.9rem; } + .button-group .button:last-child { + margin-right: 0; } + .button-group.tiny .button { + font-size: 0.6rem; } + .button-group.small .button { + font-size: 0.75rem; } + .button-group.large .button { + font-size: 1.25rem; } + .button-group.expanded { + margin-right: -1px; } + .button-group.expanded::before, .button-group.expanded::after { + display: none; } + .button-group.expanded .button:first-child:nth-last-child(2), .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button { + display: inline-block; + width: calc(50% - 1px); + margin-right: 1px; } + .button-group.expanded .button:first-child:nth-last-child(2):last-child, .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button:last-child { + margin-right: -6px; } + .button-group.expanded .button:first-child:nth-last-child(3), .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button { + display: inline-block; + width: calc(33.33333% - 1px); + margin-right: 1px; } + .button-group.expanded .button:first-child:nth-last-child(3):last-child, .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button:last-child { + margin-right: -6px; } + .button-group.expanded .button:first-child:nth-last-child(4), .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button { + display: inline-block; + width: calc(25% - 1px); + margin-right: 1px; } + .button-group.expanded .button:first-child:nth-last-child(4):last-child, .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button:last-child { + margin-right: -6px; } + .button-group.expanded .button:first-child:nth-last-child(5), .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button { + display: inline-block; + width: calc(20% - 1px); + margin-right: 1px; } + .button-group.expanded .button:first-child:nth-last-child(5):last-child, .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button:last-child { + margin-right: -6px; } + .button-group.expanded .button:first-child:nth-last-child(6), .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button { + display: inline-block; + width: calc(16.66667% - 1px); + margin-right: 1px; } + .button-group.expanded .button:first-child:nth-last-child(6):last-child, .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button:last-child { + margin-right: -6px; } + .button-group.primary .button { + background-color: #2199e8; + color: #fefefe; } + .button-group.primary .button:hover, .button-group.primary .button:focus { + background-color: #147cc0; + color: #fefefe; } + .button-group.secondary .button { + background-color: #777; + color: #fefefe; } + .button-group.secondary .button:hover, .button-group.secondary .button:focus { + background-color: #5f5f5f; + color: #fefefe; } + .button-group.success .button { + background-color: #3adb76; + color: #fefefe; } + .button-group.success .button:hover, .button-group.success .button:focus { + background-color: #22bb5b; + color: #fefefe; } + .button-group.warning .button { + background-color: #ffae00; + color: #fefefe; } + .button-group.warning .button:hover, .button-group.warning .button:focus { + background-color: #cc8b00; + color: #fefefe; } + .button-group.alert .button { + background-color: #ec5840; + color: #fefefe; } + .button-group.alert .button:hover, .button-group.alert .button:focus { + background-color: #da3116; + color: #fefefe; } + .button-group.stacked .button, .button-group.stacked-for-small .button, .button-group.stacked-for-medium .button { + width: 100%; } + .button-group.stacked .button:last-child, .button-group.stacked-for-small .button:last-child, .button-group.stacked-for-medium .button:last-child { + margin-bottom: 0; } + @media screen and (min-width: 40em) { + .button-group.stacked-for-small .button { + width: auto; + margin-bottom: 0; } } + @media screen and (min-width: 64em) { + .button-group.stacked-for-medium .button { + width: auto; + margin-bottom: 0; } } + @media screen and (max-width: 39.9375em) { + .button-group.stacked-for-small.expanded { + display: block; } + .button-group.stacked-for-small.expanded .button { + display: block; + margin-right: 0; } } + +.callout { + margin: 0 0 1rem 0; + padding: 1rem; + border: 1px solid rgba(10, 10, 10, 0.25); + border-radius: 0; + position: relative; + color: #0a0a0a; + background-color: white; } + .callout > :first-child { + margin-top: 0; } + .callout > :last-child { + margin-bottom: 0; } + .callout.primary { + background-color: #def0fc; } + .callout.secondary { + background-color: #ebebeb; } + .callout.success { + background-color: #e1faea; } + .callout.warning { + background-color: #fff3d9; } + .callout.alert { + background-color: #fce6e2; } + .callout.small { + padding-top: 0.5rem; + padding-right: 0.5rem; + padding-bottom: 0.5rem; + padding-left: 0.5rem; } + .callout.large { + padding-top: 3rem; + padding-right: 3rem; + padding-bottom: 3rem; + padding-left: 3rem; } + +.close-button { + position: absolute; + color: #8a8a8a; + right: 1rem; + top: 0.5rem; + font-size: 2em; + line-height: 1; + cursor: pointer; } + [data-whatinput='mouse'] .close-button { + outline: 0; } + .close-button:hover, .close-button:focus { + color: #0a0a0a; } + +.menu { + margin: 0; + list-style-type: none; } + .menu > li { + display: table-cell; + vertical-align: middle; } + [data-whatinput='mouse'] .menu > li { + outline: 0; } + .menu > li > a { + display: block; + padding: 0.7rem 1rem; + line-height: 1; } + .menu input, + .menu a, + .menu button { + margin-bottom: 0; } + .menu > li > a img, + .menu > li > a i, + .menu > li > a svg { + vertical-align: middle; } + .menu > li > a img + span, + .menu > li > a i + span, + .menu > li > a svg + span { + vertical-align: middle; } + .menu > li > a img, + .menu > li > a i, + .menu > li > a svg { + margin-right: 0.25rem; + display: inline-block; } + .menu > li { + display: table-cell; } + .menu.vertical > li { + display: block; } + @media screen and (min-width: 40em) { + .menu.medium-horizontal > li { + display: table-cell; } + .menu.medium-vertical > li { + display: block; } } + @media screen and (min-width: 64em) { + .menu.large-horizontal > li { + display: table-cell; } + .menu.large-vertical > li { + display: block; } } + .menu.simple li { + line-height: 1; + display: inline-block; + margin-right: 1rem; } + .menu.simple a { + padding: 0; } + .menu.align-right::before, .menu.align-right::after { + content: ' '; + display: table; } + .menu.align-right::after { + clear: both; } + .menu.align-right > li { + float: right; } + .menu.expanded { + width: 100%; + display: table; + table-layout: fixed; } + .menu.expanded > li:first-child:last-child { + width: 100%; } + .menu.icon-top > li > a { + text-align: center; } + .menu.icon-top > li > a img, + .menu.icon-top > li > a i, + .menu.icon-top > li > a svg { + display: block; + margin: 0 auto 0.25rem; } + .menu.nested { + margin-left: 1rem; } + .menu .active > a { + color: #fefefe; + background: #2199e8; } + +.menu-text { + font-weight: bold; + color: inherit; + line-height: 1; + padding-top: 0; + padding-bottom: 0; + padding: 0.7rem 1rem; } + +.menu-centered { + text-align: center; } + .menu-centered > .menu { + display: inline-block; } + +.no-js [data-responsive-menu] ul { + display: none; } + +.menu-icon { + position: relative; + display: inline-block; + vertical-align: middle; + cursor: pointer; + width: 20px; + height: 16px; } + .menu-icon::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 2px; + background: #fefefe; + top: 0; + left: 0; + box-shadow: 0 7px 0 #fefefe, 0 14px 0 #fefefe; } + .menu-icon:hover::after { + background: #cacaca; + box-shadow: 0 7px 0 #cacaca, 0 14px 0 #cacaca; } + +.menu-icon.dark { + position: relative; + display: inline-block; + vertical-align: middle; + cursor: pointer; + width: 20px; + height: 16px; } + .menu-icon.dark::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 2px; + background: #0a0a0a; + top: 0; + left: 0; + box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; } + .menu-icon.dark:hover::after { + background: #8a8a8a; + box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } + +.is-drilldown { + position: relative; + overflow: hidden; } + .is-drilldown li { + display: block !important; } + +.is-drilldown-submenu { + position: absolute; + top: 0; + left: 100%; + z-index: -1; + width: 100%; + background: #fefefe; + transition: -webkit-transform 0.15s linear; + transition: transform 0.15s linear; } + .is-drilldown-submenu.is-active { + z-index: 1; + display: block; + -webkit-transform: translateX(-100%); + -ms-transform: translateX(-100%); + transform: translateX(-100%); } + .is-drilldown-submenu.is-closing { + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); } + +.is-drilldown-submenu-parent > a { + position: relative; } + .is-drilldown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; + position: absolute; + top: 50%; + margin-top: -6px; + right: 1rem; } + +.js-drilldown-back > a::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; + border-left-width: 0; + display: inline-block; + vertical-align: middle; + margin-right: 0.75rem; } + +.dropdown-pane { + background-color: #fefefe; + border: 1px solid #cacaca; + border-radius: 0; + display: block; + font-size: 1rem; + padding: 1rem; + position: absolute; + visibility: hidden; + width: 300px; + z-index: 10; } + .dropdown-pane.is-open { + visibility: visible; } + +.dropdown-pane.tiny { + width: 100px; } + +.dropdown-pane.small { + width: 200px; } + +.dropdown-pane.large { + width: 400px; } + +.dropdown.menu > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 0; + top: 100%; } + +.dropdown.menu > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + +.dropdown.menu > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + +.dropdown.menu > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + +[data-whatinput='mouse'] .dropdown.menu a { + outline: 0; } + +.no-js .dropdown.menu ul { + display: none; } + +.dropdown.menu.vertical > li .is-dropdown-submenu { + top: 0; } + +.dropdown.menu.vertical > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + +.dropdown.menu.vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + +.dropdown.menu.vertical > li > a::after { + right: 14px; + margin-top: -3px; } + +.dropdown.menu.vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + +.dropdown.menu.vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } + +@media screen and (min-width: 40em) { + .dropdown.menu.medium-horizontal > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 0; + top: 100%; } + .dropdown.menu.medium-horizontal > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + .dropdown.menu.medium-vertical > li .is-dropdown-submenu { + top: 0; } + .dropdown.menu.medium-vertical > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .dropdown.menu.medium-vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + .dropdown.menu.medium-vertical > li > a::after { + right: 14px; + margin-top: -3px; } + .dropdown.menu.medium-vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .dropdown.menu.medium-vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } } + +@media screen and (min-width: 64em) { + .dropdown.menu.large-horizontal > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 0; + top: 100%; } + .dropdown.menu.large-horizontal > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + .dropdown.menu.large-vertical > li .is-dropdown-submenu { + top: 0; } + .dropdown.menu.large-vertical > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .dropdown.menu.large-vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + .dropdown.menu.large-vertical > li > a::after { + right: 14px; + margin-top: -3px; } + .dropdown.menu.large-vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .dropdown.menu.large-vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } } + +.dropdown.menu.align-right .is-dropdown-submenu.first-sub { + top: 100%; + left: auto; + right: 0; } + +.is-dropdown-menu.vertical { + width: 100px; } + .is-dropdown-menu.vertical.align-right { + float: right; } + +.is-dropdown-submenu-parent { + position: relative; } + .is-dropdown-submenu-parent a::after { + position: absolute; + top: 50%; + right: 5px; + margin-top: -2px; } + .is-dropdown-submenu-parent.opens-inner > .is-dropdown-submenu { + top: 100%; + left: auto; } + .is-dropdown-submenu-parent.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .is-dropdown-submenu-parent.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + +.is-dropdown-submenu { + display: none; + position: absolute; + top: 0; + left: 100%; + min-width: 200px; + z-index: 1; + background: #fefefe; + border: 1px solid #cacaca; } + .is-dropdown-submenu .is-dropdown-submenu-parent > a::after { + right: 14px; + margin-top: -3px; } + .is-dropdown-submenu .is-dropdown-submenu-parent.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .is-dropdown-submenu .is-dropdown-submenu-parent.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } + .is-dropdown-submenu .is-dropdown-submenu { + margin-top: -1px; } + .is-dropdown-submenu > li { + width: 100%; } + .is-dropdown-submenu.js-dropdown-active { + display: block; } + +.flex-video { + position: relative; + height: 0; + padding-bottom: 75%; + margin-bottom: 1rem; + overflow: hidden; } + .flex-video iframe, + .flex-video object, + .flex-video embed, + .flex-video video { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + .flex-video.widescreen { + padding-bottom: 56.25%; } + .flex-video.vimeo { + padding-top: 0; } + +.label { + display: inline-block; + padding: 0.33333rem 0.5rem; + font-size: 0.8rem; + line-height: 1; + white-space: nowrap; + cursor: default; + border-radius: 0; + background: #2199e8; + color: #fefefe; } + .label.secondary { + background: #777; + color: #fefefe; } + .label.success { + background: #3adb76; + color: #fefefe; } + .label.warning { + background: #ffae00; + color: #fefefe; } + .label.alert { + background: #ec5840; + color: #fefefe; } + +.media-object { + margin-bottom: 1rem; + display: block; } + .media-object img { + max-width: none; } + @media screen and (max-width: 39.9375em) { + .media-object.stack-for-small .media-object-section { + padding: 0; + padding-bottom: 1rem; + display: block; } + .media-object.stack-for-small .media-object-section img { + width: 100%; } } + +.media-object-section { + display: table-cell; + vertical-align: top; } + .media-object-section:first-child { + padding-right: 1rem; } + .media-object-section:last-child:not(:nth-child(2)) { + padding-left: 1rem; } + .media-object-section > :last-child { + margin-bottom: 0; } + .media-object-section.middle { + vertical-align: middle; } + .media-object-section.bottom { + vertical-align: bottom; } + +html, +body { + height: 100%; } + +.off-canvas-wrapper { + width: 100%; + overflow-x: hidden; + position: relative; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-overflow-scrolling: auto; } + +.off-canvas-wrapper-inner { + position: relative; + width: 100%; + min-height: 100%; + transition: -webkit-transform 0.5s ease; + transition: transform 0.5s ease; } + .off-canvas-wrapper-inner::before, .off-canvas-wrapper-inner::after { + content: ' '; + display: table; } + .off-canvas-wrapper-inner::after { + clear: both; } + +.off-canvas-content, +.off-canvas-content { + min-height: 100%; + background: #fefefe; + transition: -webkit-transform 0.5s ease; + transition: transform 0.5s ease; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + z-index: 1; + padding-bottom: 0.1px; + box-shadow: 0 0 10px rgba(10, 10, 10, 0.5); } + +.js-off-canvas-exit { + display: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(254, 254, 254, 0.25); + cursor: pointer; + transition: background 0.5s ease; } + +.off-canvas { + position: absolute; + background: #e6e6e6; + z-index: -1; + max-height: 100%; + overflow-y: auto; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + [data-whatinput='mouse'] .off-canvas { + outline: 0; } + .off-canvas.position-left { + left: -250px; + top: 0; + width: 250px; } + .is-open-left { + -webkit-transform: translateX(250px); + -ms-transform: translateX(250px); + transform: translateX(250px); } + .off-canvas.position-right { + right: -250px; + top: 0; + width: 250px; } + .is-open-right { + -webkit-transform: translateX(-250px); + -ms-transform: translateX(-250px); + transform: translateX(-250px); } + +@media screen and (min-width: 40em) { + .position-left.reveal-for-medium { + left: 0; + z-index: auto; + position: fixed; } + .position-left.reveal-for-medium ~ .off-canvas-content { + margin-left: 250px; } + .position-right.reveal-for-medium { + right: 0; + z-index: auto; + position: fixed; } + .position-right.reveal-for-medium ~ .off-canvas-content { + margin-right: 250px; } } + +@media screen and (min-width: 64em) { + .position-left.reveal-for-large { + left: 0; + z-index: auto; + position: fixed; } + .position-left.reveal-for-large ~ .off-canvas-content { + margin-left: 250px; } + .position-right.reveal-for-large { + right: 0; + z-index: auto; + position: fixed; } + .position-right.reveal-for-large ~ .off-canvas-content { + margin-right: 250px; } } + +.orbit { + position: relative; } + +.orbit-container { + position: relative; + margin: 0; + overflow: hidden; + list-style: none; } + +.orbit-slide { + width: 100%; + max-height: 100%; } + .orbit-slide.no-motionui.is-active { + top: 0; + left: 0; } + +.orbit-figure { + margin: 0; } + +.orbit-image { + margin: 0; + width: 100%; + max-width: 100%; } + +.orbit-caption { + position: absolute; + bottom: 0; + width: 100%; + padding: 1rem; + margin-bottom: 0; + color: #fefefe; + background-color: rgba(10, 10, 10, 0.5); } + +.orbit-previous, .orbit-next { + position: absolute; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); + z-index: 10; + padding: 1rem; + color: #fefefe; } + [data-whatinput='mouse'] .orbit-previous, [data-whatinput='mouse'] .orbit-next { + outline: 0; } + .orbit-previous:hover, .orbit-next:hover, .orbit-previous:active, .orbit-next:active, .orbit-previous:focus, .orbit-next:focus { + background-color: rgba(10, 10, 10, 0.5); } + +.orbit-previous { + left: 0; } + +.orbit-next { + left: auto; + right: 0; } + +.orbit-bullets { + position: relative; + margin-top: 0.8rem; + margin-bottom: 0.8rem; + text-align: center; } + [data-whatinput='mouse'] .orbit-bullets { + outline: 0; } + .orbit-bullets button { + width: 1.2rem; + height: 1.2rem; + margin: 0.1rem; + background-color: #cacaca; + border-radius: 50%; } + .orbit-bullets button:hover { + background-color: #8a8a8a; } + .orbit-bullets button.is-active { + background-color: #8a8a8a; } + +.pagination { + margin-left: 0; + margin-bottom: 1rem; } + .pagination::before, .pagination::after { + content: ' '; + display: table; } + .pagination::after { + clear: both; } + .pagination li { + font-size: 0.875rem; + margin-right: 0.0625rem; + border-radius: 0; + display: none; } + .pagination li:last-child, .pagination li:first-child { + display: inline-block; } + @media screen and (min-width: 40em) { + .pagination li { + display: inline-block; } } + .pagination a, + .pagination button { + color: #0a0a0a; + display: block; + padding: 0.1875rem 0.625rem; + border-radius: 0; } + .pagination a:hover, + .pagination button:hover { + background: #e6e6e6; } + .pagination .current { + padding: 0.1875rem 0.625rem; + background: #2199e8; + color: #fefefe; + cursor: default; } + .pagination .disabled { + padding: 0.1875rem 0.625rem; + color: #cacaca; + cursor: not-allowed; } + .pagination .disabled:hover { + background: transparent; } + .pagination .ellipsis::after { + content: '\2026'; + padding: 0.1875rem 0.625rem; + color: #0a0a0a; } + +.pagination-previous a::before, +.pagination-previous.disabled::before { + content: '\00ab'; + display: inline-block; + margin-right: 0.5rem; } + +.pagination-next a::after, +.pagination-next.disabled::after { + content: '\00bb'; + display: inline-block; + margin-left: 0.5rem; } + +.progress { + background-color: #cacaca; + height: 1rem; + margin-bottom: 1rem; + border-radius: 0; } + .progress.primary .progress-meter { + background-color: #2199e8; } + .progress.secondary .progress-meter { + background-color: #777; } + .progress.success .progress-meter { + background-color: #3adb76; } + .progress.warning .progress-meter { + background-color: #ffae00; } + .progress.alert .progress-meter { + background-color: #ec5840; } + +.progress-meter { + position: relative; + display: block; + width: 0%; + height: 100%; + background-color: #2199e8; } + +.progress-meter-text { + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + position: absolute; + margin: 0; + font-size: 0.75rem; + font-weight: bold; + color: #fefefe; + white-space: nowrap; } + +body.is-reveal-open { + overflow: hidden; } + +html.is-reveal-open, +html.is-reveal-open body { + min-height: 100%; + overflow: hidden; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } + +.reveal-overlay { + display: none; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1005; + background-color: rgba(10, 10, 10, 0.45); + overflow-y: scroll; } + +.reveal { + display: none; + z-index: 1006; + padding: 1rem; + border: 1px solid #cacaca; + background-color: #fefefe; + border-radius: 0; + position: relative; + top: 100px; + margin-left: auto; + margin-right: auto; + overflow-y: auto; } + [data-whatinput='mouse'] .reveal { + outline: 0; } + @media screen and (min-width: 40em) { + .reveal { + min-height: 0; } } + .reveal .column, .reveal .columns, + .reveal .columns { + min-width: 0; } + .reveal > :last-child { + margin-bottom: 0; } + @media screen and (min-width: 40em) { + .reveal { + width: 600px; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal .reveal { + left: auto; + right: auto; + margin: 0 auto; } } + .reveal.collapse { + padding: 0; } + @media screen and (min-width: 40em) { + .reveal.tiny { + width: 30%; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal.small { + width: 50%; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal.large { + width: 90%; + max-width: 75rem; } } + .reveal.full { + top: 0; + left: 0; + width: 100%; + height: 100%; + height: 100vh; + min-height: 100vh; + max-width: none; + margin-left: 0; + border: 0; + border-radius: 0; } + @media screen and (max-width: 39.9375em) { + .reveal { + top: 0; + left: 0; + width: 100%; + height: 100%; + height: 100vh; + min-height: 100vh; + max-width: none; + margin-left: 0; + border: 0; + border-radius: 0; } } + .reveal.without-overlay { + position: fixed; } + +.slider { + position: relative; + height: 0.5rem; + margin-top: 1.25rem; + margin-bottom: 2.25rem; + background-color: #e6e6e6; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -ms-touch-action: none; + touch-action: none; } + +.slider-fill { + position: absolute; + top: 0; + left: 0; + display: inline-block; + max-width: 100%; + height: 0.5rem; + background-color: #cacaca; + transition: all 0.2s ease-in-out; } + .slider-fill.is-dragging { + transition: all 0s linear; } + +.slider-handle { + position: absolute; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); + position: absolute; + left: 0; + z-index: 1; + display: inline-block; + width: 1.4rem; + height: 1.4rem; + background-color: #2199e8; + transition: all 0.2s ease-in-out; + -ms-touch-action: manipulation; + touch-action: manipulation; + border-radius: 0; } + [data-whatinput='mouse'] .slider-handle { + outline: 0; } + .slider-handle:hover { + background-color: #1583cc; } + .slider-handle.is-dragging { + transition: all 0s linear; } + +.slider.disabled, +.slider[disabled] { + opacity: 0.25; + cursor: not-allowed; } + +.slider.vertical { + display: inline-block; + width: 0.5rem; + height: 12.5rem; + margin: 0 1.25rem; + -webkit-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); } + .slider.vertical .slider-fill { + top: 0; + width: 0.5rem; + max-height: 100%; } + .slider.vertical .slider-handle { + position: absolute; + top: 0; + left: 50%; + width: 1.4rem; + height: 1.4rem; + -webkit-transform: translateX(-50%); + -ms-transform: translateX(-50%); + transform: translateX(-50%); } + +.sticky-container { + position: relative; } + +.sticky { + position: absolute; + z-index: 0; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); } + +.sticky.is-stuck { + position: fixed; + z-index: 5; } + .sticky.is-stuck.is-at-top { + top: 0; } + .sticky.is-stuck.is-at-bottom { + bottom: 0; } + +.sticky.is-anchored { + position: absolute; + left: auto; + right: auto; } + .sticky.is-anchored.is-at-bottom { + bottom: 0; } + +.switch { + height: 2rem; + margin-bottom: 1rem; + outline: 0; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + color: #fefefe; + font-weight: bold; + font-size: 0.875rem; } + +.switch-input { + opacity: 0; + position: absolute; + margin-bottom: 0; } + +.switch-paddle { + background: #cacaca; + cursor: pointer; + display: block; + position: relative; + width: 4rem; + height: 2rem; + transition: all 0.25s ease-out; + border-radius: 0; + color: inherit; + font-weight: inherit; } + input + .switch-paddle { + margin: 0; } + .switch-paddle::after { + background: #fefefe; + content: ''; + display: block; + position: absolute; + height: 1.5rem; + left: 0.25rem; + top: 0.25rem; + width: 1.5rem; + transition: all 0.25s ease-out; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + border-radius: 0; } + input:checked ~ .switch-paddle { + background: #2199e8; } + input:checked ~ .switch-paddle::after { + left: 2.25rem; } + [data-whatinput='mouse'] input:focus ~ .switch-paddle { + outline: 0; } + +.switch-active, .switch-inactive { + position: absolute; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } + +.switch-active { + left: 8%; + display: none; } + input:checked + label > .switch-active { + display: block; } + +.switch-inactive { + right: 15%; } + input:checked + label > .switch-inactive { + display: none; } + +.switch.tiny { + height: 1.5rem; } + .switch.tiny .switch-paddle { + width: 3rem; + height: 1.5rem; + font-size: 0.625rem; } + .switch.tiny .switch-paddle::after { + width: 1rem; + height: 1rem; } + .switch.tiny input:checked ~ .switch-paddle::after { + left: 1.75rem; } + +.switch.small { + height: 1.75rem; } + .switch.small .switch-paddle { + width: 3.5rem; + height: 1.75rem; + font-size: 0.75rem; } + .switch.small .switch-paddle::after { + width: 1.25rem; + height: 1.25rem; } + .switch.small input:checked ~ .switch-paddle::after { + left: 2rem; } + +.switch.large { + height: 2.5rem; } + .switch.large .switch-paddle { + width: 5rem; + height: 2.5rem; + font-size: 1rem; } + .switch.large .switch-paddle::after { + width: 2rem; + height: 2rem; } + .switch.large input:checked ~ .switch-paddle::after { + left: 2.75rem; } + +table { + width: 100%; + margin-bottom: 1rem; + border-radius: 0; } + table thead, + table tbody, + table tfoot { + border: 1px solid #f1f1f1; + background-color: #fefefe; } + table caption { + font-weight: bold; + padding: 0.5rem 0.625rem 0.625rem; } + table thead { + background: #f8f8f8; + color: #0a0a0a; } + table tfoot { + background: #f1f1f1; + color: #0a0a0a; } + table thead tr, + table tfoot tr { + background: transparent; } + table thead th, + table thead td, + table tfoot th, + table tfoot td { + padding: 0.5rem 0.625rem 0.625rem; + font-weight: bold; + text-align: left; } + table tbody tr:nth-child(even) { + background-color: #f1f1f1; } + table tbody th, + table tbody td { + padding: 0.5rem 0.625rem 0.625rem; } + +@media screen and (max-width: 63.9375em) { + table.stack thead { + display: none; } + table.stack tfoot { + display: none; } + table.stack tr, + table.stack th, + table.stack td { + display: block; } + table.stack td { + border-top: 0; } } + +table.scroll { + display: block; + width: 100%; + overflow-x: auto; } + +table.hover thead tr:hover { + background-color: #f3f3f3; } + +table.hover tfoot tr:hover { + background-color: #ececec; } + +table.hover tbody tr:hover { + background-color: #f9f9f9; } + +table.hover tbody tr:nth-of-type(even):hover { + background-color: #ececec; } + +.table-scroll { + overflow-x: auto; } + .table-scroll table { + width: auto; } + +.tabs { + margin: 0; + list-style-type: none; + background: #fefefe; + border: 1px solid #e6e6e6; } + .tabs::before, .tabs::after { + content: ' '; + display: table; } + .tabs::after { + clear: both; } + +.tabs.vertical > li { + width: auto; + float: none; + display: block; } + +.tabs.simple > li > a { + padding: 0; } + .tabs.simple > li > a:hover { + background: transparent; } + +.tabs.primary { + background: #2199e8; } + .tabs.primary > li > a { + color: #fefefe; } + .tabs.primary > li > a:hover, .tabs.primary > li > a:focus { + background: #1893e4; } + +.tabs-title { + float: left; } + .tabs-title > a { + display: block; + padding: 1.25rem 1.5rem; + line-height: 1; + font-size: 0.75rem; } + .tabs-title > a:hover { + background: #fefefe; } + .tabs-title > a:focus, .tabs-title > a[aria-selected='true'] { + background: #e6e6e6; } + +.tabs-content { + background: #fefefe; + transition: all 0.5s ease; + border: 1px solid #e6e6e6; + border-top: 0; } + +.tabs-content.vertical { + border: 1px solid #e6e6e6; + border-left: 0; } + +.tabs-panel { + display: none; + padding: 1rem; } + .tabs-panel.is-active { + display: block; } + +.thumbnail { + border: solid 4px #fefefe; + box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); + display: inline-block; + line-height: 0; + max-width: 100%; + transition: box-shadow 200ms ease-out; + border-radius: 0; + margin-bottom: 1rem; } + .thumbnail:hover, .thumbnail:focus { + box-shadow: 0 0 6px 1px rgba(33, 153, 232, 0.5); } + +.title-bar { + background: #0a0a0a; + color: #fefefe; + padding: 0.5rem; } + .title-bar::before, .title-bar::after { + content: ' '; + display: table; } + .title-bar::after { + clear: both; } + .title-bar .menu-icon { + margin-left: 0.25rem; + margin-right: 0.25rem; } + +.title-bar-left { + float: left; } + +.title-bar-right { + float: right; + text-align: right; } + +.title-bar-title { + font-weight: bold; + vertical-align: middle; + display: inline-block; } + +.has-tip { + border-bottom: dotted 1px #8a8a8a; + font-weight: bold; + position: relative; + display: inline-block; + cursor: help; } + +.tooltip { + background-color: #0a0a0a; + color: #fefefe; + font-size: 80%; + padding: 0.75rem; + position: absolute; + z-index: 10; + top: calc(100% + 0.6495rem); + max-width: 10rem !important; + border-radius: 0; } + .tooltip::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent transparent #0a0a0a; + border-bottom-style: solid; + border-top-width: 0; + bottom: 100%; + position: absolute; + left: 50%; + -webkit-transform: translateX(-50%); + -ms-transform: translateX(-50%); + transform: translateX(-50%); } + .tooltip.top::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: #0a0a0a transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + top: 100%; + bottom: auto; } + .tooltip.left::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent transparent transparent #0a0a0a; + border-left-style: solid; + border-right-width: 0; + bottom: auto; + left: 100%; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } + .tooltip.right::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent #0a0a0a transparent transparent; + border-right-style: solid; + border-left-width: 0; + bottom: auto; + left: auto; + right: 100%; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } + +.top-bar { + padding: 0.5rem; } + .top-bar::before, .top-bar::after { + content: ' '; + display: table; } + .top-bar::after { + clear: both; } + .top-bar, + .top-bar ul { + background-color: #e6e6e6; } + .top-bar input { + max-width: 200px; + margin-right: 1rem; } + .top-bar .input-group-field { + width: 100%; + margin-right: 0; } + .top-bar input.button { + width: auto; } + .top-bar .top-bar-left, + .top-bar .top-bar-right { + width: 100%; } + @media screen and (min-width: 40em) { + .top-bar .top-bar-left, + .top-bar .top-bar-right { + width: auto; } } + @media screen and (max-width: 63.9375em) { + .top-bar.stacked-for-medium .top-bar-left, + .top-bar.stacked-for-medium .top-bar-right { + width: 100%; } } + @media screen and (max-width: 74.9375em) { + .top-bar.stacked-for-large .top-bar-left, + .top-bar.stacked-for-large .top-bar-right { + width: 100%; } } + +.top-bar-title { + float: left; + margin-right: 1rem; } + +.top-bar-left { + float: left; } + +.top-bar-right { + float: right; } + +.hide { + display: none !important; } + +.invisible { + visibility: hidden; } + +@media screen and (max-width: 39.9375em) { + .hide-for-small-only { + display: none !important; } } + +@media screen and (max-width: 0em), screen and (min-width: 40em) { + .show-for-small-only { + display: none !important; } } + +@media screen and (min-width: 40em) { + .hide-for-medium { + display: none !important; } } + +@media screen and (max-width: 39.9375em) { + .show-for-medium { + display: none !important; } } + +@media screen and (min-width: 40em) and (max-width: 63.9375em) { + .hide-for-medium-only { + display: none !important; } } + +@media screen and (max-width: 39.9375em), screen and (min-width: 64em) { + .show-for-medium-only { + display: none !important; } } + +@media screen and (min-width: 64em) { + .hide-for-large { + display: none !important; } } + +@media screen and (max-width: 63.9375em) { + .show-for-large { + display: none !important; } } + +@media screen and (min-width: 64em) and (max-width: 74.9375em) { + .hide-for-large-only { + display: none !important; } } + +@media screen and (max-width: 63.9375em), screen and (min-width: 75em) { + .show-for-large-only { + display: none !important; } } + +.show-for-sr, +.show-on-focus { + position: absolute !important; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); } + +.show-on-focus:active, .show-on-focus:focus { + position: static !important; + height: auto; + width: auto; + overflow: visible; + clip: auto; } + +.show-for-landscape, +.hide-for-portrait { + display: block !important; } + @media screen and (orientation: landscape) { + .show-for-landscape, + .hide-for-portrait { + display: block !important; } } + @media screen and (orientation: portrait) { + .show-for-landscape, + .hide-for-portrait { + display: none !important; } } + +.hide-for-landscape, +.show-for-portrait { + display: none !important; } + @media screen and (orientation: landscape) { + .hide-for-landscape, + .show-for-portrait { + display: none !important; } } + @media screen and (orientation: portrait) { + .hide-for-landscape, + .show-for-portrait { + display: block !important; } } + +.float-left { + float: left !important; } + +.float-right { + float: right !important; } + +.float-center { + display: block; + margin-left: auto; + margin-right: auto; } + +.clearfix::before, .clearfix::after { + content: ' '; + display: table; } + +.clearfix::after { + clear: both; } + +.slide-in-down.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-down.mui-enter.mui-enter-active { + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); } + +.slide-in-left.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(-100%); + -ms-transform: translateX(-100%); + transform: translateX(-100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-left.mui-enter.mui-enter-active { + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + +.slide-in-up.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-up.mui-enter.mui-enter-active { + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); } + +.slide-in-right.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-right.mui-enter.mui-enter-active { + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + +.slide-out-down.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-down.mui-leave.mui-leave-active { + -webkit-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); } + +.slide-out-right.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-right.mui-leave.mui-leave-active { + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); } + +.slide-out-up.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-up.mui-leave.mui-leave-active { + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); } + +.slide-out-left.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-left.mui-leave.mui-leave-active { + -webkit-transform: translateX(-100%); + -ms-transform: translateX(-100%); + transform: translateX(-100%); } + +.fade-in.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + opacity: 0; + transition-property: opacity; } + +.fade-in.mui-enter.mui-enter-active { + opacity: 1; } + +.fade-out.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + opacity: 1; + transition-property: opacity; } + +.fade-out.mui-leave.mui-leave-active { + opacity: 0; } + +.hinge-in-from-top.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + -webkit-transform-origin: top; + -ms-transform-origin: top; + transform-origin: top; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-top.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-right.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + -webkit-transform-origin: right; + -ms-transform-origin: right; + transform-origin: right; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-right.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-bottom.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(90deg); + transform: perspective(2000px) rotateX(90deg); + -webkit-transform-origin: bottom; + -ms-transform-origin: bottom; + transform-origin: bottom; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-bottom.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-left.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(90deg); + transform: perspective(2000px) rotateY(90deg); + -webkit-transform-origin: left; + -ms-transform-origin: left; + transform-origin: left; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-left.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-middle-x.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-middle-x.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-middle-y.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-middle-y.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-out-from-top.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: top; + -ms-transform-origin: top; + transform-origin: top; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-top.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + opacity: 0; } + +.hinge-out-from-right.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: right; + -ms-transform-origin: right; + transform-origin: right; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-right.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + opacity: 0; } + +.hinge-out-from-bottom.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: bottom; + -ms-transform-origin: bottom; + transform-origin: bottom; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-bottom.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(90deg); + transform: perspective(2000px) rotateX(90deg); + opacity: 0; } + +.hinge-out-from-left.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: left; + -ms-transform-origin: left; + transform-origin: left; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-left.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(90deg); + transform: perspective(2000px) rotateY(90deg); + opacity: 0; } + +.hinge-out-from-middle-x.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-middle-x.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + opacity: 0; } + +.hinge-out-from-middle-y.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-middle-y.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + opacity: 0; } + +.scale-in-up.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(0.5); + -ms-transform: scale(0.5); + transform: scale(0.5); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.scale-in-up.mui-enter.mui-enter-active { + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + opacity: 1; } + +.scale-in-down.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1.5); + -ms-transform: scale(1.5); + transform: scale(1.5); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.scale-in-down.mui-enter.mui-enter-active { + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + opacity: 1; } + +.scale-out-up.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.scale-out-up.mui-leave.mui-leave-active { + -webkit-transform: scale(1.5); + -ms-transform: scale(1.5); + transform: scale(1.5); + opacity: 0; } + +.scale-out-down.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.scale-out-down.mui-leave.mui-leave-active { + -webkit-transform: scale(0.5); + -ms-transform: scale(0.5); + transform: scale(0.5); + opacity: 0; } + +.spin-in.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(-0.75turn); + -ms-transform: rotate(-0.75turn); + transform: rotate(-0.75turn); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.spin-in.mui-enter.mui-enter-active { + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + opacity: 1; } + +.spin-out.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.spin-out.mui-leave.mui-leave-active { + -webkit-transform: rotate(0.75turn); + -ms-transform: rotate(0.75turn); + transform: rotate(0.75turn); + opacity: 0; } + +.spin-in-ccw.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0.75turn); + -ms-transform: rotate(0.75turn); + transform: rotate(0.75turn); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.spin-in-ccw.mui-enter.mui-enter-active { + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + opacity: 1; } + +.spin-out-ccw.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.spin-out-ccw.mui-leave.mui-leave-active { + -webkit-transform: rotate(-0.75turn); + -ms-transform: rotate(-0.75turn); + transform: rotate(-0.75turn); + opacity: 0; } + +.slow { + transition-duration: 750ms !important; } + +.fast { + transition-duration: 250ms !important; } + +.linear { + transition-timing-function: linear !important; } + +.ease { + transition-timing-function: ease !important; } + +.ease-in { + transition-timing-function: ease-in !important; } + +.ease-out { + transition-timing-function: ease-out !important; } + +.ease-in-out { + transition-timing-function: ease-in-out !important; } + +.bounce-in { + transition-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } + +.bounce-out { + transition-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } + +.bounce-in-out { + transition-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } + +.short-delay { + transition-delay: 300ms !important; } + +.long-delay { + transition-delay: 700ms !important; } + +.shake { + -webkit-animation-name: shake-7; + animation-name: shake-7; } + +@-webkit-keyframes shake-7 { + 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { + -webkit-transform: translateX(7%); + transform: translateX(7%); } + 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { + -webkit-transform: translateX(-7%); + transform: translateX(-7%); } } + +@keyframes shake-7 { + 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { + -webkit-transform: translateX(7%); + transform: translateX(7%); } + 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { + -webkit-transform: translateX(-7%); + transform: translateX(-7%); } } + +.spin-cw { + -webkit-animation-name: spin-cw-1turn; + animation-name: spin-cw-1turn; } + +@-webkit-keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(-1turn); + transform: rotate(-1turn); } + 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +@keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(-1turn); + transform: rotate(-1turn); } + 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +.spin-ccw { + -webkit-animation-name: spin-cw-1turn; + animation-name: spin-cw-1turn; } + +@keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); } + 100% { + -webkit-transform: rotate(1turn); + transform: rotate(1turn); } } + +.wiggle { + -webkit-animation-name: wiggle-7deg; + animation-name: wiggle-7deg; } + +@-webkit-keyframes wiggle-7deg { + 40%, 50%, 60% { + -webkit-transform: rotate(7deg); + transform: rotate(7deg); } + 35%, 45%, 55%, 65% { + -webkit-transform: rotate(-7deg); + transform: rotate(-7deg); } + 0%, 30%, 70%, 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +@keyframes wiggle-7deg { + 40%, 50%, 60% { + -webkit-transform: rotate(7deg); + transform: rotate(7deg); } + 35%, 45%, 55%, 65% { + -webkit-transform: rotate(-7deg); + transform: rotate(-7deg); } + 0%, 30%, 70%, 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +.shake, +.spin-cw, +.spin-ccw, +.wiggle { + -webkit-animation-duration: 500ms; + animation-duration: 500ms; } + +.infinite { + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; } + +.slow { + -webkit-animation-duration: 750ms !important; + animation-duration: 750ms !important; } + +.fast { + -webkit-animation-duration: 250ms !important; + animation-duration: 250ms !important; } + +.linear { + -webkit-animation-timing-function: linear !important; + animation-timing-function: linear !important; } + +.ease { + -webkit-animation-timing-function: ease !important; + animation-timing-function: ease !important; } + +.ease-in { + -webkit-animation-timing-function: ease-in !important; + animation-timing-function: ease-in !important; } + +.ease-out { + -webkit-animation-timing-function: ease-out !important; + animation-timing-function: ease-out !important; } + +.ease-in-out { + -webkit-animation-timing-function: ease-in-out !important; + animation-timing-function: ease-in-out !important; } + +.bounce-in { + -webkit-animation-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; + animation-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } + +.bounce-out { + -webkit-animation-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; + animation-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } + +.bounce-in-out { + -webkit-animation-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; + animation-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } + +.short-delay { + -webkit-animation-delay: 300ms !important; + animation-delay: 300ms !important; } + +.long-delay { + -webkit-animation-delay: 700ms !important; + animation-delay: 700ms !important; } diff --git a/build/index.html b/build/index.html index 00eb541..7d84a3f 100644 --- a/build/index.html +++ b/build/index.html @@ -3,8 +3,68 @@ Tic-Tac-Toe + + + +
+

Tic-Tac-Toe

+ + +
+
+

Current Player:

+

X

+

O

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ x + + x + + x +
+ x + + x + + x +
+ x + + x + + x +
+
+ +
From d08897e631cf80dbb8e92e28124f8b9785108e74 Mon Sep 17 00:00:00 2001 From: Yasmin Date: Mon, 19 Dec 2016 10:48:27 -0800 Subject: [PATCH 21/40] WIP: DOM events --- build/css/app.css | 13 +++-- build/index.html | 85 +++++++++++++++---------------- src/app.js | 12 +++-- src/app/views/app_view.js | 3 -- src/app/views/game_view.js | 35 +++++++++++++ src/app/views/space_board_view.js | 25 +++++++++ 6 files changed, 119 insertions(+), 54 deletions(-) delete mode 100644 src/app/views/app_view.js diff --git a/build/css/app.css b/build/css/app.css index 4370887..a4aa508 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -19,14 +19,17 @@ table { border-style: hidden; } -table td { - border: 1px solid black; -} - table tr:nth-of-type(even) { background-color: transparent !important; } td { - font-size: 600%; + border: 1px solid black; + font-size: 100px; + width: 50px; + height: 150px; +} + +.hide { + display: none; } diff --git a/build/index.html b/build/index.html index 7d84a3f..8c47931 100644 --- a/build/index.html +++ b/build/index.html @@ -9,61 +9,60 @@ -
+

Tic-Tac-Toe

+ -
-
-

Current Player:

-

X

-

O

-
+
+

Current Player:

+

X

+

O

+
- - - +
- x -
+ + - + - - + + - - + + - + - - + + - - + + - + - - -
+ + - x - + + - x -
+ +
- x -
+ + - x - + + - x -
+ +
- x -
+ + - x - + + - x -
-
+ + + + +
diff --git a/src/app.js b/src/app.js index 32a0404..b4bb19a 100644 --- a/src/app.js +++ b/src/app.js @@ -1,8 +1,14 @@ -// import Application from 'app/models/application'; **** DO WE NEED THIS???? -// import ApplicationView from 'app/views/app_view'; +import Backbone from 'backbone'; import $ from 'jquery'; +import Game from 'app/models/game'; +import GameView from 'app/views/game_view'; -$(document).ready(function() { +$(document).ready(function() { + var gameview = new GameView({ + el: '#game-view', + model: game + }); + gameview.render(); }); diff --git a/src/app/views/app_view.js b/src/app/views/app_view.js deleted file mode 100644 index 12c5123..0000000 --- a/src/app/views/app_view.js +++ /dev/null @@ -1,3 +0,0 @@ - - -export default AppView; diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 5031919..a2367b8 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -1,3 +1,38 @@ +import Backbone from 'backbone'; +import $ from 'jquery'; +import Game from 'app/models/game'; +import PlayerView from 'app/views/player_view'; +import SpaceBoardView from 'app/views/space_board_view'; + +var GameView = Backbone.View.extend({ + + initialize: function() { + var spaceBoardView = new SpaceBoardView({ + el: '#space-board-view' + }) + + var playerView = new PlayerView({ + el: '#player-view' + }) + + spaceBoardView.render(); + playerView.render(); + }, + + render: function() { + + return this; + }, + + events { + 'click .start-game': 'startGame' + }, + + startGame: function() { + console.log("Starting a game") + } + +}); export default GameView; diff --git a/src/app/views/space_board_view.js b/src/app/views/space_board_view.js index 3294ccd..2abe25a 100644 --- a/src/app/views/space_board_view.js +++ b/src/app/views/space_board_view.js @@ -1,3 +1,28 @@ +import Backbone from 'backbone'; +import $ from 'jquery'; +import Game from 'app/models/game'; +// import SpaceView from 'app/views/space_view'; + +var SpaceBoardView = Backbone.View.extend({ + + initialize: function() { + + }; + + events { + 'click .space': 'spaceClick' + }; + + spaceClick: function() { + console.log("A space clicked!") + }; + + render: function() { + + return this; + }; + +}); export default SpaceBoardView; From abce88a2e3b6063c638769438f4631f7b63d6269 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 19 Dec 2016 12:03:08 -0800 Subject: [PATCH 22/40] set up click events and currentTarget for spaces in spaceClick Function --- build/css/app.css | 4 --- build/index.html | 48 ++++++++----------------------- src/app.js | 3 ++ src/app/models/game.js | 30 ++++++++++++------- src/app/views/game_view.js | 10 +++---- src/app/views/player_view.js | 17 +++++++++++ src/app/views/space_board_view.js | 20 +++++++------ 7 files changed, 68 insertions(+), 64 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index a4aa508..4e1b16e 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -29,7 +29,3 @@ td { width: 50px; height: 150px; } - -.hide { - display: none; -} diff --git a/build/index.html b/build/index.html index 8c47931..d73f980 100644 --- a/build/index.html +++ b/build/index.html @@ -9,12 +9,12 @@ -
+

Tic-Tac-Toe

- + -
+

Current Player:

X

O

@@ -22,45 +22,21 @@

O

- - - - - + + + - - - - - + + + - - - - - + + +
- - - - - -
- - - - - -
- - - - - -
diff --git a/src/app.js b/src/app.js index b4bb19a..b36b177 100644 --- a/src/app.js +++ b/src/app.js @@ -6,9 +6,12 @@ import GameView from 'app/views/game_view'; $(document).ready(function() { + var game = new Game(); + var gameview = new GameView({ el: '#game-view', model: game }); + gameview.render(); }); diff --git a/src/app/models/game.js b/src/app/models/game.js index 83811c9..ded858c 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -1,14 +1,22 @@ -var Game = function() { - this.board = new GameBoard(); - this.player1 = new Player1(); - this.player2 = new Player2(); - this.gameCounter = true; - this.turnCounter = 0; - this.winner = null; - console.log(this.board); - // console.log(this.player1); - // console.log(this.player2); -}; +import Backbone from 'backbone'; + +const Game = Backbone.Model.extend({ + // This model should have the attributes for + // a single contact: name, phone number, and email. + + initialize: function() { + this.board = new GameBoard(); + this.player1 = new Player1(); + this.player2 = new Player2(); + this.gameCounter = true; + this.turnCounter = 0; + this.winner = null; + console.log(this.board); + // console.log(this.player1); + // console.log(this.player2); + }, + +}); Game.prototype.playTurn = function(row, column) { if(this.winner !== null) { diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index a2367b8..be29617 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -10,11 +10,11 @@ var GameView = Backbone.View.extend({ initialize: function() { var spaceBoardView = new SpaceBoardView({ el: '#space-board-view' - }) + }); var playerView = new PlayerView({ el: '#player-view' - }) + }); spaceBoardView.render(); playerView.render(); @@ -25,12 +25,12 @@ var GameView = Backbone.View.extend({ return this; }, - events { - 'click .start-game': 'startGame' + events: { + 'click .start-game-button': 'startGame' }, startGame: function() { - console.log("Starting a game") + console.log("Starting a game"); } }); diff --git a/src/app/views/player_view.js b/src/app/views/player_view.js index 723f6bd..6540c92 100644 --- a/src/app/views/player_view.js +++ b/src/app/views/player_view.js @@ -1,3 +1,20 @@ +import Backbone from 'backbone'; +import $ from 'jquery'; +import Game from 'app/models/game'; +// import SpaceView from 'app/views/space_view'; + +var PlayerView = Backbone.View.extend({ + + initialize: function() { + + }, + + render: function() { + + return this; + } + +}); export default PlayerView; diff --git a/src/app/views/space_board_view.js b/src/app/views/space_board_view.js index 2abe25a..7625c7b 100644 --- a/src/app/views/space_board_view.js +++ b/src/app/views/space_board_view.js @@ -8,20 +8,24 @@ var SpaceBoardView = Backbone.View.extend({ initialize: function() { - }; + }, - events { - 'click .space': 'spaceClick' - }; + events: { + 'click td': 'spaceClick' + }, - spaceClick: function() { - console.log("A space clicked!") - }; + spaceClick: function(event) { + console.log(event.currentTarget.id); + var id = event.currentTarget.id; + var marker = "X"; + + event.currentTarget.append(marker); + }, render: function() { return this; - }; + } }); From 3fd8a2afc2ddcc491bdd19eae72193df267cc809 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 19 Dec 2016 12:24:15 -0800 Subject: [PATCH 23/40] used vw in td in .css to make table responsive --- build/css/app.css | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 4e1b16e..9676b67 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -6,7 +6,7 @@ body { } h1 { - font-size: 36px; + font-size: 28px; } #space-board-view { @@ -15,8 +15,9 @@ h1 { } table { - border-collapse: collapse; - border-style: hidden; + table-layout: fixed; + border-collapse: collapse; + border-style: hidden; } table tr:nth-of-type(even) { @@ -25,7 +26,8 @@ table tr:nth-of-type(even) { td { border: 1px solid black; - font-size: 100px; - width: 50px; - height: 150px; + font-size: 6vw; + width: 11vw; + height: 11vw; + padding: 0; } From 426860fdc1f32306e24f81181ed6fb0ab9b3de05 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 19 Dec 2016 16:31:01 -0800 Subject: [PATCH 24/40] completed coverting js to models and converting all tests to pass --- spec/game.spec.js | 59 ++++++------ src/app/models/game.js | 182 ++++++++++++----------------------- src/app/models/game_board.js | 54 +++++++++++ 3 files changed, 149 insertions(+), 146 deletions(-) create mode 100644 src/app/models/game_board.js diff --git a/spec/game.spec.js b/spec/game.spec.js index 19f5e3c..bc3a8da 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -1,36 +1,36 @@ -import Game from 'game'; -import GameBoard from 'game'; +import Game from 'app/models/game'; +import GameBoard from 'app/models/game_board'; describe('Game', function() { var testGame = new Game(); var testBoard = new GameBoard(); - it("should create a gameBoard with initialized", function() { + it("should create a gameBoard when initialized", function() { expect(testGame.board).toBeDefined(); - expect(testGame.board).toEqual(testBoard.board); + // expect(testGame.board).toEqual(testBoard.board); expect(testGame.board.gameBoard).toEqual(jasmine.any(Array)); }); it('should initialize the correct Player for player1', function() { - expect(testGame.player1.marker).toEqual("X"); - expect(testGame.player1.turnCounter).toEqual(true); + expect(testGame.get('player1').marker).toEqual("X"); + expect(testGame.get('player1').turnId).toEqual(true); }); it('should initialize the correct Player for player2', function() { - expect(testGame.player2.marker).toEqual("O"); - expect(testGame.player2.turnCounter).toEqual(false); + expect(testGame.get('player2').marker).toEqual("O"); + expect(testGame.get('player2').turnId).toEqual(false); }); describe('whichPlayer', function() { var testGame2 = new Game(); - testGame2.gameCounter = false; + testGame2.set('gameCounter', false); it('should return Player1 for a new game because counter equals true', function(){ - expect(testGame.whichPlayer()).toEqual(testGame.player1); + expect(testGame.whichPlayer()).toEqual(testGame.get('player1')); }); it('should return Player2 if gameCounter equals false', function(){ - expect(testGame2.whichPlayer()).toEqual(testGame.player2); + expect(testGame2.whichPlayer()).toEqual(testGame.get('player2')); }); }); @@ -56,49 +56,52 @@ describe('Game', function() { it('should add a player1 marker (X) if the space is open', function() { expect(testGame4.board.gameBoard[0][0]).toEqual(null); - expect(testGame4.gameCounter).toEqual(true); - expect(testGame4.turnCounter).toEqual(0); + expect(testGame4.get('gameCounter')).toEqual(true); + expect(testGame4.get('turnCounter')).toEqual(0); testGame4.playTurn(0,0); - expect(testGame4.gameCounter).toEqual(false); - expect(testGame4.turnCounter).toEqual(1); + expect(testGame4.get('gameCounter')).toEqual(false); + expect(testGame4.get('turnCounter')).toEqual(1); expect(testGame4.board.gameBoard[0][0]).toEqual('X'); }); it('should not add a players marker if the space is taken', function() { expect(testGame4.board.gameBoard[0][0]).toEqual('X'); - expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.get('gameCounter')).toEqual(false); testGame4.playTurn(0,0); - expect(testGame4.gameCounter).toEqual(false); - expect(testGame4.turnCounter).toEqual(1); + expect(testGame4.get('gameCounter')).toEqual(false); + expect(testGame4.get('turnCounter')).toEqual(1); expect(testGame4.board.gameBoard[0][0]).toEqual('X'); }); it('should add player2 marker (O) if the space is open', function() { expect(testGame4.board.gameBoard[2][2]).toEqual(null); - expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.get('gameCounter')).toEqual(false); + // expect(testGame4.get('turnCounter')).toEqual(1); + console.log(">>>>>>>>>>>>>>>>" + testGame4.get('turnCounter')); testGame4.playTurn(2,2); - expect(testGame4.gameCounter).toEqual(true); - expect(testGame4.turnCounter).toEqual(2); + console.log(">>>>>>>>>>>>>>>>" + testGame4.get('turnCounter')); + expect(testGame4.get('gameCounter')).toEqual(true); + expect(testGame4.get('turnCounter')).toEqual(2); expect(testGame4.board.gameBoard[2][2]).toEqual('O'); }); var testWinner = new Game(); - testWinner.turnCounter = 4; + testWinner.set('turnCounter', 4); testWinner.board.gameBoard[0][0] = "X"; testWinner.board.gameBoard[0][1] = "X"; it('should return a winner if someone has won after their turn', function() { - console.log(testWinner.winner); - expect(testWinner.playTurn(0,2)).toEqual(testWinner.player1.name); - console.log(testWinner.winner); + console.log(testWinner.get('winner')); + expect(testWinner.playTurn(0,2)).toEqual(testWinner.get('player1').name); + console.log(testWinner.get('winner')); }); it('should return a Game Over if game is already won and you try to play a turn', function() { - expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.winner.name + " won."); + expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.get('winner').name + " won."); }); }); }); @@ -170,7 +173,7 @@ describe('GameBoard', function() { test3Nulls.playTurn(0,2); test3Nulls.playTurn(2,2); it('should return false if a player has not won but there have been 5 rounds and there are 3 nulls in a row', function() { - expect(test3Nulls.winner).toEqual(null); + expect(test3Nulls.get('winner')).toEqual(null); expect(test3Nulls.board.hasWon()).toEqual(false); }); @@ -203,7 +206,7 @@ describe('GameBoard', function() { it('should return false when a player hasnt won', function() { expect(findBug.board.hasWon()).toEqual(false); - }) + }); var hasNotWonGame = new Game(); hasNotWonGame.board.gameBoard[0][2] = "X"; diff --git a/src/app/models/game.js b/src/app/models/game.js index ded858c..7a36e87 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -1,144 +1,90 @@ import Backbone from 'backbone'; +import $ from 'jquery'; +import GameBoard from 'app/models/game_board'; const Game = Backbone.Model.extend({ // This model should have the attributes for // a single contact: name, phone number, and email. + defaults: { + player1: { + marker: "X", + turnId: true, + name: "player1" + }, + player2: { + marker: "O", + turnId: false, + name: "player2" + }, + gameCounter: true, + turnCounter: 0, + winner: null + }, initialize: function() { this.board = new GameBoard(); - this.player1 = new Player1(); - this.player2 = new Player2(); - this.gameCounter = true; - this.turnCounter = 0; - this.winner = null; - console.log(this.board); - // console.log(this.player1); - // console.log(this.player2); }, -}); + playTurn: function(row, column) { + if(this.get('winner') !== null) { + console.log("Game is Over " + this.get('winner').name + " won."); + return "Game is Over " + this.get('winner').name + " won."; + } else { + var player = this.whichPlayer(); -Game.prototype.playTurn = function(row, column) { - if(this.winner !== null) { - console.log("Game is Over " + this.winner.name + " won."); - return "Game is Over " + this.winner.name + " won."; - } else { - // console.log(this.whichPlayer()); - var player = this.whichPlayer(); - // console.log(this.valid(row, column)); - if (this.valid(row, column)) { - this.board.gameBoard[row][column] = player.marker; + if (this.valid(row, column)) { + this.board.gameBoard[row][column] = player.marker; - if (player == this.player1) { - this.gameCounter = false; - this.turnCounter++ ; - } else { - this.gameCounter = true; - this.turnCounter++ ; - } + if (player == this.get('player1')) { + this.set('gameCounter', false); + this.set('turnCounter', this.get('turnCounter') + 1); + } else { + this.set('gameCounter', true); + this.set('turnCounter', this.get('turnCounter') + 1); + } - if(this.turnCounter >= 5) { - if(this.board.hasWon() === true) { - console.log(player + " you're the Winner!!!"); - this.winner = player; - return player.name; - } else if(this.board.hasWon() === "tie") { - console.log("Cat's Game, it's a tie."); - // return "Cat's Game."; + if(this.get('turnCounter') >= 5) { + if(this.board.hasWon() === true) { + console.log(player + " you're the Winner!!!"); + this.set('winner', player); + return player.name; + } else if(this.board.hasWon() === "tie") { + console.log("Cat's Game, it's a tie."); + // return "Cat's Game."; + } } + } else { + console.log("That position is already taken, go Again"); } - - } else { - console.log("That position is already taken, go Again"); + console.log(this.board.gameBoard); + console.log("who's turn: " + this.get('gameCounter')); + console.log("round number: " + this.get('turnCounter')); } - console.log(this.board); - console.log("who's turn: " + this.gameCounter); - console.log("round number: " + this.turnCounter); - } -}; - -Game.prototype.whichPlayer = function() { - if (this.gameCounter === true) { - return this.player1; - } else { - return this.player2; - } -}; + }, -Game.prototype.valid = function(row,column) { - if((row > 2) || (column > 2)) { - console.log(row + "," + column + " is not a valid location"); - return false; - } else { - var locationValue = this.board.gameBoard[row][column]; - console.log("in valid, location value = " + locationValue); - if (locationValue != 'X' && locationValue != 'O') { - return true; + whichPlayer: function() { + if (this.get('gameCounter') === this.get('player1').turnId) { + return this.get('player1'); } else { - return false; + return this.get('player2'); } - } -}; - -var GameBoard = function() { - this.gameBoard = []; - this.gameBoard[0] = [ null, null, null]; - this.gameBoard[1] = [ null, null, null]; - this.gameBoard[2] = [ null, null, null]; -}; - -GameBoard.prototype.hasWon = function() { - // var board = this.gameBoard; - var row0 = this.gameBoard[0]; - var row1 = this.gameBoard[1]; - var row2 = this.gameBoard[2]; + }, - if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== null) || - (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== null) || - (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== null)) { - console.log("Winner in a row"); - return true; - } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== null) || - (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== null) || - (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== null)) { - console.log("Winner in a column"); - return true; - } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== null)) { - console.log("Winner in a diagonal"); - return true; - } else { - if(this.aTie()){ - return "tie"; - } else { + valid: function(row,column) { + if((row > 2) || (column > 2)) { + console.log(row + "," + column + " is not a valid location"); return false; + } else { + var locationValue = this.board.gameBoard[row][column]; + console.log("in valid, location value = " + locationValue); + if (locationValue != 'X' && locationValue != 'O') { + return true; + } else { + return false; + } } } -}; - -GameBoard.prototype.aTie = function() { - var row0 = this.gameBoard[0]; - var row1 = this.gameBoard[1]; - var row2 = this.gameBoard[2]; - - if((row0.includes(null)) || (row1.includes(null)) || (row2.includes(null))) { - return false; - } else { - return true; - } -}; - -var Player1 = function() { - this.marker = "X"; - this.turnCounter = true; - this.name = "player1"; -}; - -var Player2 = function() { - this.marker = "O"; - this.turnCounter = false; - this.name = "player2"; -}; - +}); // DO NOT REMOVE THIS export default Game; diff --git a/src/app/models/game_board.js b/src/app/models/game_board.js new file mode 100644 index 0000000..091fa09 --- /dev/null +++ b/src/app/models/game_board.js @@ -0,0 +1,54 @@ +import Backbone from 'backbone'; +// import $ from 'jquery'; + +const GameBoard = Backbone.Model.extend({ + initialize: function() { + this.gameBoard = []; + this.gameBoard[0] = [ null, null, null]; + this.gameBoard[1] = [ null, null, null]; + this.gameBoard[2] = [ null, null, null]; + }, + + hasWon: function() { + // var board = this.gameBoard; + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== null) || + (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== null) || + (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== null)) { + console.log("Winner in a row"); + return true; + } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== null) || + (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== null) || + (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== null)) { + console.log("Winner in a column"); + return true; + } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== null)) { + console.log("Winner in a diagonal"); + return true; + } else { + if(this.aTie()){ + return "tie"; + } else { + return false; + } + } + }, + + aTie: function() { + var row0 = this.gameBoard[0]; + var row1 = this.gameBoard[1]; + var row2 = this.gameBoard[2]; + + if((row0.includes(null)) || (row1.includes(null)) || (row2.includes(null))) { + return false; + } else { + return true; + } + } +}); + +// DO NOT REMOVE THIS +export default GameBoard; From 0811a4c70f23cc4e3f17408f802a436221eceb59 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 19 Dec 2016 17:40:25 -0800 Subject: [PATCH 25/40] selectSpace trigger and listenTo are functioning and passing thru space id --- build/css/app.css | 2 +- build/index.html | 2 +- src/app/views/game_view.js | 24 ++++++++++++++++++----- src/app/views/gameboard_view.js | 32 +++++++++++++++++++++++++++++++ src/app/views/space_board_view.js | 32 ------------------------------- 5 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 src/app/views/gameboard_view.js delete mode 100644 src/app/views/space_board_view.js diff --git a/build/css/app.css b/build/css/app.css index 9676b67..16a78a0 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -9,7 +9,7 @@ h1 { font-size: 28px; } -#space-board-view { +#gameboard-view { width: 35%; text-align: center; } diff --git a/build/index.html b/build/index.html index d73f980..9d07d5c 100644 --- a/build/index.html +++ b/build/index.html @@ -20,7 +20,7 @@

X

O

- +
diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index be29617..91cea05 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -3,20 +3,22 @@ import $ from 'jquery'; import Game from 'app/models/game'; import PlayerView from 'app/views/player_view'; -import SpaceBoardView from 'app/views/space_board_view'; +import GameBoardView from 'app/views/gameboard_view'; -var GameView = Backbone.View.extend({ +const GameView = Backbone.View.extend({ initialize: function() { - var spaceBoardView = new SpaceBoardView({ - el: '#space-board-view' + var gameBoardView = new GameBoardView({ + el: '#gameboard-view' }); var playerView = new PlayerView({ el: '#player-view' }); - spaceBoardView.render(); + this.listenTo(gameBoardView, 'selectSpace', this.playTurn); + + gameBoardView.render(); playerView.render(); }, @@ -31,6 +33,18 @@ var GameView = Backbone.View.extend({ startGame: function() { console.log("Starting a game"); + }, + + playTurn: function(event) { + console.log(event.id); + var locationClicked = event.id; + + this.model.playTurn(); + // var player = ; + // var marker = "X"; + // + // + // event.currentTarget.append(marker); } }); diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js new file mode 100644 index 0000000..e1730b4 --- /dev/null +++ b/src/app/views/gameboard_view.js @@ -0,0 +1,32 @@ +import Backbone from 'backbone'; +import $ from 'jquery'; + +// import Game from 'app/models/game'; + +var GameBoardView = Backbone.View.extend({ + + initialize: function() { + + }, + + events: { + 'click td': 'spaceClick' + }, + + spaceClick: function(event) { + this.trigger('selectSpace', event.currentTarget); + + // We return false to tell jQuery not to run any more event handlers. + // Otherwise, it would run the 'click' event handler on RolodexView + // as well. + return false; + }, + + render: function() { + + return this; + } + +}); + +export default GameBoardView; diff --git a/src/app/views/space_board_view.js b/src/app/views/space_board_view.js deleted file mode 100644 index 7625c7b..0000000 --- a/src/app/views/space_board_view.js +++ /dev/null @@ -1,32 +0,0 @@ -import Backbone from 'backbone'; -import $ from 'jquery'; - -import Game from 'app/models/game'; -// import SpaceView from 'app/views/space_view'; - -var SpaceBoardView = Backbone.View.extend({ - - initialize: function() { - - }, - - events: { - 'click td': 'spaceClick' - }, - - spaceClick: function(event) { - console.log(event.currentTarget.id); - var id = event.currentTarget.id; - var marker = "X"; - - event.currentTarget.append(marker); - }, - - render: function() { - - return this; - } - -}); - -export default SpaceBoardView; From 3250ed09b546da730dd657b8c8c61c04d9d15c84 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 20 Dec 2016 12:17:03 -0800 Subject: [PATCH 26/40] moved some dynamic attributes to initializer instead of default --- spec/game.spec.js | 42 +++++++++++++++++---------------- src/app/models/game.js | 30 +++++++++++------------ src/app/models/game_board.js | 5 +--- src/app/views/game_view.js | 2 +- src/app/views/gameboard_view.js | 17 ++++++++++--- 5 files changed, 53 insertions(+), 43 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index bc3a8da..816ba7a 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -23,7 +23,7 @@ describe('Game', function() { describe('whichPlayer', function() { var testGame2 = new Game(); - testGame2.set('gameCounter', false); + testGame2.gameCounter = false; it('should return Player1 for a new game because counter equals true', function(){ expect(testGame.whichPlayer()).toEqual(testGame.get('player1')); @@ -56,52 +56,54 @@ describe('Game', function() { it('should add a player1 marker (X) if the space is open', function() { expect(testGame4.board.gameBoard[0][0]).toEqual(null); - expect(testGame4.get('gameCounter')).toEqual(true); - expect(testGame4.get('turnCounter')).toEqual(0); + expect(testGame4.gameCounter).toEqual(true); + expect(testGame4.turnCounter).toEqual(0); testGame4.playTurn(0,0); - expect(testGame4.get('gameCounter')).toEqual(false); - expect(testGame4.get('turnCounter')).toEqual(1); + expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.turnCounter).toEqual(1); expect(testGame4.board.gameBoard[0][0]).toEqual('X'); }); it('should not add a players marker if the space is taken', function() { expect(testGame4.board.gameBoard[0][0]).toEqual('X'); - expect(testGame4.get('gameCounter')).toEqual(false); + expect(testGame4.gameCounter).toEqual(false); testGame4.playTurn(0,0); - expect(testGame4.get('gameCounter')).toEqual(false); - expect(testGame4.get('turnCounter')).toEqual(1); + expect(testGame4.gameCounter).toEqual(false); + expect(testGame4.turnCounter).toEqual(1); expect(testGame4.board.gameBoard[0][0]).toEqual('X'); }); it('should add player2 marker (O) if the space is open', function() { expect(testGame4.board.gameBoard[2][2]).toEqual(null); - expect(testGame4.get('gameCounter')).toEqual(false); - // expect(testGame4.get('turnCounter')).toEqual(1); - console.log(">>>>>>>>>>>>>>>>" + testGame4.get('turnCounter')); + expect(testGame4.gameCounter).toEqual(false); + // expect(testGame4.turnCounter).toEqual(1); + console.log(">>>>>>>>>>>>>>>>" + testGame4.turnCounter); testGame4.playTurn(2,2); - console.log(">>>>>>>>>>>>>>>>" + testGame4.get('turnCounter')); - expect(testGame4.get('gameCounter')).toEqual(true); - expect(testGame4.get('turnCounter')).toEqual(2); + console.log(">>>>>>>>>>>>>>>>" + testGame4.turnCounter); + expect(testGame4.gameCounter).toEqual(true); + expect(testGame4.turnCounter).toEqual(2); expect(testGame4.board.gameBoard[2][2]).toEqual('O'); }); var testWinner = new Game(); - testWinner.set('turnCounter', 4); + testWinner.turnCounter = 4; testWinner.board.gameBoard[0][0] = "X"; testWinner.board.gameBoard[0][1] = "X"; it('should return a winner if someone has won after their turn', function() { - console.log(testWinner.get('winner')); - expect(testWinner.playTurn(0,2)).toEqual(testWinner.get('player1').name); - console.log(testWinner.get('winner')); + // console.log("********" + testWinner.winner); + // console.log(testWinner.board.gameboard; + testWinner.playTurn(0,2); + expect(testWinner.winner).toEqual(testWinner.get('player1')); + // console.log("********" + testWinner.winner); }); it('should return a Game Over if game is already won and you try to play a turn', function() { - expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.get('winner').name + " won."); + expect(testWinner.playTurn(2,2)).toEqual("Game is Over " + testWinner.winner.name + " won."); }); }); }); @@ -173,7 +175,7 @@ describe('GameBoard', function() { test3Nulls.playTurn(0,2); test3Nulls.playTurn(2,2); it('should return false if a player has not won but there have been 5 rounds and there are 3 nulls in a row', function() { - expect(test3Nulls.get('winner')).toEqual(null); + expect(test3Nulls.winner).toEqual(null); expect(test3Nulls.board.hasWon()).toEqual(false); }); diff --git a/src/app/models/game.js b/src/app/models/game.js index 7a36e87..2615116 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -16,19 +16,19 @@ const Game = Backbone.Model.extend({ turnId: false, name: "player2" }, - gameCounter: true, - turnCounter: 0, - winner: null }, initialize: function() { this.board = new GameBoard(); + this.gameCounter = true; + this.turnCounter = 0; + this.winner = null; }, playTurn: function(row, column) { - if(this.get('winner') !== null) { - console.log("Game is Over " + this.get('winner').name + " won."); - return "Game is Over " + this.get('winner').name + " won."; + if(this.winner !== null) { + console.log("Game is Over " + this.winner.name + " won."); + return "Game is Over " + this.winner.name + " won."; } else { var player = this.whichPlayer(); @@ -36,17 +36,17 @@ const Game = Backbone.Model.extend({ this.board.gameBoard[row][column] = player.marker; if (player == this.get('player1')) { - this.set('gameCounter', false); - this.set('turnCounter', this.get('turnCounter') + 1); + this.gameCounter = false; + this.turnCounter++; } else { - this.set('gameCounter', true); - this.set('turnCounter', this.get('turnCounter') + 1); + this.gameCounter = true; + this.turnCounter++ ; } - if(this.get('turnCounter') >= 5) { + if(this.turnCounter >= 5) { if(this.board.hasWon() === true) { console.log(player + " you're the Winner!!!"); - this.set('winner', player); + this.winner = player; return player.name; } else if(this.board.hasWon() === "tie") { console.log("Cat's Game, it's a tie."); @@ -57,13 +57,13 @@ const Game = Backbone.Model.extend({ console.log("That position is already taken, go Again"); } console.log(this.board.gameBoard); - console.log("who's turn: " + this.get('gameCounter')); - console.log("round number: " + this.get('turnCounter')); + console.log("who's turn: " + this.gameCounter); + console.log("round number: " + this.turnCounter); } }, whichPlayer: function() { - if (this.get('gameCounter') === this.get('player1').turnId) { + if (this.gameCounter === this.get('player1').turnId) { return this.get('player1'); } else { return this.get('player2'); diff --git a/src/app/models/game_board.js b/src/app/models/game_board.js index 091fa09..7ff43a0 100644 --- a/src/app/models/game_board.js +++ b/src/app/models/game_board.js @@ -3,10 +3,7 @@ import Backbone from 'backbone'; const GameBoard = Backbone.Model.extend({ initialize: function() { - this.gameBoard = []; - this.gameBoard[0] = [ null, null, null]; - this.gameBoard[1] = [ null, null, null]; - this.gameBoard[2] = [ null, null, null]; + this.gameBoard = [[ null, null, null], [ null, null, null], [ null, null, null]]; }, hasWon: function() { diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 91cea05..c9d74a4 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -39,7 +39,7 @@ const GameView = Backbone.View.extend({ console.log(event.id); var locationClicked = event.id; - this.model.playTurn(); + // this.model.playTurn(); // var player = ; // var marker = "X"; // diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js index e1730b4..6c5d9b9 100644 --- a/src/app/views/gameboard_view.js +++ b/src/app/views/gameboard_view.js @@ -23,10 +23,21 @@ var GameBoardView = Backbone.View.extend({ }, render: function() { - - return this; + var array = this.model.gameBoard; + console.log('array'); + console.log(array); + $('#top-left').append(array[0][0]); + $('#top-middle').append(array[0][0]); + $('#top-right').append(array[0][0]); + + $('#middle-left').append(array[0][0]); + $('#middle-middle').append(array[0][0]); + $('#middle-right').append(array[0][0]); + + $('#bottom-left').append(array[0][0]); + $('#bottom-middle').append(array[0][0]); + $('#bottom-right').append(array[0][0]); } - }); export default GameBoardView; From 8837c79f6f6c0e6598d6702819b7434bcc7508b3 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 20 Dec 2016 12:30:28 -0800 Subject: [PATCH 27/40] connected gameboard render to the gameboard 2D array --- src/app/views/game_view.js | 7 ++++++- src/app/views/gameboard_view.js | 23 +++++++++++++---------- src/app/views/space_view.js | 2 -- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index c9d74a4..7c7d884 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -2,14 +2,19 @@ import Backbone from 'backbone'; import $ from 'jquery'; import Game from 'app/models/game'; +import GameBoard from 'app/models/game_board'; + import PlayerView from 'app/views/player_view'; import GameBoardView from 'app/views/gameboard_view'; const GameView = Backbone.View.extend({ initialize: function() { + var gameBoard = new GameBoard(); + var gameBoardView = new GameBoardView({ - el: '#gameboard-view' + el: '#gameboard-view', + model: gameBoard }); var playerView = new PlayerView({ diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js index 6c5d9b9..d3dcf37 100644 --- a/src/app/views/gameboard_view.js +++ b/src/app/views/gameboard_view.js @@ -2,6 +2,7 @@ import Backbone from 'backbone'; import $ from 'jquery'; // import Game from 'app/models/game'; +import GameBoard from 'app/models/game_board'; var GameBoardView = Backbone.View.extend({ @@ -24,19 +25,21 @@ var GameBoardView = Backbone.View.extend({ render: function() { var array = this.model.gameBoard; - console.log('array'); - console.log(array); + console.log(array[0]); + console.log(array[0][0]); $('#top-left').append(array[0][0]); - $('#top-middle').append(array[0][0]); - $('#top-right').append(array[0][0]); + $('#top-middle').append(array[0][1]); + $('#top-right').append(array[0][2]); - $('#middle-left').append(array[0][0]); - $('#middle-middle').append(array[0][0]); - $('#middle-right').append(array[0][0]); + $('#middle-left').append(array[1][0]); + $('#middle-middle').append(array[1][1]); + $('#middle-right').append(array[1][2]); - $('#bottom-left').append(array[0][0]); - $('#bottom-middle').append(array[0][0]); - $('#bottom-right').append(array[0][0]); + $('#bottom-left').append(array[2][0]); + $('#bottom-middle').append(array[2][1]); + $('#bottom-right').append(array[2][2]); + + return this; } }); diff --git a/src/app/views/space_view.js b/src/app/views/space_view.js index fc0e128..35b4868 100644 --- a/src/app/views/space_view.js +++ b/src/app/views/space_view.js @@ -1,4 +1,2 @@ - - export default SpaceView; From 0d7a7bc7f38a30c6bb7af3a4b084fc5b2b4b7aa1 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 20 Dec 2016 14:19:40 -0800 Subject: [PATCH 28/40] base of game is working in browser and console & No alerts work yet --- build/index.html | 30 +++++++++++++------------- src/app/models/game.js | 8 ++++++- src/app/models/game_board.js | 1 + src/app/views/game_view.js | 15 ++++++------- src/app/views/gameboard_view.js | 38 +++++++++++++++++++++------------ src/app/views/player_view.js | 1 - src/app/views/space_view.js | 2 -- 7 files changed, 54 insertions(+), 41 deletions(-) delete mode 100644 src/app/views/space_view.js diff --git a/build/index.html b/build/index.html index 9d07d5c..f6562f4 100644 --- a/build/index.html +++ b/build/index.html @@ -12,31 +12,31 @@

Tic-Tac-Toe

- +

Current Player:

-

X

-

O

+

X

+

O

- - - - + + + + - - - - + + + + - - - - + + + +
diff --git a/src/app/models/game.js b/src/app/models/game.js index 2615116..ab59a78 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -34,6 +34,8 @@ const Game = Backbone.Model.extend({ if (this.valid(row, column)) { this.board.gameBoard[row][column] = player.marker; + console.log('triggering change event'); + this.board.trigger('change', this.board, {}); if (player == this.get('player1')) { this.gameCounter = false; @@ -56,7 +58,11 @@ const Game = Backbone.Model.extend({ } else { console.log("That position is already taken, go Again"); } - console.log(this.board.gameBoard); + + + console.log(this.board.gameBoard[0]); + console.log(this.board.gameBoard[1]); + console.log(this.board.gameBoard[2]); console.log("who's turn: " + this.gameCounter); console.log("round number: " + this.turnCounter); } diff --git a/src/app/models/game_board.js b/src/app/models/game_board.js index 7ff43a0..e60f89c 100644 --- a/src/app/models/game_board.js +++ b/src/app/models/game_board.js @@ -4,6 +4,7 @@ import Backbone from 'backbone'; const GameBoard = Backbone.Model.extend({ initialize: function() { this.gameBoard = [[ null, null, null], [ null, null, null], [ null, null, null]]; + // this.set('gameBoard', [[ null, null, null], [ null, null, null], [ null, null, null]]); }, hasWon: function() { diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 7c7d884..2c897fc 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -10,11 +10,10 @@ import GameBoardView from 'app/views/gameboard_view'; const GameView = Backbone.View.extend({ initialize: function() { - var gameBoard = new GameBoard(); var gameBoardView = new GameBoardView({ el: '#gameboard-view', - model: gameBoard + model: this.model.board }); var playerView = new PlayerView({ @@ -38,18 +37,18 @@ const GameView = Backbone.View.extend({ startGame: function() { console.log("Starting a game"); + }, playTurn: function(event) { + console.log(event); console.log(event.id); var locationClicked = event.id; + var value = $(event).html(); + + console.log(value); + this.model.playTurn(locationClicked[0], locationClicked[1]); - // this.model.playTurn(); - // var player = ; - // var marker = "X"; - // - // - // event.currentTarget.append(marker); } }); diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js index d3dcf37..be30c35 100644 --- a/src/app/views/gameboard_view.js +++ b/src/app/views/gameboard_view.js @@ -1,12 +1,12 @@ import Backbone from 'backbone'; import $ from 'jquery'; -// import Game from 'app/models/game'; import GameBoard from 'app/models/game_board'; var GameBoardView = Backbone.View.extend({ initialize: function() { + this.listenTo(this.model, 'change', this.render); }, @@ -24,20 +24,30 @@ var GameBoardView = Backbone.View.extend({ }, render: function() { + console.log('in gameBoardView.render'); var array = this.model.gameBoard; - console.log(array[0]); - console.log(array[0][0]); - $('#top-left').append(array[0][0]); - $('#top-middle').append(array[0][1]); - $('#top-right').append(array[0][2]); - - $('#middle-left').append(array[1][0]); - $('#middle-middle').append(array[1][1]); - $('#middle-right').append(array[1][2]); - - $('#bottom-left').append(array[2][0]); - $('#bottom-middle').append(array[2][1]); - $('#bottom-right').append(array[2][2]); + console.log(array); + + $('#00').empty(); + $('#00').append(array[0][0]); + $('#01').empty(); + $('#01').append(array[0][1]); + $('#02').empty(); + $('#02').append(array[0][2]); + + $('#10').empty(); + $('#10').append(array[1][0]); + $('#11').empty(); + $('#11').append(array[1][1]); + $('#12').empty(); + $('#12').append(array[1][2]); + + $('#20').empty(); + $('#20').append(array[2][0]); + $('#21').empty(); + $('#21').append(array[2][1]); + $('#22').empty(); + $('#22').append(array[2][2]); return this; } diff --git a/src/app/views/player_view.js b/src/app/views/player_view.js index 6540c92..53205cd 100644 --- a/src/app/views/player_view.js +++ b/src/app/views/player_view.js @@ -2,7 +2,6 @@ import Backbone from 'backbone'; import $ from 'jquery'; import Game from 'app/models/game'; -// import SpaceView from 'app/views/space_view'; var PlayerView = Backbone.View.extend({ diff --git a/src/app/views/space_view.js b/src/app/views/space_view.js deleted file mode 100644 index 35b4868..0000000 --- a/src/app/views/space_view.js +++ /dev/null @@ -1,2 +0,0 @@ - -export default SpaceView; From b893b795f8b4e04e99c40a15e10687401612eef1 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 20 Dec 2016 15:31:12 -0800 Subject: [PATCH 29/40] added alerts --- spec/game.spec.js | 8 ++++++-- src/app/models/game.js | 6 +++++- src/app/views/game_view.js | 25 +++++++++++++++++++++++++ src/app/views/gameboard_view.js | 1 - 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 816ba7a..abe1373 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -8,7 +8,7 @@ describe('Game', function() { it("should create a gameBoard when initialized", function() { expect(testGame.board).toBeDefined(); // expect(testGame.board).toEqual(testBoard.board); - expect(testGame.board.gameBoard).toEqual(jasmine.any(Array)); + expect(testGame.board.get('gameBoard')).toEqual(jasmine.any(Array)); }); it('should initialize the correct Player for player1', function() { @@ -36,7 +36,11 @@ describe('Game', function() { describe('valid', function() { var testGame3 = new Game(); - testGame3.board.gameBoard[0][2] = "X"; + console.log(">>>>>>"); + console.log(testGame3.board.get('gameBoard')[0][2]); + testGame3.board.set(('gameBoard')[0][2], "X"); + console.log(testGame3.board.get('gameBoard')[0][2]); + it('should handle an invalid location entry appropriately', function() { expect(testGame3.valid(4,4)).toEqual(false); diff --git a/src/app/models/game.js b/src/app/models/game.js index ab59a78..204eddb 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -27,6 +27,7 @@ const Game = Backbone.Model.extend({ playTurn: function(row, column) { if(this.winner !== null) { + this.trigger('gameover', this); console.log("Game is Over " + this.winner.name + " won."); return "Game is Over " + this.winner.name + " won."; } else { @@ -34,6 +35,7 @@ const Game = Backbone.Model.extend({ if (this.valid(row, column)) { this.board.gameBoard[row][column] = player.marker; + console.log('triggering change event'); this.board.trigger('change', this.board, {}); @@ -49,17 +51,19 @@ const Game = Backbone.Model.extend({ if(this.board.hasWon() === true) { console.log(player + " you're the Winner!!!"); this.winner = player; + this.trigger('winner', this); return player.name; } else if(this.board.hasWon() === "tie") { + this.trigger('catsgame', this, "cats game"); console.log("Cat's Game, it's a tie."); // return "Cat's Game."; } } } else { + this.trigger('invalid', this, "Position is already Taken", {}); console.log("That position is already taken, go Again"); } - console.log(this.board.gameBoard[0]); console.log(this.board.gameBoard[1]); console.log(this.board.gameBoard[2]); diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 2c897fc..0ffa30e 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -21,6 +21,11 @@ const GameView = Backbone.View.extend({ }); this.listenTo(gameBoardView, 'selectSpace', this.playTurn); + this.listenTo(this.model, 'invalid', this.spaceTaken); + this.listenTo(this.model, 'gameover', this.gameOver); + this.listenTo(this.model, 'winner', this.stateWinner); + this.listenTo(this.model, 'catsgame', this.stateCatsGame); + gameBoardView.render(); playerView.render(); @@ -49,6 +54,26 @@ const GameView = Backbone.View.extend({ console.log(value); this.model.playTurn(locationClicked[0], locationClicked[1]); + }, + + spaceTaken: function() { + console.log("in spaceTaken"); + alert("That space is taken already, Go Again."); + }, + + gameOver: function() { + console.log("in gameOver"); + alert("The Game's already over"); + }, + + stateWinner: function () { + console.log("in winner"); + alert("There's a winner "); + }, + + stateCatsGame: function () { + console.log("in winner"); + alert("It's a Cat's Game :("); } }); diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js index be30c35..406dfad 100644 --- a/src/app/views/gameboard_view.js +++ b/src/app/views/gameboard_view.js @@ -7,7 +7,6 @@ var GameBoardView = Backbone.View.extend({ initialize: function() { this.listenTo(this.model, 'change', this.render); - }, events: { From 7569ca8e2ab4d46938f5ec8a6093aa5d7f68103d Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 09:37:26 -0800 Subject: [PATCH 30/40] worked on css styling and responsiveness & current player works correctly now --- build/css/app.css | 49 ++++++++++++++++++++++++++--- build/index.html | 63 +++++++++++++++++++++----------------- src/app/views/game_view.js | 9 +++++- 3 files changed, 88 insertions(+), 33 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 16a78a0..69a3ffd 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -1,12 +1,21 @@ body { - /*background-color: blacks; - color: white; - font-family: 'Nunito Sans', sans-serif;*/ + background-color: #1B2321; + color: black; + font-family: 'Shadows Into Light', cursive; } h1 { - font-size: 28px; + font-size: 500%; + text-align: center; + color: white; + font-family: 'Shadows Into Light', cursive; + margin-top: 2%; +} + +h3, h2 { + font-family: 'Shadows Into Light', cursive; + color: white; } #gameboard-view { @@ -14,6 +23,14 @@ h1 { text-align: center; } +#player-view { + border: 1px solid white; + width: 20%; + padding: 1%; + border-radius: 15px; + margin: 1%; +} + table { table-layout: fixed; border-collapse: collapse; @@ -30,4 +47,28 @@ td { width: 11vw; height: 11vw; padding: 0; + border-radius: 15px; +} + +.button { + border-radius: 15px; + /*font-size: 150%;*/ + font-size: 25px; +} + +.x-show { + display: inline; +} + +.o-show { + display: none; +} + +.start-game-button { + margin-left: 34%; +} + +#main-area { + margin-left: 16%; + padding-top: 4%; } diff --git a/build/index.html b/build/index.html index f6562f4..bc14845 100644 --- a/build/index.html +++ b/build/index.html @@ -5,40 +5,47 @@ - +

Tic-Tac-Toe

- - -
-

Current Player:

-

X

-

O

-
- - - - - - - - - - - - - - - - - - - -
+
+ +
+ +
+
+

Current Player:

+

X

+

O

+
+ + + + + + + + + + + + + + + + + + + +
+
+ + +
diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 0ffa30e..23fa716 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -54,6 +54,13 @@ const GameView = Backbone.View.extend({ console.log(value); this.model.playTurn(locationClicked[0], locationClicked[1]); + if(this.model.gameCounter === true) { + $('.x-show').css('display', 'inline'); + $('.o-show').css('display', 'none'); + } else { + $('.x-show').css('display', 'none'); + $('.o-show').css('display', 'inline'); + } }, spaceTaken: function() { @@ -71,7 +78,7 @@ const GameView = Backbone.View.extend({ alert("There's a winner "); }, - stateCatsGame: function () { + statecatsGame: function () { console.log("in winner"); alert("It's a Cat's Game :("); } From 18d06e165f84093c46afc2b6cec4cd2bf6592c2e Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 10:28:11 -0800 Subject: [PATCH 31/40] reload page on start new game --- src/app/views/game_view.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 23fa716..0a8c142 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -42,7 +42,17 @@ const GameView = Backbone.View.extend({ startGame: function() { console.log("Starting a game"); - + location.reload(); + // var game = new Game(); + // + // var gameview = new GameView({ + // el: '#game-view', + // model: game + // }); + // + // this.model.board = new GameBoard(); + // + // gameview.render(); }, playTurn: function(event) { @@ -78,7 +88,7 @@ const GameView = Backbone.View.extend({ alert("There's a winner "); }, - statecatsGame: function () { + stateCatsGame: function () { console.log("in winner"); alert("It's a Cat's Game :("); } From 4e8ea01b135e1ff6f4406d5449fdf15ae7cf8693 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 11:01:41 -0800 Subject: [PATCH 32/40] message box functioning with Winner display, alerts, and catsgame --- build/css/app.css | 20 ++++++++++++++------ build/index.html | 5 ++++- src/app/models/game.js | 6 +++--- src/app/views/game_view.js | 22 +++++++++++++++++----- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 69a3ffd..5ceee0e 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -31,6 +31,13 @@ h3, h2 { margin: 1%; } +#message-box { + color: black; + background-color: transparent; + border-radius: 15px; + padding: 4%; +} + table { table-layout: fixed; border-collapse: collapse; @@ -44,16 +51,16 @@ table tr:nth-of-type(even) { td { border: 1px solid black; font-size: 6vw; - width: 11vw; - height: 11vw; + width: 12vw; + height: 12vw; padding: 0; border-radius: 15px; } .button { border-radius: 15px; - /*font-size: 150%;*/ - font-size: 25px; + font-size: 150%; + /*font-size: 25px;*/ } .x-show { @@ -69,6 +76,7 @@ td { } #main-area { - margin-left: 16%; - padding-top: 4%; + /*margin-left: 16%;*/ + margin-left: 14%; + padding-top: 3%; } diff --git a/build/index.html b/build/index.html index bc14845..a209c62 100644 --- a/build/index.html +++ b/build/index.html @@ -13,7 +13,7 @@

Tic-Tac-Toe

- +
@@ -21,6 +21,7 @@

Tic-Tac-Toe

Current Player:

X

O

+

@@ -47,6 +48,8 @@

O

+ + diff --git a/src/app/models/game.js b/src/app/models/game.js index 204eddb..5617392 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -9,12 +9,12 @@ const Game = Backbone.Model.extend({ player1: { marker: "X", turnId: true, - name: "player1" + name: "player 1" }, player2: { marker: "O", turnId: false, - name: "player2" + name: "player 2" }, }, @@ -51,7 +51,7 @@ const Game = Backbone.Model.extend({ if(this.board.hasWon() === true) { console.log(player + " you're the Winner!!!"); this.winner = player; - this.trigger('winner', this); + this.trigger('winner', this.winner); return player.name; } else if(this.board.hasWon() === "tie") { this.trigger('catsgame', this, "cats game"); diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 0a8c142..879ee1b 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -58,6 +58,8 @@ const GameView = Backbone.View.extend({ playTurn: function(event) { console.log(event); console.log(event.id); + $('#message-box').empty(); + $('#message-box').css('background-color', 'transparent'); var locationClicked = event.id; var value = $(event).html(); @@ -75,22 +77,32 @@ const GameView = Backbone.View.extend({ spaceTaken: function() { console.log("in spaceTaken"); - alert("That space is taken already, Go Again."); + // alert("That space is taken already, Go Again."); + $('#message-box').append("Space's Taken, Go Again."); + $('#message-box').css('background-color', '#EA6E6E'); }, gameOver: function() { console.log("in gameOver"); - alert("The Game's already over"); + // alert("The Game's already over"); + $('#message-box').append("Game's Over."); + $('#message-box').css('background-color', '#EA6E6E'); }, - stateWinner: function () { + stateWinner: function (winner) { console.log("in winner"); - alert("There's a winner "); + console.log(winner); + // alert("There's a winner "); + $('#message-box').append("Winner: " + winner.name); + $('#message-box').css('background-color', '#88D18A'); + }, stateCatsGame: function () { console.log("in winner"); - alert("It's a Cat's Game :("); + // alert("It's a Cat's Game :("); + $('#message-box').append("Cat's Game :("); + $('#message-box').css('background-color', '#68ABBA'); } }); From 57c9ec0b8c9e5d783d2dcd0589a1ccd4627151e0 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 11:39:28 -0800 Subject: [PATCH 33/40] added allgames collection --- src/app/collections/all_games.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/app/collections/all_games.js diff --git a/src/app/collections/all_games.js b/src/app/collections/all_games.js new file mode 100644 index 0000000..bb22b5f --- /dev/null +++ b/src/app/collections/all_games.js @@ -0,0 +1,13 @@ +import Backbone from 'backbone'; + +import Game from 'app/models/game'; + +var AllGames = Backbone.Collection.extend({ + model: game, + url: 'http://localhost:3000/api/v1/games', + parse: function(data){ + return data; + } +}); + +export default AllGames; From 59a9c51ceb1e2c5c98c6bc6a1a16c83c77bc9775 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 11:49:31 -0800 Subject: [PATCH 34/40] WIP: to_json --- src/app/models/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/models/game.js b/src/app/models/game.js index 204eddb..3dd79b7 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -93,7 +93,7 @@ const Game = Backbone.Model.extend({ return false; } } - } + }, }); // DO NOT REMOVE THIS From 3f84b317c9cad049c0d15bd1259827429760860a Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 12:09:27 -0800 Subject: [PATCH 35/40] fixed a catsgame game over bug and fixed tests that had .get(gameboard) back to just .gameboard --- build/css/app.css | 9 ++++++++- build/index.html | 6 +++--- spec/game.spec.js | 8 ++++---- src/app/models/game.js | 3 ++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 5ceee0e..5b67ae8 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -25,7 +25,7 @@ h3, h2 { #player-view { border: 1px solid white; - width: 20%; + width: 21%; padding: 1%; border-radius: 15px; margin: 1%; @@ -36,6 +36,7 @@ h3, h2 { background-color: transparent; border-radius: 15px; padding: 4%; + margin-top: 4%; } table { @@ -63,6 +64,10 @@ td { /*font-size: 25px;*/ } +.inline { + display: inline; +} + .x-show { display: inline; } @@ -75,6 +80,8 @@ td { margin-left: 34%; } + + #main-area { /*margin-left: 16%;*/ margin-left: 14%; diff --git a/build/index.html b/build/index.html index a209c62..d22ba7c 100644 --- a/build/index.html +++ b/build/index.html @@ -18,9 +18,9 @@

Tic-Tac-Toe

-

Current Player:

-

X

-

O

+

Current Player:

+

X

+

O

diff --git a/spec/game.spec.js b/spec/game.spec.js index abe1373..918626f 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -8,7 +8,7 @@ describe('Game', function() { it("should create a gameBoard when initialized", function() { expect(testGame.board).toBeDefined(); // expect(testGame.board).toEqual(testBoard.board); - expect(testGame.board.get('gameBoard')).toEqual(jasmine.any(Array)); + expect(testGame.board.gameBoard).toEqual(jasmine.any(Array)); }); it('should initialize the correct Player for player1', function() { @@ -37,9 +37,9 @@ describe('Game', function() { describe('valid', function() { var testGame3 = new Game(); console.log(">>>>>>"); - console.log(testGame3.board.get('gameBoard')[0][2]); - testGame3.board.set(('gameBoard')[0][2], "X"); - console.log(testGame3.board.get('gameBoard')[0][2]); + console.log(testGame3.board.gameBoard[0][2]); + testGame3.board.gameBoard[0][2] = "X"; + console.log(testGame3.board.gameBoard[0][2]); it('should handle an invalid location entry appropriately', function() { diff --git a/src/app/models/game.js b/src/app/models/game.js index 5617392..30a2f1f 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -26,7 +26,7 @@ const Game = Backbone.Model.extend({ }, playTurn: function(row, column) { - if(this.winner !== null) { + if(this.winner == this.get('player1') || this.winner == this.get('player2') || this.winner === 'catsgame_no_winner') { this.trigger('gameover', this); console.log("Game is Over " + this.winner.name + " won."); return "Game is Over " + this.winner.name + " won."; @@ -54,6 +54,7 @@ const Game = Backbone.Model.extend({ this.trigger('winner', this.winner); return player.name; } else if(this.board.hasWon() === "tie") { + this.winner = 'catsgame_no_winner'; this.trigger('catsgame', this, "cats game"); console.log("Cat's Game, it's a tie."); // return "Cat's Game."; From 21ef73bbe59a50b5e2e5beb5f5b3bd36c8d4bca7 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 12:22:46 -0800 Subject: [PATCH 36/40] changed original board to equal an empty string instead of null to match api --- spec/game.spec.js | 4 ++-- src/app/models/game.js | 7 +++++++ src/app/models/game_board.js | 18 +++++++++--------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/spec/game.spec.js b/spec/game.spec.js index 918626f..e4dad92 100644 --- a/spec/game.spec.js +++ b/spec/game.spec.js @@ -59,7 +59,7 @@ describe('Game', function() { var testGame4 = new Game(); it('should add a player1 marker (X) if the space is open', function() { - expect(testGame4.board.gameBoard[0][0]).toEqual(null); + expect(testGame4.board.gameBoard[0][0]).toEqual(" "); expect(testGame4.gameCounter).toEqual(true); expect(testGame4.turnCounter).toEqual(0); @@ -81,7 +81,7 @@ describe('Game', function() { }); it('should add player2 marker (O) if the space is open', function() { - expect(testGame4.board.gameBoard[2][2]).toEqual(null); + expect(testGame4.board.gameBoard[2][2]).toEqual(" "); expect(testGame4.gameCounter).toEqual(false); // expect(testGame4.turnCounter).toEqual(1); console.log(">>>>>>>>>>>>>>>>" + testGame4.turnCounter); diff --git a/src/app/models/game.js b/src/app/models/game.js index 0287e84..c9725a5 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -95,6 +95,13 @@ const Game = Backbone.Model.extend({ } } }, + + toJSON: function() { + if(_(value.toJSON).isFunction()) { + // execute toJSON and overwrite the value in attributes + attributes[key] = value.toJSON(); +} + } }); // DO NOT REMOVE THIS diff --git a/src/app/models/game_board.js b/src/app/models/game_board.js index e60f89c..82722a4 100644 --- a/src/app/models/game_board.js +++ b/src/app/models/game_board.js @@ -3,7 +3,7 @@ import Backbone from 'backbone'; const GameBoard = Backbone.Model.extend({ initialize: function() { - this.gameBoard = [[ null, null, null], [ null, null, null], [ null, null, null]]; + this.gameBoard = [[ " ", " ", " "], [ " ", " ", " "], [ " ", " ", " "]]; // this.set('gameBoard', [[ null, null, null], [ null, null, null], [ null, null, null]]); }, @@ -13,17 +13,17 @@ const GameBoard = Backbone.Model.extend({ var row1 = this.gameBoard[1]; var row2 = this.gameBoard[2]; - if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== null) || - (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== null) || - (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== null)) { + if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== " ") || + (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== " ") || + (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== " ")) { console.log("Winner in a row"); return true; - } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== null) || - (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== null) || - (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== null)) { + } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== " ") || + (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== " ") || + (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== " ")) { console.log("Winner in a column"); return true; - } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== null) || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== null)) { + } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== " ") || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== " ")) { console.log("Winner in a diagonal"); return true; } else { @@ -40,7 +40,7 @@ const GameBoard = Backbone.Model.extend({ var row1 = this.gameBoard[1]; var row2 = this.gameBoard[2]; - if((row0.includes(null)) || (row1.includes(null)) || (row2.includes(null))) { + if((row0.includes(" ")) || (row1.includes(" ")) || (row2.includes(" "))) { return false; } else { return true; From 95bd3c54350f47df30bba5d46baca4ed455e4fad Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Wed, 21 Dec 2016 15:36:13 -0800 Subject: [PATCH 37/40] formatted data to json format --- src/app.js | 5 +++++ src/app/collections/all_games.js | 2 +- src/app/models/game.js | 38 +++++++++++++++++++++++--------- src/app/views/game_view.js | 24 +++++++++----------- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/app.js b/src/app.js index b36b177..3227499 100644 --- a/src/app.js +++ b/src/app.js @@ -2,14 +2,19 @@ import Backbone from 'backbone'; import $ from 'jquery'; import Game from 'app/models/game'; +import AllGames from 'app/collections/all_games'; + import GameView from 'app/views/game_view'; + $(document).ready(function() { var game = new Game(); + // var allGames = new AllGames(); var gameview = new GameView({ el: '#game-view', + // model: allGames model: game }); diff --git a/src/app/collections/all_games.js b/src/app/collections/all_games.js index bb22b5f..b1c5959 100644 --- a/src/app/collections/all_games.js +++ b/src/app/collections/all_games.js @@ -3,7 +3,7 @@ import Backbone from 'backbone'; import Game from 'app/models/game'; var AllGames = Backbone.Collection.extend({ - model: game, + model: Game, url: 'http://localhost:3000/api/v1/games', parse: function(data){ return data; diff --git a/src/app/models/game.js b/src/app/models/game.js index c9725a5..0b0244e 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -23,10 +23,11 @@ const Game = Backbone.Model.extend({ this.gameCounter = true; this.turnCounter = 0; this.winner = null; + this.outcome = undefined; }, playTurn: function(row, column) { - if(this.winner == this.get('player1') || this.winner == this.get('player2') || this.winner === 'catsgame_no_winner') { + if(this.winner == this.get('player1') || this.winner == this.get('player2') || this.winner === 'draw') { this.trigger('gameover', this); console.log("Game is Over " + this.winner.name + " won."); return "Game is Over " + this.winner.name + " won."; @@ -51,10 +52,12 @@ const Game = Backbone.Model.extend({ if(this.board.hasWon() === true) { console.log(player + " you're the Winner!!!"); this.winner = player; + this.outcome = player.marker; this.trigger('winner', this.winner); return player.name; } else if(this.board.hasWon() === "tie") { - this.winner = 'catsgame_no_winner'; + this.winner = 'draw'; + this.outcome = 'draw'; this.trigger('catsgame', this, "cats game"); console.log("Cat's Game, it's a tie."); // return "Cat's Game."; @@ -65,11 +68,11 @@ const Game = Backbone.Model.extend({ console.log("That position is already taken, go Again"); } - console.log(this.board.gameBoard[0]); - console.log(this.board.gameBoard[1]); - console.log(this.board.gameBoard[2]); - console.log("who's turn: " + this.gameCounter); - console.log("round number: " + this.turnCounter); + // console.log(this.board.gameBoard[0]); + // console.log(this.board.gameBoard[1]); + // console.log(this.board.gameBoard[2]); + // console.log("who's turn: " + this.gameCounter); + // console.log("round number: " + this.turnCounter); } }, @@ -97,10 +100,23 @@ const Game = Backbone.Model.extend({ }, toJSON: function() { - if(_(value.toJSON).isFunction()) { - // execute toJSON and overwrite the value in attributes - attributes[key] = value.toJSON(); -} + var flattenedBoard = this.board.gameBoard.reduce(function(a, b) { + return a.concat(b); + }, []); + + var player1 = this.get('player1').name; + var player2 = this.get('player2').name; + var nowDateTime = new Date(); + + + var apiData = { + 'board': flattenedBoard, + 'players': [player1, player2], + 'outcome': this.outcome, + 'played_at': nowDateTime + }; + + console.log(apiData); } }); diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 879ee1b..42a972b 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -3,6 +3,7 @@ import $ from 'jquery'; import Game from 'app/models/game'; import GameBoard from 'app/models/game_board'; +import AllGames from 'app/collections/all_games'; import PlayerView from 'app/views/player_view'; import GameBoardView from 'app/views/gameboard_view'; @@ -41,29 +42,19 @@ const GameView = Backbone.View.extend({ }, startGame: function() { - console.log("Starting a game"); + // console.log("Starting a game"); location.reload(); - // var game = new Game(); - // - // var gameview = new GameView({ - // el: '#game-view', - // model: game - // }); - // - // this.model.board = new GameBoard(); - // - // gameview.render(); }, playTurn: function(event) { - console.log(event); - console.log(event.id); + // console.log(event); + // console.log(event.id); $('#message-box').empty(); $('#message-box').css('background-color', 'transparent'); var locationClicked = event.id; var value = $(event).html(); - console.log(value); + // console.log(value); this.model.playTurn(locationClicked[0], locationClicked[1]); if(this.model.gameCounter === true) { @@ -96,6 +87,7 @@ const GameView = Backbone.View.extend({ $('#message-box').append("Winner: " + winner.name); $('#message-box').css('background-color', '#88D18A'); + this.model.toJSON(); }, stateCatsGame: function () { @@ -103,6 +95,10 @@ const GameView = Backbone.View.extend({ // alert("It's a Cat's Game :("); $('#message-box').append("Cat's Game :("); $('#message-box').css('background-color', '#68ABBA'); + + var jsonData = this.model.toJSON(); + this.model.create(jsonData); + console.log(this.model); } }); From cd27c00bca24e3b6505a9953c0ab8f6c993d6fdc Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Thu, 22 Dec 2016 11:04:23 -0800 Subject: [PATCH 38/40] when game completes, it automatically creates a new game in the collection which is connected to the api --- build/css/app.css | 28 +++++++++++++++++++++++----- build/index.html | 36 +++++++++++++++++++++++------------- src/app.js | 5 +++-- src/app/models/game.js | 11 ++++++----- src/app/views/game_view.js | 27 ++++++++++++++++++++++----- 5 files changed, 77 insertions(+), 30 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 5b67ae8..5aaf57c 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -39,17 +39,17 @@ h3, h2 { margin-top: 4%; } -table { +table#gameboard-view { table-layout: fixed; border-collapse: collapse; border-style: hidden; } -table tr:nth-of-type(even) { +table#gameboard-view tr:nth-of-type(even) { background-color: transparent !important; } -td { +table#gameboard-view td.value-cell { border: 1px solid black; font-size: 6vw; width: 12vw; @@ -58,6 +58,26 @@ td { border-radius: 15px; } +table#all-games th { + background-color: #1B2321; + border-bottom: white, 1px, solid; + +} + +table#all-games td { + background-color: #1B2321; +} + +table#all-games { + color: white; + width: 14vw; + font-size: 150%; + padding: 0 1% 0 1%; + border-radius: 15%; + text-align: center; + border: 1px solid black; +} + .button { border-radius: 15px; font-size: 150%; @@ -80,8 +100,6 @@ td { margin-left: 34%; } - - #main-area { /*margin-left: 16%;*/ margin-left: 14%; diff --git a/build/index.html b/build/index.html index d22ba7c..6afd812 100644 --- a/build/index.html +++ b/build/index.html @@ -26,29 +26,39 @@

- - - + + + - - - + + + - - - + + +
- - - - + +
diff --git a/src/app.js b/src/app.js index 3227499..da606be 100644 --- a/src/app.js +++ b/src/app.js @@ -10,12 +10,13 @@ import GameView from 'app/views/game_view'; $(document).ready(function() { var game = new Game(); - // var allGames = new AllGames(); + var allGames = new AllGames(); var gameview = new GameView({ el: '#game-view', // model: allGames - model: game + model: game, + completedGames: allGames }); gameview.render(); diff --git a/src/app/models/game.js b/src/app/models/game.js index 0b0244e..bd84a31 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -64,7 +64,7 @@ const Game = Backbone.Model.extend({ } } } else { - this.trigger('invalid', this, "Position is already Taken", {}); + this.trigger('invalid', this); console.log("That position is already taken, go Again"); } @@ -110,13 +110,14 @@ const Game = Backbone.Model.extend({ var apiData = { - 'board': flattenedBoard, - 'players': [player1, player2], - 'outcome': this.outcome, - 'played_at': nowDateTime + board: flattenedBoard, + players: [player1, player2], + outcome: this.outcome, + played_at: nowDateTime }; console.log(apiData); + return apiData; } }); diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 42a972b..754f4d5 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -10,7 +10,7 @@ import GameBoardView from 'app/views/gameboard_view'; const GameView = Backbone.View.extend({ - initialize: function() { + initialize: function(options) { var gameBoardView = new GameBoardView({ el: '#gameboard-view', @@ -21,6 +21,12 @@ const GameView = Backbone.View.extend({ el: '#player-view' }); + console.log("options"); + console.log(options); + this.gameList = options.completedGames; + console.log("all games"); + console.log(this.gameList); + this.listenTo(gameBoardView, 'selectSpace', this.playTurn); this.listenTo(this.model, 'invalid', this.spaceTaken); this.listenTo(this.model, 'gameover', this.gameOver); @@ -87,7 +93,12 @@ const GameView = Backbone.View.extend({ $('#message-box').append("Winner: " + winner.name); $('#message-box').css('background-color', '#88D18A'); - this.model.toJSON(); + // console.log("jsondata: "); + // console.log(jsonData); + console.log(this.gameList); + this.gameList.create(this.model); + + this.updateAllGames(); }, stateCatsGame: function () { @@ -96,9 +107,15 @@ const GameView = Backbone.View.extend({ $('#message-box').append("Cat's Game :("); $('#message-box').css('background-color', '#68ABBA'); - var jsonData = this.model.toJSON(); - this.model.create(jsonData); - console.log(this.model); + // console.log("jsondata: "); + console.log(jsonData); + this.gameList.create(this.model); + + this.updateAllGames(); + }, + + updateAllGames: function() { + console.log("in update all games"); } }); From d5fe7017ae0cddf7d25c3bf38d1fa63d8747f612 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Thu, 22 Dec 2016 15:23:22 -0800 Subject: [PATCH 39/40] workin on deleting and fetch works --- build/css/app.css | 37 +++++++++++++++++-------- build/index.html | 52 ++++++++++++++++++------------------ src/app.js | 3 ++- src/app/models/game.js | 19 +++++++------ src/app/models/game_board.js | 6 ++--- src/app/views/game_view.js | 43 ++++++++++++++++++++--------- 6 files changed, 97 insertions(+), 63 deletions(-) diff --git a/build/css/app.css b/build/css/app.css index 5aaf57c..4f69041 100644 --- a/build/css/app.css +++ b/build/css/app.css @@ -6,11 +6,12 @@ body { } h1 { - font-size: 500%; + font-size: 9vw; text-align: center; color: white; font-family: 'Shadows Into Light', cursive; margin-top: 2%; + margin-left: 1%; } h3, h2 { @@ -25,7 +26,7 @@ h3, h2 { #player-view { border: 1px solid white; - width: 21%; + width: 24vw; padding: 1%; border-radius: 15px; margin: 1%; @@ -39,6 +40,14 @@ h3, h2 { margin-top: 4%; } +#gameboard-view-box { + border: 0 3% 10% 4%; +} + +#all-game-view { + padding: 0 3% 3% 9%; +} + table#gameboard-view { table-layout: fixed; border-collapse: collapse; @@ -60,22 +69,21 @@ table#gameboard-view td.value-cell { table#all-games th { background-color: #1B2321; - border-bottom: white, 1px, solid; - + font-size: 110%; } table#all-games td { background-color: #1B2321; + width: 17vw; + padding: 0; } table#all-games { color: white; - width: 14vw; - font-size: 150%; - padding: 0 1% 0 1%; - border-radius: 15%; + width: 17vw; + /*font-size: 140%;*/ text-align: center; - border: 1px solid black; + } .button { @@ -84,6 +92,12 @@ table#all-games { /*font-size: 25px;*/ } +.delete-button { + border-radius: 15px; + font-size: 70%; + margin-right: 1%; +} + .inline { display: inline; } @@ -97,11 +111,12 @@ table#all-games { } .start-game-button { - margin-left: 34%; + margin-left: 31%; + font-size: 3vw; } #main-area { /*margin-left: 16%;*/ - margin-left: 14%; + margin-left: 2%; padding-top: 3%; } diff --git a/build/index.html b/build/index.html index 6afd812..6eab7cd 100644 --- a/build/index.html +++ b/build/index.html @@ -10,54 +10,54 @@
-

Tic-Tac-Toe

+
+

Tic-Tac-Toe

+
-
+

Current Player:

X

O

- - - - - - +
+
+ + + + + - - - - - + + + + + - - - - - -
+ + + + + + +
- +
diff --git a/src/app.js b/src/app.js index da606be..e5e84c4 100644 --- a/src/app.js +++ b/src/app.js @@ -9,7 +9,7 @@ import GameView from 'app/views/game_view'; $(document).ready(function() { - var game = new Game(); + var game = new Game({}); var allGames = new AllGames(); var gameview = new GameView({ @@ -19,5 +19,6 @@ $(document).ready(function() { completedGames: allGames }); + gameview.render(); }); diff --git a/src/app/models/game.js b/src/app/models/game.js index bd84a31..c21b66e 100644 --- a/src/app/models/game.js +++ b/src/app/models/game.js @@ -18,18 +18,18 @@ const Game = Backbone.Model.extend({ }, }, - initialize: function() { + initialize: function(options) { this.board = new GameBoard(); this.gameCounter = true; this.turnCounter = 0; this.winner = null; - this.outcome = undefined; + this.outcome = options.outcome; }, playTurn: function(row, column) { if(this.winner == this.get('player1') || this.winner == this.get('player2') || this.winner === 'draw') { this.trigger('gameover', this); - console.log("Game is Over " + this.winner.name + " won."); + // console.log("Game is Over " + this.winner.name + " won."); return "Game is Over " + this.winner.name + " won."; } else { var player = this.whichPlayer(); @@ -37,7 +37,7 @@ const Game = Backbone.Model.extend({ if (this.valid(row, column)) { this.board.gameBoard[row][column] = player.marker; - console.log('triggering change event'); + // console.log('triggering change event'); this.board.trigger('change', this.board, {}); if (player == this.get('player1')) { @@ -50,7 +50,7 @@ const Game = Backbone.Model.extend({ if(this.turnCounter >= 5) { if(this.board.hasWon() === true) { - console.log(player + " you're the Winner!!!"); + // console.log(player + " you're the Winner!!!"); this.winner = player; this.outcome = player.marker; this.trigger('winner', this.winner); @@ -59,13 +59,13 @@ const Game = Backbone.Model.extend({ this.winner = 'draw'; this.outcome = 'draw'; this.trigger('catsgame', this, "cats game"); - console.log("Cat's Game, it's a tie."); + // console.log("Cat's Game, it's a tie."); // return "Cat's Game."; } } } else { this.trigger('invalid', this); - console.log("That position is already taken, go Again"); + // console.log("That position is already taken, go Again"); } // console.log(this.board.gameBoard[0]); @@ -86,11 +86,11 @@ const Game = Backbone.Model.extend({ valid: function(row,column) { if((row > 2) || (column > 2)) { - console.log(row + "," + column + " is not a valid location"); + // console.log(row + "," + column + " is not a valid location"); return false; } else { var locationValue = this.board.gameBoard[row][column]; - console.log("in valid, location value = " + locationValue); + // console.log("in valid, location value = " + locationValue); if (locationValue != 'X' && locationValue != 'O') { return true; } else { @@ -108,7 +108,6 @@ const Game = Backbone.Model.extend({ var player2 = this.get('player2').name; var nowDateTime = new Date(); - var apiData = { board: flattenedBoard, players: [player1, player2], diff --git a/src/app/models/game_board.js b/src/app/models/game_board.js index 82722a4..bcb9cfc 100644 --- a/src/app/models/game_board.js +++ b/src/app/models/game_board.js @@ -16,15 +16,15 @@ const GameBoard = Backbone.Model.extend({ if ((row0[0] == row0[1] && row0[1] == row0[2] && row0[2] !== " ") || (row1[0] == row1[1] && row1[1] == row1[2] && row1[2] !== " ") || (row2[0] == row2[1] && row2[1] == row2[2] && row2[2] !== " ")) { - console.log("Winner in a row"); + // console.log("Winner in a row"); return true; } else if ((row0[0] == row1[0] && row1[0] == row2[0] && row2[0] !== " ") || (row0[1] == row1[1] && row1[1] == row2[1] && row2[1] !== " ") || (row0[2] == row1[2] && row1[2] == row2[2] && row2[2] !== " ")) { - console.log("Winner in a column"); + // console.log("Winner in a column"); return true; } else if ((row0[0] == row1[1] && row1[1] == row2[2] && row2[2] !== " ") || (row0[2] == row1[1] && row1[1] == row2[0] && row2[0] !== " ")) { - console.log("Winner in a diagonal"); + // console.log("Winner in a diagonal"); return true; } else { if(this.aTie()){ diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 754f4d5..4ba3d51 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -32,19 +32,21 @@ const GameView = Backbone.View.extend({ this.listenTo(this.model, 'gameover', this.gameOver); this.listenTo(this.model, 'winner', this.stateWinner); this.listenTo(this.model, 'catsgame', this.stateCatsGame); - + // this.listenTo(this.gameList, 'update', this.updateAllGames); gameBoardView.render(); playerView.render(); }, render: function() { + this.showAllGames(); return this; }, events: { - 'click .start-game-button': 'startGame' + 'click .start-game-button': 'startGame', + 'click .delete-button': 'deleteAGame' }, startGame: function() { @@ -93,12 +95,9 @@ const GameView = Backbone.View.extend({ $('#message-box').append("Winner: " + winner.name); $('#message-box').css('background-color', '#88D18A'); - // console.log("jsondata: "); - // console.log(jsonData); console.log(this.gameList); this.gameList.create(this.model); - - this.updateAllGames(); + this.showAllGames(); }, stateCatsGame: function () { @@ -107,17 +106,37 @@ const GameView = Backbone.View.extend({ $('#message-box').append("Cat's Game :("); $('#message-box').css('background-color', '#68ABBA'); - // console.log("jsondata: "); - console.log(jsonData); this.gameList.create(this.model); - - this.updateAllGames(); + $('#all-games').empty(); + this.showAllGames(); }, - updateAllGames: function() { + showAllGames: function() { console.log("in update all games"); - } + console.log(this.gameList); + var self = this; + this.gameList.fetch().done(function() { + $.each(self.gameList.models, function(index, game){ + console.log('game:'); + console.log(game); + var row = $(''); + var id = $('' + game.id + ''); + console.log(game.id); + var outcome = $('' + game.outcome + ''); + var button = $('' + '' + ''); + + row.append(id, outcome, button); + $('#all-games').append(row); + + }); + }); + }, + + deleteAGame: function(gameId) { + console.log("in delete function"); + // this.gameList.destroy(gameId); + } }); export default GameView; From 1e9fd47dabb99e702b530ab820d956496e69ea0a Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Thu, 11 May 2017 00:40:58 -0700 Subject: [PATCH 40/40] removed past games --- build/index.html | 4 ++-- src/app.js | 6 +++--- src/app/collections/all_games.js | 26 +++++++++++------------ src/app/views/game_view.js | 36 ++++++++++++++++---------------- src/app/views/gameboard_view.js | 4 ++-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/build/index.html b/build/index.html index 6eab7cd..52e0ba3 100644 --- a/build/index.html +++ b/build/index.html @@ -49,14 +49,14 @@

-

Past Games:

+
diff --git a/src/app.js b/src/app.js index e5e84c4..5a50e33 100644 --- a/src/app.js +++ b/src/app.js @@ -2,7 +2,7 @@ import Backbone from 'backbone'; import $ from 'jquery'; import Game from 'app/models/game'; -import AllGames from 'app/collections/all_games'; +// import AllGames from 'app/collections/all_games'; import GameView from 'app/views/game_view'; @@ -10,13 +10,13 @@ import GameView from 'app/views/game_view'; $(document).ready(function() { var game = new Game({}); - var allGames = new AllGames(); + // var allGames = new AllGames(); var gameview = new GameView({ el: '#game-view', // model: allGames model: game, - completedGames: allGames + // completedGames: allGames }); diff --git a/src/app/collections/all_games.js b/src/app/collections/all_games.js index b1c5959..adc9524 100644 --- a/src/app/collections/all_games.js +++ b/src/app/collections/all_games.js @@ -1,13 +1,13 @@ -import Backbone from 'backbone'; - -import Game from 'app/models/game'; - -var AllGames = Backbone.Collection.extend({ - model: Game, - url: 'http://localhost:3000/api/v1/games', - parse: function(data){ - return data; - } -}); - -export default AllGames; +// import Backbone from 'backbone'; +// +// import Game from 'app/models/game'; +// +// var AllGames = Backbone.Collection.extend({ +// model: Game, +// url: 'http://localhost:3000/api/v1/games', +// parse: function(data){ +// return data; +// } +// }); +// +// export default AllGames; diff --git a/src/app/views/game_view.js b/src/app/views/game_view.js index 4ba3d51..77b4a23 100644 --- a/src/app/views/game_view.js +++ b/src/app/views/game_view.js @@ -3,7 +3,7 @@ import $ from 'jquery'; import Game from 'app/models/game'; import GameBoard from 'app/models/game_board'; -import AllGames from 'app/collections/all_games'; +// import AllGames from 'app/collections/all_games'; import PlayerView from 'app/views/player_view'; import GameBoardView from 'app/views/gameboard_view'; @@ -21,11 +21,11 @@ const GameView = Backbone.View.extend({ el: '#player-view' }); - console.log("options"); - console.log(options); + // console.log("options"); + // console.log(options); this.gameList = options.completedGames; - console.log("all games"); - console.log(this.gameList); + // console.log("all games"); + // console.log(this.gameList); this.listenTo(gameBoardView, 'selectSpace', this.playTurn); this.listenTo(this.model, 'invalid', this.spaceTaken); @@ -39,7 +39,7 @@ const GameView = Backbone.View.extend({ }, render: function() { - this.showAllGames(); + // this.showAllGames(); return this; }, @@ -75,33 +75,33 @@ const GameView = Backbone.View.extend({ }, spaceTaken: function() { - console.log("in spaceTaken"); + // console.log("in spaceTaken"); // alert("That space is taken already, Go Again."); $('#message-box').append("Space's Taken, Go Again."); $('#message-box').css('background-color', '#EA6E6E'); }, gameOver: function() { - console.log("in gameOver"); + // console.log("in gameOver"); // alert("The Game's already over"); $('#message-box').append("Game's Over."); $('#message-box').css('background-color', '#EA6E6E'); }, stateWinner: function (winner) { - console.log("in winner"); - console.log(winner); + // console.log("in winner"); + // console.log(winner); // alert("There's a winner "); $('#message-box').append("Winner: " + winner.name); $('#message-box').css('background-color', '#88D18A'); - console.log(this.gameList); + // console.log(this.gameList); this.gameList.create(this.model); this.showAllGames(); }, stateCatsGame: function () { - console.log("in winner"); + // console.log("in winner"); // alert("It's a Cat's Game :("); $('#message-box').append("Cat's Game :("); $('#message-box').css('background-color', '#68ABBA'); @@ -112,17 +112,17 @@ const GameView = Backbone.View.extend({ }, showAllGames: function() { - console.log("in update all games"); - console.log(this.gameList); + // console.log("in update all games"); + // console.log(this.gameList); var self = this; this.gameList.fetch().done(function() { $.each(self.gameList.models, function(index, game){ - console.log('game:'); - console.log(game); + // console.log('game:'); + // console.log(game); var row = $(''); var id = $('' + game.id + ''); - console.log(game.id); + // console.log(game.id); var outcome = $('' + game.outcome + ''); var button = $('' + '' + ''); @@ -134,7 +134,7 @@ const GameView = Backbone.View.extend({ }, deleteAGame: function(gameId) { - console.log("in delete function"); + // console.log("in delete function"); // this.gameList.destroy(gameId); } }); diff --git a/src/app/views/gameboard_view.js b/src/app/views/gameboard_view.js index 406dfad..c2af59d 100644 --- a/src/app/views/gameboard_view.js +++ b/src/app/views/gameboard_view.js @@ -23,9 +23,9 @@ var GameBoardView = Backbone.View.extend({ }, render: function() { - console.log('in gameBoardView.render'); + // console.log('in gameBoardView.render'); var array = this.model.gameBoard; - console.log(array); + // console.log(array); $('#00').empty(); $('#00').append(array[0][0]);