Hello all. I am getting ready to write a simple online game using html & php. Since I am learning about php classes I thought it would be fun to try my hand at writing all the scripting in object oriented style. I have done as much research as I can find just about and the only thing I have not found is a good example of is how classes interact.

I am trying to determine whether I can have a php that simply initiates the game and then the rest of the logic and interaction can be controlled by various classes that interact among themselves or if I need the main php file to "act" as a moderator to control the logic.

For instance, my game will have "pegs", a "board" and a scripted "user" who responds to the real person's guesses. I am assuming that I would then create a class for each that corresponds with its real life object. Then say the computer "user" needs to place a "peg" in response to a players move. Would it be better to script that as a copy of my "user" class with a function for "placing" a copy of my "peg" class in a "hole" variable in a "board" class? Or, should the main php file simple call the "user" class to determine which "peg" should go in which "hole" and then call the "board" class and assign a "peg" to the correct "hole"?

I am still trying to understand all this so please be patient with me if none of this makes any sense at all. Let me know if I need to be more specific with something and I'll do my best. Thanks for any help or advice in advance. Also if anyone knows of any good articles online that you could point me to, I'd be most grateful.

-Adam R.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to