I finished all the winning conditions but I broke the game when I tried to make a condition when there is a tie so I'm guessing that may be the problem. I'm not sure if this code is correct:
(xoArray[0] === 'x' || xoArray[0] === 'o')&&(xoArray[1] === 'x' || xoArray[1] === 'o')
Unfortunately I ran out of time but I'll take another look at it tomorrow and if I get it working I will make the "You win" message better.
Tuesday, April 29, 2014
Monday, April 28, 2014
Tic Tac Toe
Here are some questions I have
Could you explain the nth-child and how you applied it to tr and td?
How does this line work exactly "xoClass = (xoClass === 'x') ? 'o' : 'x';"?
I think you explained both of these to me but I still don't quite understand.
Could you explain the nth-child and how you applied it to tr and td?
How does this line work exactly "xoClass = (xoClass === 'x') ? 'o' : 'x';"?
I think you explained both of these to me but I still don't quite understand.
Friday, April 25, 2014
Wednesday, April 23, 2014
JavaScript Cash Register
Here is the code for the cash register
http://students.gctaa.net/~snicholakos/javascript/register.js
http://students.gctaa.net/~snicholakos/javascript/register.js
Tuesday, April 22, 2014
JavaScript Objects II Notes
- Constructors are actually their own type of class
- A public method can return a private variable along with other private methods
- Use "var" in a class to make the variable private and "this" to make it public
- this.age = age; (public)
var bankBalance = 7500; (private) - Inheritance is useful when 2 classes share similar properties
- "Child".prototype = new "Parent"()
- If you want a method to work with all the members of a class use "prototype"
className.prototype.newMethod = function() { statements; };
- "Typeof" allows you to determine the type of a variable
- "hasOwnProperty" returns true or false whether or not an object has a certain property
- This is useful for if else statements
- "for in loops" are simplified for loops that look like this
for (var properties in nyc){ console.log(nyc[properties]); }
bracket notations can be used to print the values of an object
Monday, April 21, 2014
JavaScript
I started the lesson and finished about a third of it. The review was really nice and I have my notes in a separate post just because I want it all in one post and I should be able to post that tomorrow.
Thursday, April 10, 2014
Tic Tac Toe
I fixed the positioning of the x's and o's but I still can't figure out how to prevent the x from changing to an o. I tried to put in a statement that would check but either it doesn't work or I am not putting it in the correct place.
if (!$(this).hasClass("o")) || (!$(this).hasClass("x")) {
if (!$(this).hasClass("o")) || (!$(this).hasClass("x")) {
Wednesday, April 9, 2014
Tic Tac Toe
Here is the newer version of my game
I would say that if I could just fix the toggle then it would be fully functional. Although, I could make it look nicer like by centering the images, making the grid bigger, etc.
I would say that if I could just fix the toggle then it would be fully functional. Although, I could make it look nicer like by centering the images, making the grid bigger, etc.
Monday, April 7, 2014
JavaScript
Questions
- What does the following expression evaluate to "var answer = (((3 * 90) === 270) || !(false && (!false)) || "bex".toUpperCase() === "BEX");"?
- Write a switch statement that uses 2 cases and a default.
- Create an object with 2 properties either using object literal notation or constructor notation.
- Access any property of the object "dog" using either bracket notation or dot notation.
- var dog = {
species: "greyhound",
weight: 60,
age: 4
}; - Make a method for an object, "rectangle", to change its height.
- var rectangle = new Object();
rectangle.height = 3;
rectangle.width = 4;
Friday, April 4, 2014
Tic Tac Toe
I got the game working for the most part but there are a couple of problems:
- When a shape is put into the grid it hugs the border when I would like it to be a bit smaller than the spot it takes up. I also had to change the circle to a square otherwise the border of the table would wrap around the circle.
- If you click on the green square when the red square is queued up it will replace the green square.
- .circle{
background-color:#00CC00;
//border-radius: 100%;
width:90px;
height:90px;
}
.square{
background-color:#FF0000;
width:90px;
height:90px; - I noticed that whichever style is first is the one that will be replaced. I think both these things have something to do with CSS specificity but I don't quite know.
Thursday, April 3, 2014
jQuery
I added some more to the To Do list, you can see it for yourself here. The only problem I currently have with it is that there is an empty bullet point.
I started on the friends list, although I did not get a lot done, but I do have all of tomorrow to work on either that or the tictactoe game.
I started on the friends list, although I did not get a lot done, but I do have all of tomorrow to work on either that or the tictactoe game.
Wednesday, April 2, 2014
jQuery
I finished up the lesson and I added the to do list to my web page. I added a bit of CSS to it to make it look better but I will have to go back to it and add more later.
http://students.gctaa.net/~snicholakos/webgraphics/todo.html
http://students.gctaa.net/~snicholakos/webgraphics/todo.html
Tuesday, April 1, 2014
JQuery
I tried out the toggleClick function but I wasn't able to get it working so I moved on to the lesson. I've finished most of the lesson and I'm hoping that by the end of it I may be able to fix my game.
This lesson mainly talked about messing with the html using JQuery
This lesson mainly talked about messing with the html using JQuery
- $(document).ready(function() {
$("#text").click(function() {
$(this).addClass("highlighted")
});
}); - For example this function adds a class to text which adds CSS to it giving it a highlighted effect(removeClass does the opposite)
- $(document).ready(function () {
$("body").append("<p>I'm a paragraph!</p>");
}); - This simply adds a paragraph to the end of the body, alternatively prepend would put it at the start
- remove gets rid of an element completely while empty gets rid of its contents
Subscribe to:
Posts (Atom)