RSS

Monthly Archives: July 2012

Slightly Unhealthy Obsession

I read a post a week or so ago (I’ll look for a citation) on whether blogging was addictive. Every characteristic of an addicted blogger made by the writer was something that I think I had just done within the past five minutes: obsessive checking of the blog for comments and likes, convulsively watching my blog’s stats for activity and trolling of the blogosphere for similar blogs in order to like them so that they might come visit my page in return.

I admit it, I’m totally addicted. And I need your help.

Oh no, I don’t want to quit. I don’t really want to control it at all. What I’d prefer to have is some satisfying stats. So, to that end, could you please stop by my blog once in a while. Hit ‘like’ and maybe leave a comment. Perhaps subscribe… and then maybe get someone you know to come by and do all that again.

Right now I get a paltry handful of visits a day (I think my record was 41 – I wish I knew what I had done right that day). I’d like to see if I can get some decent numbers by the end of the summer. It would also be good for me because I know that I’ll write more (and better) if I knew there was someone out there reading.

I have two blogs, this one for DownHouse Software (although I drop anything that’s going on in my life here) and AppCampus, which is a little more serious. I’ve been trying to post some articles on technology in education. I’d also appreciate some article ideas if you have any.

So, if you can help my feed my addiction a little, thank you.

Advertisements
 
5 Comments

Posted by on July 31, 2012 in Personal Life

 

Tags: , , , , , , , ,

Rain

Not much, but we did actually get some rain last night. I saw the proof this morning when I fed our (outdoor) cat. I can’t say that I believe things are turning around in a meaningful way, but I do have some hope now.

Keep your fingers crossed for us here.

By the way, today is day3 of P90X. I haven’t done the workout yet, but I’m dreading it as I don’t have a muscle in my body that isn’t screaming in pain.

 

 
Leave a comment

Posted by on July 31, 2012 in Uncategorized

 

Tags: , , ,

The word ‘desertification’ keeps coming to mind

Here I am moaning and complaining about the weather again. But I just can’t stand these deathly hot, dry days one after another after another.

I’m reminded of a Star Trek Next Generation episode where Captain Picard wakes up in another man’s life. In this life he’s married and a naturalist who discovers that his planet is suffering from a world-wide drought and, in fact, this life experience is a window into the culture of an extinct world. This isn’t a very good explanation – check it out yourself. The episode is called “Inner Light.”

Please don’t let this drought be the Midwest’s Inner Light. At least not while I’m living here.

 

OK, in other news, I just posted another article to AppCampus about how I think video games can be harnessed to improve education in the sciences (or perhaps any subject).

I also need to put together the work we did here on the Blackjack program (codecademy project) into a neat posting for that site’s message board. I think the whole code with sufficient notation and some commentary should be a valuable contribution there.

 

Image

 
Leave a comment

Posted by on July 31, 2012 in Uncategorized

 

Tags: , , , , , ,

Homecoming

It’s so good to be home!

Even dry and desolate, it’s where my own bed is, with my own pillow and my own family.

I can do with not traveling for a while now.

 

ps –

1.I’ve added a companion blog (AppCampus) where I am writing some serious material about technology and education.

2. Tomorrow is day 1 of P90X

 

 

 
Leave a comment

Posted by on July 29, 2012 in Uncategorized

 

Tags: , , , , , ,

Last Day

Today is the last day of my traveling. We head for home tomorrow morning and I am very eager to get there and fall back into a more predictable, more familiar routine. 

Perhaps it’s travel fatigue. Perhaps it’s just homesickness.

 

 
Leave a comment

Posted by on July 28, 2012 in Uncategorized

 

Tags: , , , , ,

Finishing Touches

Step 6: You get a hand, Determining scores and judging winner

Here are the last touches that make this code into the bare-bones structure of the game. Cards are dealt out to two hands (myHand and yourHand), each card is given a suit and a value and the two hands are compared to determine a winner. (I haven’t added anything about ‘Hitting’ or ‘Holding’, and since you start with only two cards, you can’t go over 21. I’m assuming that these things are all part of the final project).

//Hand Constructor

var Hand = function(){

this.card1 = deal();

//console.log(“card1 is “+this.card1.number+” of ” + this.card1.suit);

this.card2 = deal();

//console.log(“card2 is “+this.card2.number+” of ” + this.card2.suit);

};

//Card Constructor

