Log in

No account? Create an account
color cycle (slow)

Kistaro Windrider, Reptillian Situation Assessor

Unfortunately, I Really Am That Nerdy

Previous Entry Share Next Entry
On Easy First Labs
color cycle (slow)
Dr. Kwasny, my new CS 102 teacher, assigned a lab today. It is due next week tomorrow. I have completed it exactly one hour thirty minutes after starting it.

And he said it would be hard?

  • 1
There's a catch! There's gotta be!!

Probably not. It was easy for me because of my experience with TopCoder and the fact that I used every shortcut there is. We were warned about "nasty-looking switch statements and/or extremely extended if else-if else-if else-if else-if... clauses, with special cases all over the place. I avoided the entire thing by parsing it all to integer digits and feeding it into an array lookup table... eliminating all the nasty flow-control issues.

So for a lot of the class- a class that hasn't worked a whole lot with arrays- I wouldn't expect them to have an easy time of it the way I did.

So working the same way as some switch statements, but more elegant?

I had a look at TopCoder, but I'd be diabolical. Some people, I see, try to provide a potentially valid answer without actually processing input, so they're just bound to get challenged.

It's extremely similar to a set of switch statements, but it's far easier to read, shorter to write, and infinitely more elegant. It's the difference between about 100 lines of minor variations of the same assignment over and over and three lines of array reference.

Yes, I've occasionally seen lookup tables in TopCoder. It's fun to find the error in it, put it in, and get fifty points out of it.

  • 1