Tuesday, April 29, 2014

Tic Tac Toe

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.

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.



Friday, April 25, 2014

jQuery

I finished up the jQuery lesson and here is a link to my moveme web page. Unfortunately I did not get any work done on my other projects because I was having a hard time with JavaScript but I should be able to next week.

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")) {

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.

Monday, April 7, 2014

JavaScript

Questions
  1. What does the following expression evaluate to "var answer = (((3 * 90) === 270) || !(false && (!false)) || "bex".toUpperCase() === "BEX");"?
  2. Write a switch statement that uses 2 cases and a default.
  3. Create an object with 2 properties either using object literal notation or constructor notation.
  4. Access any property of the object "dog" using either bracket notation or dot notation.
    • var dog = {
        species: "greyhound",
        weight: 60,
        age: 4
      };
  5.  Make a method for an object, "rectangle", to change its height.
    • var rectangle = new Object();
      rectangle.height = 3;
      rectangle.width = 4;
Also, I tried to have the items in my to do list highlight when the cursor hovered over them but instead it highlighted the entire list. You can take a look at it but I will likely remove it later unless I can make it look better.

Friday, April 4, 2014

Tic Tac Toe

I got the game working for the most part but there are a couple of problems:
  1. 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.
  2. 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.
I forgot to do my JavaScript questions but I am committed to doing it next week!

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.


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

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
  • $(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