![Razz :P](./images/smilies/grayscale_grin.gif)
Welcome back!
Moderator: MaxCoderz Staff
I didn't know how many players there were, so I left it open. If there are only 8, fine, easy enough to squash into a single byte.chickendude wrote:Unless it would take more room to work with that data. I'll stick with your way for now. At least until I've finished and I get upset at how unnecessarily large my program is.
The way I've differentiated in the past is to only code the game one way, and then have two different 'turn' mechanisms. For example, in a Connect 4 game, you would go around in a loop - asking for a column number to put the piece in (let's say the function was called GetPieceColumn). That function would then split - if the currenty player was AI, it would do the AI routine then return the column. Otherwise, it would let the user choose a column manually, then return that value. That way, each player can be flagged as 'AI' or 'Human', and the game just needs to cycle through each player in a loop. You could then easily extend this to even supporting a third type, 'Link'.Also, I just realized that having an AI/computer players is essentially a necessity for this kind of program, since you're not always going to be able to have another person to play a full game with. I guess I'll have to save files, one for a oneplayer mode and one for a multiplayer mode.