Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(elbie): OO vs. global variables...

by elbie (Deacon)
on Sep 04, 2001 at 22:34 UTC ( #110116=note: print w/ replies, xml ) Need Help??


in reply to OO vs. global variables...

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


Comment on (elbie): OO vs. global variables...
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://110116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2015-07-06 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls