Thursday, April 7, 2011

Progress and Success are a Welcome Sight!

At the start of class Tuesday, we were basically done with bug #3 although there was one little detail we wanted to add.  With our modifications the code no longer allows for the idea of overspending for supplies—and stays on the current screen forcing the player to enter a supply order they could afford; however, there wasn’t any notification of the problem.  We wanted the player to be notified that they were trying to order more supplies than they had cash for—so the player could correct their error.  I had a hunch that a particular method (draw_help) in the gui portion of the code would be where the message would need to be added, but was unsure how to use the “help” message in this instance (since help is usually visible until the ‘h’ key is pressed) where it would immediately come up when the player made this mistake.  Francis changed a ‘status’ variable in a different method to account for my message in the help method and we were in business.  Now when the player attempts to do like our government and spend more than they have, their order is cleared and a message pops up telling them of this mistake—and they aren’t allowed to leave the screen until they make an order that they can afford—too bad it is not that simple for our dimwits in Washington!

The preliminary pass on bug #4 has me feeling confident that a solution is almost at hand.  This bug is more of an error in message reporting than anything else.  If the player puts in the correct “fewest coins possible” as their answer, the profits are then added to their account—a correct response to that scenario.  If the player puts in the wrong amount…ie $4.35 when they only made $4 then they are told they entered the amount in incorrectly—again a correct response to the scenario.  The problem lies in the middle scenario—the player enters the correct amount BUT uses the wrong combination of dollars and coins (ie…4 dollars, 2 dimes and 1 nickel as opposed to 4 dollars and 1 quarter) they get the same incorrect amount message.  So far I’ve found the variable that keeps up with the amount of current profit and the variable that keeps up with the breakdown of the dollars/coins the player entered.  My next step is to search the python api to see if there is something there that I can use to add these numbers up separately and compare that with the amount of profit for the day.  Then I’ll add a condition after the correct scenario that tests for this circumstance—which if true will yield a different—more descriptive message to the player; and of course the last condition will fall to the already written incorrect amount error.  Well back to the code!

No comments:

Post a Comment