The Journey of a New Computer Programmer

A longtime computer-literate who wants to learn "real" programming language(s).

Saturday, May 12, 2007

Back to 'On Programming Frustration'

I really had intended to have Naval Duels finished up last night (Friday), or at least the first version of it, because there's technically a 10-days-before Senior Project deadline, as I've mentioned before.

But, despite long coding session, I just couldn't get it to work properly.

The basic structure of my program is long since done, I just need to plug in the battle calculations, that is, the things that take the amounts of inputted ships, and the ship statistics, and figure out what kills (sinks) what.

For some reason, despite a long session of coding last night, I was not getting anywhere. That's another aspect to the computer-programming frustration- not only when it's not working, but when an extended amount of attempt to try and make it work are unsuccessful.

(Note: With my current setup, Fighters are first to shoot, and their first-priority target is enemy carriers)

When taking a look at the code this morning, I noticed something:
According to my current stats, it takes 59 Fighters to kill one Carrier. (Whether this is the best idea in terms of 'flavor' is another issue for another day.)

Say I input Fighters on one side and Carriers on the other.
If there are enough Fighters to kill all enemy carriers, the code runs fine. But if there aren't enough Fighters to kill all enemy carriers, the program gets stuck in a loop.
I wonder how far this realization will get me.
I some ways, I'm glad I have a new angle of attack. In some ways, I'm ticked that I didn't think about this earlier.

0 Comments:

Post a Comment

<< Home