master
Thom Page 10 years ago
parent f06d459eeb
commit debd0f5db3

@ -1,22 +1,18 @@
var fac = function(num, prod) { var fac = function(num, prod) {
if (num === 0) { return prod } if (num === 0) { return prod }
prod *= num; prod *= num;
return fac(num - 1, prod); return fac(num - 1, prod);
} }
// Sharon's solution // Sharon's solution
var fac = function(num) { var fac1 = function(num) {
if (num === 1) { if (num === 1) {
return 1; return 1;
} }
return num * fac(num-1); return num * fac1(num-1);
}; // end of function }; // end of function

@ -0,0 +1,106 @@
# ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Project #1: The Game
## Overview of `blackjack.js`
![](http://upload.wikimedia.org/wikipedia/commons/4/4b/Blackjack_board.JPG)
### The game
[Blackjack](http://en.wikipedia.org/wiki/Blackjack) is a one player game where people down on their luck generally transform their lives. It's probably a thing in your universe, but feel free to read up on it if you have to.
## Project Details
### Basic features
A basic implementation of this project should probably include:
1. A way to keep track of the current player bankroll ( a player should be able to play multiple hands and the bankroll should reflect wins and losses)
2. A way for players to make a bet
3. A way for players to get more cards, or declare themselves happy with their current hand
4. A way for players to bust
5. A way for players to win or tie
6. Game logic for the dealer to hit until a certain point
### Advanced features
Going above and beyond the basic implementation is desirable, should you have the time. Feel free to enhance your project with any of the following features:
1. A button on `game over` to reset the game back to initial state
2. A way for players to 'split' a hand
3. A way for players to 'double down' on a hand
4. Appropriate handling of 'insurance' and dealer blackjack
## Implementation
### Technologies
You will be expected to use the following technologies to implement this project:
- **HTML**
Your HTML should be semantic.
- **CSS**
Your game should be stylish.
- **JavaScript & jQuery**
Your game should be playable *and* responsive.
### Timeframe
The timeframe for this project is approximately 2 continuous days of class time and two weekend days.
## Expectations
### You
As a student you should be doing the following things:
- **Planning **
Plan out your project before you begin. What data structures will you need (objects, arrays)? What layout will your project have on the page (you could make a wireframe)? How will you organize your code? Pseudo-code out any thorny issues you might already anticipate.
- **Version Control**
Use **git** and **github** for version control, and make frequent incremental commits to prevent large scale implosions. Make a fresh repo outside the wdi-lettuce repo for your project so that
it will be public.
- **Hosting**
Host your application on **githubpages**, or something similar so the class and instructors can use it.
### Us
Since your instructors will be assessing your work, they will look for the following things:
- **Project Workflow**
Did you you plan your project before you started? Did you use source control as expected for the phase of the program youre in (detailed above)?
- **Technical Requirements**
Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex?
- **Creativity**
Did you add a personal spin or creative element into your project submission? Did you deliver something of value to the end user?
- **Code Quality**
Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class?
- **Problem Solving**
Are you able to defend why you implemented your solution in a certain way? Can you demonstrate that you thought through alternative implementations? (Note that this part of your feedback evaluation will take place during your one-on-one code review with your instructors, after you've completed the project.)
## Deliverables
By the time the project is over, we will expect the following from you:
* A **working game, built by you**, hosted somewhere on the internet
* A **link to your hosted working app** in the URL section of your Github repo
* A **git repository hosted on Github**, with a link to your hosted project, and frequent commits dating back to the very beginning of the project
* **A ``readme.md`` file** with explanations of the technologies used, the approach taken, installation instructions, unsolved problems, etc.
Most importantly a **technical demonstration** of your app which:
* Is 5 minutes in length
* Shows off all features of the app
* Explains the technical details
* Explains the technical challenges
* Explains which improvements you might make

@ -0,0 +1,107 @@
# ![]() Project #1: The Game
## Overview of `connect four`
![](http://uncannyflats.com/wp-content/uploads/2013/12/connect-4.jpg)
### The game
[Connect Four](https://en.wikipedia.org/wiki/Connect_Four) is a two-player adventure of mystery, mayhem, and intrigue. It's probably a thing in your universe, but feel free to read up on it if you have to.
## Project Details
### Necessary features
A basic implementation of this project must include:
1. An interactive board which renders on page load
2. A way for players to set their name
3. A way for players to mark an empty space on their turn
4. The game should end when there is a winner, or if the game is a tie
5. The game should report the end state
Additionally you should use CSS to ensure a reasonable amount of styling to keep your project presentable.
### Advanced features
Going above and beyond the basic implementation is desirable, should you have the time. Feel free to enhance your project with any of the following features:
1. A button on `game over` to reset the game back to initial state
2. A way to keep track of Player 1 vs. Player 2 wins
- An option to play vs. a computer with AI
- Level 1: Random empty space is good enough
- Level 2: Computer chooses a space which immediately blocks a player win
3. Add in the ability to store a game to play later. This might use Firebase or local storage to do so.
4. Add in the ability to play live with somebody remotely. This will definitely need to use [Firebase](https://www.firebase.com/).
## Implementation
### Technologies
You will be expected to use the following technologies to implement this project:
- **HTML**
Your HTML should be semantic.
- **CSS**
Your game should be stylish.
- **JavaScript & jQuery**
Your game should be playable *and* responsive.
### Timeframe
The timeframe for this project is approximately 2 continuous days of class time and two weekend days.
## Expectations
### You
As a student you should be doing the following things:
- **Planning **
Plan out your project before you begin. What data structures will you need (objects, arrays)? What layout will your project have on the page (you could make a wireframe)? How will you organize your code? Pseudo-code out any thorny issues you might already anticipate.
- **Version Control**
Use **git** and **github** for version control, and make frequent incremental commits to prevent large scale implosions. Make a fresh repo outside the wdi-lettuce repo for your project so that
it will be public.
- **Hosting**
Host your application on **githubpages**, or something similar so the class and instructors can use it.
### Us
Since your instructors will be assessing your work, they will look for the following things:
- **Project Workflow**
Did you you plan your project before you started? Did you use source control as expected for the phase of the program youre in (detailed above)?
- **Technical Requirements**
Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex?
- **Creativity**
Did you add a personal spin or creative element into your project submission? Did you deliver something of value to the end user?
- **Code Quality**
Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class?
- **Problem Solving**
Are you able to defend why you implemented your solution in a certain way? Can you demonstrate that you thought through alternative implementations? (Note that this part of your feedback evaluation will take place during your one-on-one code review with your instructors, after you've completed the project.)
## Deliverables
By the time the project is over, we will expect the following from you:
* A **working game, built by you**, hosted somewhere on the internet
* A **link to your hosted working app** in the URL section of your Github repo
* A **git repository hosted on Github**, with a link to your hosted project, and frequent commits dating back to the very beginning of the project
* **A ``readme.md`` file** with explanations of the technologies used, the approach taken, installation instructions, unsolved problems, etc.
Most importantly a **technical demonstration** of your app which:
* Is 5 minutes in length
* Shows off all features of the app
* Explains the technical details
* Explains the technical challenges
* Explains which improvements you might make

@ -71,17 +71,16 @@ var makeBoard = function() {
} }
var play = function() { var play = function() {
if (!this.className.includes("x") && !this.className.includes("o")) { if (!this.className.includes("clicked") {
if (turn) { if (turn) {
this.innerHTML = '<img src="images/x.png"/>'; this.innerHTML = '<img src="images/x.png"/>';
this.className += ' x';
Xpositions.push(this.id); Xpositions.push(this.id);
} else { } else {
this.innerHTML = '<img src="images/o.png"/>'; this.innerHTML = '<img src="images/o.png"/>';
this.className += ' o';
Opositions.push(this.id); Opositions.push(this.id);
} }
turn = !turn; turn = !turn;
this.className += " clicked";
checkWin(); checkWin();
} }
} }
@ -116,82 +115,3 @@ var checkPositions = function(playerPositions) {
// EOF // EOF
// if (size == 9) {
// windex = [
// [0, 1, 2], [3, 4, 5], [6, 7, 8],
// [0, 3, 6], [1, 4, 7], [2, 5, 8],
// [0, 4, 8], [2, 4, 6]
// ];
// } else if (size == 16) {
// windex = [
// [0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 23, 14, 15],
// [0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14], [3, 7, 11, 15],
// [0, 5, 10, 15], [3, 6, 9, 12]
// ];
// } else if (size == 25) {
// windex = [
// [0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24],
// [0, 5, 10, 15, 20], [1, 6, 11, 16, 21], [2, 7, 12, 17, 22], [3, 8, 13, 18, 23], [4, 9, 14, 19, 24],
// [0, 6, 12, 18, 24], [4, 8, 12, 16, 20]
// ];
// }
// sets up arrays of winning row numbers
// for (var i=0; i < Math.sqrt(size); i++) {
// var row = [];
// for (var j=(i * Math.sqrt(size)); j < (Math.sqrt(size) + (i * Math.sqrt(size))); j++) {
// row.push(j);
// }
// winrar.push(row);
// }
// console.log('rows: ', winrar);
// var winwoop = [];
// for (var i=0; i < Math.sqrt(size); i++) {
// var col = [];
// for (var j = i; j < (i + parseInt(size)); j += Math.sqrt(size)) {
// col.push(j);
// }
// winwoop.push(col);
// }
// console.log('columns: ', winwoop);
// [0, 4, 8], [2, 4, 6]
// var windrip = [];
// var diag1 = [];
// var diag2 = [];
// for (var j=0; j < parseInt(size); j += (Math.sqrt(size) + 1)) {
// diag1.push(j);
// }
// for (var k=(Math.sqrt(size) - 1); k <= (size - Math.sqrt(size)); k += (Math.sqrt(size) - 1)) {
// diag2.push(k);
// }
// console.log('diag1: ', diag1);
// console.log('diag2: ', diag2);
// 0, 3, 6
// 1, 4, 7
// 2, 5, 8
// sets up arrays of winning column numbers
// sets up arrays of winning diagonal numbers
// console.log(diag2);

@ -19,16 +19,15 @@ var windex = [
]; ];
var play = function() { var play = function() {
if (!this.className.includes("x") && !this.className.includes("o")) { if (!this.className.includes("clicked")) {
if (turn) { if (turn) {
this.innerHTML = '<img src="images/x.png"/>'; this.innerHTML = '<img src="images/x.png"/>';
this.className += ' x';
Xpositions.push(this.id); Xpositions.push(this.id);
} else { } else {
this.innerHTML = '<img src="images/o.png"/>'; this.innerHTML = '<img src="images/o.png"/>';
this.className += ' o';
Opositions.push(this.id); Opositions.push(this.id);
} }
this.className += " clicked";
turn = !turn; turn = !turn;
checkWin(); checkWin();
} }

@ -6,8 +6,7 @@
Title: Shell game<br> Title: Shell game<br>
Type: Homework<br> Type: Homework<br>
Duration: Weekend <br> Duration: Weekend <br>
Creator: Kristyn Bryan <br> Adapted by: Thom Page, Kristyn Bryan <br>
Adapted by: Thom Page
Course: WDIr-Panthalassa<br> Course: WDIr-Panthalassa<br>
Competencies: jQuery, JS game logic, CSS transitions<br> Competencies: jQuery, JS game logic, CSS transitions<br>
@ -24,16 +23,19 @@ In the shell game, three or more identical containers (which may be cups, shells
A small ball or coin is placed beneath one of these containers so that it cannot be seen, and they are then shuffled by the operator in plain view. A small ball or coin is placed beneath one of these containers so that it cannot be seen, and they are then shuffled by the operator in plain view.
One or more players are invited to bet on which container holds the ball . One or more players are invited to bet on which container holds the ball .
Where the game is played honestly, the operator can win if he shuffles the containers in a way which the player cannot follow. Where the game is played honestly, the operator can win if he shuffles the containers in a way which the player cannot follow.
See this website for an example: http://mistupid.com/games/shellgame.htm
Here is a short video using _brains_ instead of shells: https://www.youtube.com/watch?v=N6UNLHZgwfs
Here is a playable shell game with betting: http://mistupid.com/games/shellgame.htm
* Generate your shells with jQuery. Make them inside a loop.
* Generate your shells, cococunts, cups, or brains, etc. with jQuery. Make them inside a loop.
* Put a start button the page. When the button is pressed * Put a start button the page. When the button is pressed
* a random shell will get the ball and display it. * a random shell will get the ball and display it.
* The start button will now display 'shuffle'. Functionally, it will now be a shuffle button. * The start button will now display 'shuffle'. Functionally, it will now be a shuffle button.
* When the shuffle button is pressed * When the shuffle button is pressed
* Without yet using any animations, the positions of the shells on the page should randomize. Display the shells in their new order. * The positions of the shells on the page should change places in random order. Display the shells in their new order.
* The ball will not be displayed. * The ball will not be displayed.
* when the user clicks on the correct shell * when the user clicks on the correct shell
* The ball will reappear * The ball will reappear
@ -41,11 +43,70 @@ See this website for an example: http://mistupid.com/games/shellgame.htm
## Remove cheating ## Remove cheating
Make it so the user cannot check in the 'Elements' tab to see which shell has the ball after they have been shuffled. Make it so the user cannot check in the 'Elements' tab to see which shell has the ball after they have been shuffled.
## User Stories
1. The user should be able to see where the 'ball' is originally.
2. The user should be able to start the shuffling sequence and follow (even if it's difficult) the card/coconut/cup/brain. The shuffling should be random.
3. The user should be able to then click the element, and the game should tell them whether or not they picked the correct one.
4. the user should be able to reset game and do it all over again.
## Animations
#### Fade
One of the simpler animation effects is the fade. If you fade out two cards and then fade them back in, you can create a way to visualize two cards switching.
#### Transitions and Transforms
A harder method is using transitions and transforms. Think about the location you want for each element and how to 'swap' these locations.
* You can set up transforms in your javascript using `jQuery.css()`
```
$(element).css({transform: 'translate(' + value + 'px)'});
$(element).css({transition: 'all 0.4s ease-in'});
```
* You can also use `jQuery.css()` to trigger css keyframes by giving the element the applicable `animation-name`
```
$(element).css({ animationName: 'name_of_keyframe_animation' });
```
#### Looping transforms
If you try to repeat transforms in a regular for loop, it might not work so well. The reason is that the loop is so quick that it will end before even the first transform has finished.
Try using a setTimeout to repeat the transforms, with the second parameter slightly longer than the duration of the transform:
```
var transformLoop = setTimeout(someFunction, 501);
```
Then you can stop the setTimeout using clearTimeout:
```
clearTimeout(transformLoop);
```
## Bonuses and Extras
- The user should be able to see how many times s/he has won.
- The amount of times the cards swap on a shuffle is randomized.
- The more times the user completes the game, the harder it gets (the faster the shuffle).
## Before you start writing code...
1. Write out the objects you think you'll need.
2. For each object, list its responsibilities. What data will it need to store? What methods will it need?
3. List all possible object-to-object interactions.
4. Draw a 'paper prototype' of the DOM model for your game. You'll use this to build it.
## Hints, Tips and Tricks ## Hints, Tips and Tricks
Here are some hints, tips and tricks that may or may not be applicable to you or the way you design your game, but they might help: Here are some hints, tips and tricks that may or may not be applicable to you or the way you design your game, but they might help:
@ -54,8 +115,7 @@ Here are some hints, tips and tricks that may or may not be applicable to you or
* `$('div')` will _select_ all `div`s on the page * `$('div')` will _select_ all `div`s on the page
* `$('<div>')` will _create_ a new `div` * `$('<div>')` will _create_ a new `div`
<br> <br>
* To stop an element from shifting down when text is added, try * To stop an element from shifting down when text is added, try setting `overflow: hidden` to the css of that element.
setting `overflow: hidden` to the css of that element.
* To stop inline-block elements from shifting due to the browser window size, try setting a `min-width` on the parent * To stop inline-block elements from shifting due to the browser window size, try setting a `min-width` on the parent
@ -64,16 +124,6 @@ http://www.w3schools.com/jquery/jquery_css.asp
* To check if an element has a particular `id`, look into jQuery `.is()` * To check if an element has a particular `id`, look into jQuery `.is()`
* If you want a variable to be globally available to changes within your functions, define it first outside of your functions (it doesn't need to have a value)
```
var someNumber;
var giveValue = function() {
someNumber = 1;
}
```
* You can use variables to get an element with jQuery. * You can use variables to get an element with jQuery.
``` ```
@ -84,39 +134,32 @@ $('#' + someNumber)
// gets the element with an id of 1 // gets the element with an id of 1
``` ```
* If you need a function that will shuffle an array, it's fine to borrow one from StackOverflow. Alternatively, you could look into including the `underscore` library and using its shuffle method in your program
* To make your cursor a pointer when you hover over an element, set its css to `cursor: pointer`.
* You can find the index of jQuery list items with `.index()`
* If you want a variable to be globally available to changes within your functions, define it first outside of your functions (it doesn't need to have a value)
## User Stories ```
var someNumber;
1. The user should be able to see where the 'ball' is originally. var giveValue = function() {
2. The user should be able to start the shuffling sequence and follow (even if it's difficult) the card/coconut/cup. The shuffling should be random. someNumber = 1;
3. The user should be able to then click a card, and the game should tell them whether or not they picked the correct one. }
4. the user should be able to reset game and do it all over again. ```
## How do we get the 'shuffle' animation? * You can set up transforms using jQuery.css()
One of the simpler animation effects is the fade. If you fade out two cards and then fade them back in, you can create a way to visualize two cards switching. ```
$(element).css({transform: 'translate(' + value + 'px)'});
$(element).css({transition: 'all 0.4s ease-in'});
```
A harder method (and easier on the eyes) is using transitions. Think about the location you want for each card and how to 'swap' these locations. * You can also use jQuery.css() to trigger css keyframes by giving the element the applicable `animation-name`
## Bonuses and Extras ```
$(element).css({ animationName: 'name_of_animation' });
```
- The user should be able to see how many times s/he has won. * If you need a function that will shuffle an array, it's fine to borrow one from StackOverflow. Alternatively, you could look into including the `underscore` library and using its shuffle method in your program. Remember, you can also select a random array index with `array[Math.floor(Math.random() * array.length)]`
- The amount of times the cards swap on a shuffle is randomized.
- The more times the user completes the game, the harder it gets (the faster the shuffle).
## Before you start writing code... * To make your cursor a pointer when you hover over an element, set its css to `cursor: pointer`.
1. Write out the objects you think you'll need. * You can find the index of jQuery list items with `.index()`
2. For each object, list its responsiblities. What data will it need to store? What methods will it need?
3. List all possible object-to-object interactions.
4. Draw a 'paper prototype' of the DOM model for your game. You'll use this to build it.

@ -27,7 +27,6 @@ $(function() {
$brain.html('<img src="brain.png"/>'); $brain.html('<img src="brain.png"/>');
$board.append($brain); $board.append($brain);
} }
randomBrain = Math.floor(Math.random() * brainNum);
} }
// run the reset function on window onload // run the reset function on window onload
@ -35,6 +34,7 @@ $(function() {
$startShuffle.click(function() { $startShuffle.click(function() {
console.log('start clicked'); console.log('start clicked');
randomBrain = Math.floor(Math.random() * brainNum);
if (state === "start") { if (state === "start") {
giveIdea(); giveIdea();
} else if (state === "shuffle") { } else if (state === "shuffle") {
@ -107,59 +107,3 @@ $(function() {
} }
}); // end window.onload }); // end window.onload
// shuffle($allBrains);
//
// var idx0 = $allBrains.index($('#0'));
// $('#0').css({transform: 'translate(' + (idx0 * 205) + 'px)'});
// $('#0').css({transition: 'all 0.4s ease-in'});
// $('#0 img').css({ animationName: 'brainsize' });
// var idx1 = $allBrains.index($('#1'));
// $('#1').css({transform: 'translate(' + ((idx1 * 205) - 205) + 'px)'});
// $('#1').css({transition: 'all 0.4s ease-in'});
// $('#1 img').css({ animationName: 'brainsize' });
// var idx2 = $allBrains.index($('#2'));
// $('#2').css({transform: 'translate(' + ((idx2 * 205) - 410) + 'px)'});
// $('#2').css({transition: 'all 0.4s ease-in'});
// $('#2 img').css({ animationName: 'brainsize' });
// var idx3 = $allBrains.index($('#3'));
// $('#3').css({transform: 'translate(' + ((idx3 * 205) - 615) + 'px)'});
// $('#3').css({transition: 'all 0.4s ease-in'});
// $('#3 img').css({ animationName: 'brainsize' });
// var idx4 = $allBrains.index($('#4'));
// $('#4').css({transform: 'translate(' + ((idx4 * 205) - 820) + 'px)'});
// $('#4').css({transition: 'all 0.4s ease-in'});
// $('#4 img').css({ animationName: 'brainsize' });
// shuffle borrowed from Stack Overflow
// var shuffle = function(array) {
// var counter = array.length;
// // While there are elements in the array
// while (counter > 0) {
// // Pick a random index
// var index = Math.floor(Math.random() * counter);
// // Decrease counter by 1
// counter--;
// // And swap the last element with it
// var temp = array[counter];
// array[counter] = array[index];
// array[index] = temp;
// }
// return array;
// }

@ -0,0 +1,109 @@
$(function() {
console.log('app.js jquery');
var $board = $('#board');
var $startShuffle = $('#start-shuffle');
var $message = $('#message');
var brainNum = 5;
var gamesPlayed = 0;
var wins = 0;
var randomBrain;
var state;
var reset = function() {
state = "start";
$startShuffle.text("START");
$startShuffle.css('background-color', 'cadetblue');
$startShuffle.css('color', 'white');
$message.text('Click Start to give a brain an idea');
$board.html("");
for (var i=0; i < brainNum; i ++) {
var $brain = $('<div>').attr('id', i);
$brain.addClass('brain');
$brain.html('<img src="brain.png"/>');
$board.append($brain);
}
}
// run the reset function on window onload
reset();
$startShuffle.click(function() {
console.log('start clicked');
randomBrain = Math.floor(Math.random() * brainNum);
if (state === "start") {
giveIdea();
} else if (state === "shuffle") {
$('#' + randomBrain).html('<img src="brain.png"/>');
shuffleBrains();
} else if (state === "reset") {
reset();
}
});
var giveIdea = function() {
console.log('give idea function');
$('#' + randomBrain).html('<img src="brainlight.png"/>');
$startShuffle.text('SHUFFLE');
$startShuffle.css('background-color', 'coral');
$message.text("Press SHUFFLE to shuffle the brains");
state = "shuffle";
}
// run recursively according to the counter
var counter = 0;
var shuffleBrains = function() {
console.log('shuffle brains function running recursively');
var positions = [];
for (var i=0; i < brainNum; i++) {
positions.push(i);
}
var horizontals = [0, 205, 410, 615, 820, 1025, 1230, 1435];
var $allBrains = $('.brain');
$allBrains.each(function(index, value) {
var newIndex = positions.splice(Math.floor(Math.random() * positions.length), 1);
$('#' + index).css({transform: 'translate(' + ((newIndex * 205) - horizontals[index]) + 'px)'});
$('#' + index).css({transition: 'all 0.4s ease-in'});
$('#' + index + ' img').css({ animationName: 'brainsize' });
});
var brainLoop = setTimeout(shuffleBrains, 501);
counter++;
if (counter == 10) {
clearTimeout(brainLoop);
counter = 0;
$message.text('Click on the brain you think is right!');
$startShuffle.html('<img src="braincon.png"/>');
$startShuffle.css('background-color', 'ivory');
$('.brain').click(checkBrain);
}
}
var checkBrain = function() {
if ($(this).is('#' + randomBrain)) {
$('#message').text("THIS IS THE BRAIN!!!");
$('#' + randomBrain).html('<img src="brainlight.png"/>');
wins++;
} else {
$('#message').text('Not the brain . . . ');
}
state = "reset";
$startShuffle.css('display', 'inline-block');
$startShuffle.text('RESET');
$startShuffle.css('background-color', 'black');
$startShuffle.css('color', 'white');
gamesPlayed++
$('#wins').text('WINS: ' + wins + ' out of ' + gamesPlayed);
}
}); // end window.onload

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@ -0,0 +1,26 @@
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<div id="container">
<div id="top">
<div id="start-shuffle">START</div>
<div id="message"></div>
</div>
<div id="board"></div>
<br><br>
<div id="wins">WINS:</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

@ -0,0 +1,70 @@
body {
font-family: monospace;
}
#container {
width: 1200px;
height: 440px;
border: 1px solid black;
text-align: center;
margin: 0 auto;
border-radius: 15px;
background-color: ivory;
}
#top {
margin-top: 20px;
}
#start-shuffle {
/* display: inline-block;*/
width: 100px; height: 40px;
margin: 0 auto;
/* margin-left: 5px;
margin-bottom: 5px;*/
text-align: center;
cursor: pointer;
line-height: 40px;
vertical-align: center;
border-radius: 5px;
font-size: 20px;
}
#message {
/* display: inline-block;*/
line-height: 40px;
}
#board {
min-width: 1200px;
}
.brain {
display: inline-block;
height: auto; width: auto;
margin-left: 5px;
margin-top: 20px;
}
#wins {
margin-top: 100px;
}
img {
animation-duration: 0.5s;
animation-iteration-count: 10;
}
@keyframes brainsize {
0% { transform: scale(1); }
50% { transform: scale(0.6) translateY(200px); }
100% { transform: scale(1); }
}
Loading…
Cancel
Save