var Card = function(s,n){

this.number = n;

this.suit = s;

this.getSuit = function(s){

//console.log(“I’m here in getSuit”);

switch(this.suit){

case 1:

this.suit = “clubs”;

break;

case 2:

this.suit = “diamonds”;

break;

case 3:

this.suit = “hearts”;

break;

case 4:

this.suit = “spades”;

break;

}

};

this.getValue = function(n){

// console.log(“I’m here in getValue”);

if (n === 1){

this.value = 11;

}

else if (n >= 11){

this.value = 10;

}

else{

this.value = n;

}

};

};

//Deal function

var deal = function(){

var suit = Math.floor(Math.random()*4)+1;

//console.log(“deal function suit: “+suit);

var number = Math.floor(Math.random()*13)+1;

//console.log(“deal function number: “+number);

return new Card(suit,number);

};

//Score function

var score = function(one, two){

return one+two;

};

//comparison of hands

var judgement = function(mine,yours){

if (mine>yours){

console.log(“I win “+mine+ ” vs “+yours);

}

else if (yours>mine){

console.log(“You win “+mine+ ” vs “+yours);

}

else{

console.log(“We tied “+mine+ ” vs “+yours);

}

};

//Main Function

var myHand = new Hand();

myHand.card1.getSuit(myHand.card1.suit);

myHand.card1.getValue(myHand.card1.number);

console.log(“my card1 is a “+myHand.card1.suit+” of value “+myHand.card1.value);

myHand.card2.getSuit(myHand.card2.suit);

myHand.card2.getValue(myHand.card2.number);

console.log(“my card2 is a “+myHand.card2.suit+ ” of value “+myHand.card2.value);

var yourHand = new Hand();

yourHand.card1.getSuit(yourHand.card1.suit);

yourHand.card1.getValue(yourHand.card1.number);

console.log(“your card1 is a “+yourHand.card1.suit+” of value “+yourHand.card1.value);

yourHand.card2.getSuit(yourHand.card2.suit);

yourHand.card2.getValue(yourHand.card2.number);

console.log(“your card2 is a “+yourHand.card2.suit+ ” of value “+yourHand.card2.value);

var myScore = score(myHand.card1.value,myHand.card2.value);

var yourScore = score(yourHand.card1.value,yourHand.card2.value);

judgement(myScore,yourScore);

 

Tags: , , , ,

Adding the Methods

Step5: Adding methods to interpret actual suit and value of cards

 

//Hand Constructor

var Hand = function(){

    this.card1 = deal();

   

    console.log(“card1 is “+this.card1.number+” of ” + this.card1.suit);

    this.card2 = deal();

    console.log(“card2 is “+this.card2.number+” of ” + this.card2.suit);

   

};

 

//Card Constructor

var Card = function(s,n){

    this.number = n;

    this.suit = s;

 

 

            this.getSuit = function(s){

     //console.log(“I’m here in getSuit”);

     switch(this.suit){

        case 1:

            this.suit = “clubs”;

            break;

        case 2:

            this.suit = “diamonds”;

            break;

        case 3:

            this.suit = “hearts”;

            break;

        case 4:

            this.suit = “spades”;

            break;

     }

            };

 

            this.getValue = function(n){

     console.log(“I’m here in getValue”);

     if (n === 1){

         this.value = 11;

     }

    else if (n >= 11){

        this.value = 10;

    }

     else{

         this.value = n;

     }

            };

};

 

 

//Deal function

var deal = function(){

            var suit = Math.floor(Math.random()*4)+1;

            console.log(“deal function suit: “+suit);

var number = Math.floor(Math.random()*13)+1;

            console.log(“deal function number: “+number);

            return new Card(suit,number);

};

 

//Main Function

var myHand = new Hand();

myHand.card1.getSuit(myHand.card1.suit);

myHand.card1.getValue(myHand.card1.number);

console.log(“card1 is a “+myHand.card1.suit+” of value “+myHand.card1.value);

myHand.card2.getSuit(myHand.card2.suit);

myHand.card2.getValue(myHand.card2.number);

console.log(“card2 is a “+myHand.card2.suit+ ” of value “+myHand.card2.value);

 

 

In this section I added two methods (these are just functions that handle objects). Methods are placed inside of the objects they work on (is this right?Always?). In this program my methods interpret the suit and number variables as the suit that the number represents (clubs, diamonds, etc) and the value of the card (ace = 11, face cards are all worth 10 and numbered cards are worth their numerical value).

As usual, I have included a couple console.log statements so that I could track where problems cropped up along the way.

 

 

Tags: , , , , , ,