Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Sarah N TicTacToe #8

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
031494d
Makes files for tictactoe logic and testing
nahmisa Dec 13, 2016
e8cbb97
Tests that a TicTacToe game is defined
nahmisa Dec 13, 2016
09e2964
Defines a board instance for TicTacToe
nahmisa Dec 13, 2016
056dbac
Defines two players for TicTacToe game
nahmisa Dec 13, 2016
d6bb5d2
Tests that a new board object is defined
nahmisa Dec 13, 2016
9507af2
Refactors board to be the actual board
nahmisa Dec 13, 2016
e2984f5
Tests that a player object is defined
nahmisa Dec 13, 2016
a355d2e
Refactors to make players actual players
nahmisa Dec 13, 2016
28d87d6
Lunchtime commit
nahmisa Dec 13, 2016
328fb9d
Separates objects between files for testing
nahmisa Dec 13, 2016
f270b88
Tests move in TicTacToe module
nahmisa Dec 13, 2016
4072e46
Jerk codes the test for valid placement as we have not made a real bo…
nahmisa Dec 13, 2016
0ff8172
Tests that board is constructed as a 3 long array of sub-arrays
nahmisa Dec 13, 2016
4e488ec
Tests null default values for instantiating grid
nahmisa Dec 13, 2016
98280f2
Tests ability to check if a board position is open or invalid
nahmisa Dec 13, 2016
3673003
Adds logic to move for checking placement
nahmisa Dec 13, 2016
f98601c
Tests that an occupied board returns false for valid placement
nahmisa Dec 13, 2016
3b52b4b
Tests that a boards value can be updated to a given marker
nahmisa Dec 13, 2016
b4e7290
Tests that a game has turns
nahmisa Dec 13, 2016
f1d1230
Increments turns by 1
nahmisa Dec 13, 2016
c42132a
Tests that a player can be changed to its counterpart
nahmisa Dec 13, 2016
93efe59
Tests that endMove adds a turn and changes player
nahmisa Dec 13, 2016
680358f
Randomized the starting player through the sample method
nahmisa Dec 13, 2016
80b125f
Tests hasWon with no winner and jerk code
nahmisa Dec 14, 2016
edcf355
Tests horizontal win
nahmisa Dec 14, 2016
063c583
Test vertical victory
nahmisa Dec 14, 2016
b6cb4a1
Tests for diagonal victory
nahmisa Dec 14, 2016
6a04f9a
Tests that player only changes if game has not been won
nahmisa Dec 14, 2016
f71fd14
Moves instance variables to tests that use them to be granular
nahmisa Dec 14, 2016
b758c70
Starts testing playTurn
nahmisa Dec 14, 2016
de9c46d
WIP outputResult testing
nahmisa Dec 14, 2016
88f881b
tests playTurn
nahmisa Dec 14, 2016
e463141
Updates a comment
nahmisa Dec 14, 2016
4de0510
Comments that playTurn indirectly tests outputResult
nahmisa Dec 14, 2016
8c64bd0
Stub files for Backbone app
heatherherrington Dec 16, 2016
7bc0d24
Moves app.js
nahmisa Dec 16, 2016
4570319
Fleshes out index.html
nahmisa Dec 16, 2016
e1f1daf
Adds board and players to the application view to be used in sub view…
nahmisa Dec 16, 2016
b9c23c9
Adds ids so we can switch players like we did with an array
nahmisa Dec 16, 2016
f38cefb
Hot mess
nahmisa Dec 17, 2016
c788eb8
Changes currentPlayerID instead of currentPlayer
nahmisa Dec 19, 2016
94a8521
Renders board view and triggers all the selects
nahmisa Dec 19, 2016
d635570
Adds divs back in so only one trigger occurs
nahmisa Dec 19, 2016
dd01bf1
Adds position to square so we can eventually update the grid
nahmisa Dec 19, 2016
1758a35
CSS for marginal prettiness
heatherherrington Dec 19, 2016
9a8ed51
Thing of beauty
heatherherrington Dec 19, 2016
74e6bd9
Removes console logs
nahmisa Dec 19, 2016
f6a2928
Changes model in BoardView to Board, not just Grid
nahmisa Dec 19, 2016
3dfc719
Adds a new X when clicked
nahmisa Dec 19, 2016
55cc665
Indentation for Heather
nahmisa Dec 19, 2016
11b11c6
Triggers change event
nahmisa Dec 19, 2016
1386485
fixes stuff
nahmisa Dec 20, 2016
a37b0ba
All tests passing
heatherherrington Dec 20, 2016
ebc35c2
Fixed typo
heatherherrington Dec 20, 2016
a163a25
Alternating X and O
heatherherrington Dec 20, 2016
b64dc14
Alerts which player won or if there is a tie
heatherherrington Dec 20, 2016
66a1ac2
WIP API integration
heatherherrington Dec 20, 2016
b6231fc
Passing tests
nahmisa Dec 20, 2016
4e13d15
Alert box on invalid move
nahmisa Dec 20, 2016
2108369
Makes it so a player cant continue marking board after someone has won
nahmisa Dec 21, 2016
998df3c
CSS styling as a gradient
nahmisa Dec 21, 2016
1bf00e7
Removes some comments
nahmisa Dec 21, 2016
7afddeb
Removes some more comments
nahmisa Dec 21, 2016
b458814
More styling
nahmisa Dec 21, 2016
8853c33
Makes tictactoe board format like the API wants it for JSON
nahmisa Dec 21, 2016
941a215
Miracles
nahmisa Dec 21, 2016
5f9fd7d
Finishes wave 4
nahmisa Dec 22, 2016
8334b5a
Adds a better trash can
nahmisa Dec 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 53 additions & 7 deletions build/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tic-Tac-Toe</title>
<meta charset="utf-8">
</head>
<body>
<script src="/app.bundle.js" charset="utf-8"></script>
</body>
<head>
<title>Tic-Tac-Toe</title>
<meta charset="utf-8">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">

