I have a class Game
.
This class needs to take three arguments passed in it's constructor:
- List of game pieces
- Board Size
- Game piece placement 'engine'
I am dithering about the design of the game piece placement 'engine'. This object needs the list of game pieces and the board size to determine where the pieces are to be placed.
The options I can see are:
- The placement engine takes the list of pieces and the board size in its constructor and it has a Generate method that passes back the list of pieces and their placement
- Similar to 1 but the list of pieces and board size are set as properties after instantiation and then there is the Generate method as above.
- The placement engine either takes the board size as a constructor argument or set as a property and then there is a Generate method that takes a piece as a parameter and then passes back the placement for that piece.
I am beginning to swing towards the 3rd option as this then allows the game to handle things, otherwise the game could have a list of pieces and a board size that is different from the placement 'engine'. Generating the starting location for a piece at a time also seems more 'correct'.
How would you do it?