Wednesday, March 13, 2013

Tank Making and If Else Statements

I'm a noob Rubyist so take any of my rules and advice with that in mind. However with that said, last Sunday +David Bock showed +Jason Wieringa and myself how to use a 'Return' and a hash {} to take 52 lines of 'If Else' statements down to about 2 lines of code.

I was blown away because that's exactly what I do when I don't know what to do, I write lots of 'If Else' statements. I was so glad to learn when in doubt try using 'Return' and a hash {}.

I'm sure there are many more ways to code and not use 'If Else' statements, but for me this is now stuck in my brain as a way to try and get around long lines of repetitive code.

I spent 3 hours today working on 'RTanque' trying to figure out how to make the tanks work and do what I want. It's been harder than I thought it would be, but very fun all the same. Two things I learned about myself while working on making little tank bots today: (1) I need to really understand classes better and how to easily use them without guessing. (2) I am SOOO gonna' lose Sunday at our 'Tank Battle' if I don't do something drastic.

Desperate times call for desperate measures, so I tweeted a really good Rubyist on Twitter who shall be nameless for help, and called an emergency 'RTanque' war room meeting for Thursday with +Cody Kemp+Jason Wieringa ,  +Colin MacDonald, and Matthew Gallagher. I will be working all day on horses Thursday then from 7pm-1am, it's study/battle time!

I would love to see a beginner's guide to 'RTanque', or maybe I'll end up doing one as I get better. I need to work on the pet rescue website tonight, and maybe some homework. Although homework may have to wait to Friday or Saturday we''ll see. This week is going well, 10 hours of study so far and  more tonight. - Josh

Matthew Gallagher