Keep It Simple, Stupid | |
PerlMonks |
(elbie): OO vs. global variables...by elbie (Curate) |
on Sep 04, 2001 at 22:34 UTC ( [id://110116]=note: print w/replies, xml ) | Need Help?? |
Masem makes an excellent point. If you are going to have a lot of board related functions, it makes a lot of sense to have those functions be methods of a board object. Your AI particularly should be able to make a move based on the board's layout. So you can just give the AI routines the current board object. Any information the AI needs can be retrieved using $board->is_free( x, y ) or whatever methods you'd need. elbieelbieelbie
In Section
Seekers of Perl Wisdom
|
|