2009-01-17, 02:48 PM
Kiley Wrote:Spoiler
Yeah, I'm saving the harder stuff for later and just going to follow the class now. The class learns Karel first, then eventually transitions to Java (I haven't gotten there yet). I'm still trying to figure out how to make 3 work x___X
Red: The while loops in the run() and fixWall() methods are redundant. You should change one of them to an if statement instead so the computer doesn't end up checking the while loop condition twice. In this case, I would change the one in run() to an if statement.
Purple: fixWall() has a pretty bad issue. Let's say you are fixing the column and you are checking if there's a beeper there. There isn't one. Then in your else statement, you put a beeper there. Then you run the while loop again, and you find out there is a beeper there. That's because you didn't move. If a column was entirely devoid of beepers, then the run time on the fixWall() method would be roughly twice as long. You don't want that. A simple solution is to include a move() method in the else statement too, so instead of just putting a beeper there, you also move after you put a beeper.
Also, with the nextColumn() and turnLeft() thing, I'm questioning the convention on that, but I think it might be passable.

