This site requires JavaScript, please enable it in your browser!
Greenfoot back

botman's Comments

Back to botman's profile

Really nice. :) Othello was one of the first computer games I played.
Hmm, fair enough. My main motivation for using 'this' is I mostly work with PHP, which has a huge library of global functions. So I'm used to having to identify class methods when calling them. Next update, I'll work on removing 'this' from the method calls. I will keep them for variables though as I find a lot of value in being able to skim code and separate class properties from local variables. As for the class variable placement, yeah, that was something I was experimenting with. You've got the "Principle of Proximity": keep related actions together (see Code Complete, 2ed, pg 351). That works a charm within routines, but I was trying to extend it to the class level: if a class variable is only used by one or two methods, group them all together. I'm not sure it works though, so again, next update I'll try moving all the class variables to one place. Cheers.
Yeah, I just consider it good practice to be as explicit as possible. :) Hopefully it doesn't make it harder to follow though.
Thanks. :) Note that given I started writing this last night, the code structure is still evolving and there are a lot of 'magic numbers' floating around. Magic numbers are things that are hard-coded (for example, how much damage a hit does) that should be moved out to config files and constants.
Hey, thanks. :) Hmm, good advice. I copied them from Ultima 5 (released 1988), but I'll have a go at drawing my own or finding some lighter ones.