<link href="https://fonts.googleapis.com/css?family=Press+Start+2P" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/foundation/6.2.4/foundation.min.css">
<link rel="stylesheet" href="styles/index.css">
</head>
<body>

<div id="application">

<main>
<h1> Tic-Tac-Gradient </h1>
<div id="current-player"></div>

<section id="ttt-board">
<ul id="board-squares"></ul>
</section>

</main>

<section id="players">

</section>

<section id="hall-of-fame">
<ul id="played-games"></ul>
</section>



</div>
<!-- #application end-->


<!-- Underscore Templates -->

<!-- Player -->
<script type="text/template" id="tmpl-player">
<h2><%- name %></h2>
</script>

<!-- Player -->
<script type="text/template" id="tmpl-results">
<h3><%- results %></h3>
</script>

<script src="/app.bundle.js" charset="utf-8"></script>

</body>
</html>
85 changes: 85 additions & 0 deletions build/styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
h1, h2, h3 {
font-family: 'Press Start 2P', cursive;
text-align: center;
color: grey;
}

h1 {
font-size: 4vw;
margin: 3vw;

}

h2, h3 {
font-size: 2vw;
margin-bottom: 0;
}

body {
margin: 10px 10%;
background-color: white;
}

#ttt-board, #played-games {
width: 60%;
margin: 0 auto;
}

li {
list-style: none;
border: .25vw solid white;
background-color: rgba(128, 128, 128, 0.4);
min-height: 11vw;
min-width: 11vw;
border-radius: .25rem;
padding: .25vw;
}

#players {
margin-bottom: 2vw;
}

#played-games > li {
padding: 4vw;
margin: 1vw;
}

#played-games > li:hover {
background-color: rgba(128, 128, 128, 1);
padding: 2vw;
padding-top: 3vw;
}

#played-games > li:hover h3::before {
font-family: FontAwesome;
content: '\f1f8';
color: white;
padding-left: 15vw;
font-size: 3vw;
padding-top: 0;
padding-bottom: 0;
}

/*X Gradient*/

.X0 { background-color: #4A9E9D; }

.X1 { background-color: #4C8E99; }

.X2 { background-color: #4F8396; }

.X3 { background-color: #536B90; }

.X4 { background-color: #565D8E; }

/*O Gradient*/

.O0 { background-color: #FFC271; }

.O1 { background-color: #FFB670; }

.O2 { background-color: #FFA570; }

.O3 { background-color: #FF936F; }

.O4 { background-color: #FF8A6F; }
55 changes: 55 additions & 0 deletions spec/board.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Do not remove
import Board from 'app/models/board';

describe('Board', function() {

var testBoard = new Board();

describe('Board', function() {
it('should be defined', function() {
expect(testBoard).toBeDefined();
});

it('should have a grid', function() {
expect(testBoard.get('grid')).toBeDefined();
});

});

describe('grid', function() {

var grid = testBoard.get('grid');

it('should be an array', function() {
expect(Array.isArray(grid)).toBe(true);
});

it('should be 3 long', function() {
expect(grid.length).toEqual(3);
});

it('should be made of sub-arrays', function() {
grid.forEach(function(array) {
expect(Array.isArray(array)).toBe(true);
});
});

it('each sub-arrays should have a length of 3', function() {
grid.forEach(function(array) {
expect(array.length).toEqual(3);
});
});

it('each sub-arrays should default values of null', function() {
grid.forEach(function(array) {
array.forEach(function(element){
expect(element).toBeNull();

});
});
});



});
});
25 changes: 25 additions & 0 deletions spec/player.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Do not remove
import Player from 'app/models/player';

describe('Player', function() {

var testPlayerX = new Player({name: "Testy", marker: "X"});
var testPlayerO = new Player({name: "Crabby", marker: "O"});

describe('Player', function() {
it('should be defined', function() {
expect(testPlayerX).toBeDefined();
});

it('should have a name', function() {
expect(testPlayerX.get('name')).toEqual("Testy");
});

it('should be assigned a marker', function() {
expect(testPlayerX.get('marker')).toEqual("X");
expect(testPlayerO.get('marker')).toEqual("O");
});

});

});
Loading