ElTh0r0 / stackandconquer

A challenging tower conquest board game inspired by "Mixtour".
GNU General Public License v3.0
3 stars 3 forks source link

Expose number of pieces per player to CPU players #11

Closed maksverver closed 1 month ago

maksverver commented 1 month ago

The number of pieces per player is configurable in custom board files, but this number is not exposed to CPU players, even though it affects the possible moves.

Two ways to represent this information come to mind:

  1. Add a method like game.getPieces() that returns the total number of pieces per player. The number of pieces remaining can easily be calculated by subtracting the pieces already on the board. This is the easiest to implement.
  2. Pass an array that contains the number of pieces remaining for each player to callCPU(). This array varies during the game, as pieces are placed and removed from the board. The main advantage of this representation is that the AI player doesn't have to calculate the number of pieces remaining explicitly. (It's also slightly more flexible, in that it allows games where players have a different number of pieces to play with, though I cannot think of a reason why this would be useful.)
ElTh0r0 commented 1 month ago

Implemented variant 2), but without sending the array to callCPU. Remaining pieces can be received by calling game.getNumberOfStones()