Saturday, April 7, 2012

Nested ifs

Nested ifs ands or buts! Just had to say that. Ok, moving on. Nested ifs is what I am working on right now. Trying to get my mind around the logic tangle that will solve the current glitch in my game. I am trying to figure out how to determine if the two tiles that are face up are a match or not. So I am using nested for statements and nested if statements and it is all getting my little brain all confused! But I did find a website with good explanations, so I see light at the end of this teeny tunnel! Rah!

Not an exciting day, yesterday. I spent most of the day working on my project - I did do one chapter in my latest book, but I am making such good progress on the game, that I really wanted to focus on that.

As for dinner, it was eggroll day - I made shrimp eggrolls for dinner and froze 9 of them I think. Yay! And it was a decadent night - at some point late, I got some chocolate cake out of the freezer (mom had bought one earlier if you recall) and fed some to her and to me. And I added some ice cream for me. I find I only eat ice cream once every couple of weeks, if that frequently. Not abstemiousness, just no interest, usually. Though it is getting close to Watermelon Sherbert season!! Meanwhile, mom eats ice cream at least four times a week! Heck, she is 81 and can do as she pleases! Any suggestions what to do for her for her 82 birthday? Though chaperoning her on her Reunion seems like a pretty good present...

Tomorrow is my 51st birthday! Yippee.

Almost time to de-box the study again...

Yum!

4 comments:

Unknown said...

Hi Augustus,
you won't want to use nested ifs for a case like that. Each tile should defined as a class, using some sort of object-oriented language. Each tile then is an instance of that class and carries all the information about itself with it. Therefore, if you have an array of tiles, you can just do a single comparison:

if (tile[0]->name == tile[1]->name) {
print "Equal"
}
else {
print "Not Equal"
}

Augustus said...

Thank you unknown! I am sure it will come to that, but I haven't figured out objective-C well enough to do that. For now, brute force is the answer. :)

Unknown said...

The whole point of objective C is to work with oo code (object oriented code) While objective C has it's downsides, you'll HAVE to learn how to work with objects correctly before you can start to write an app.

Augustus said...

Yup, that is the point. So far, the app is coming along as nicely as I can make it. :)