feat(games): unify ApplyMove signatures + remove unused player conversion

Updated TicTacToeRules and BattleshipRules to implement ApplyMove(state, playerIdx, payload) (bool, bool, int) as required by GameRules.

Added win/draw resolution logic directly inside each game’s ApplyMove return.

Removed obsolete convertToGamePlayers helper.

Updated GenericMatch to call AssignPlayerSymbols with []*structs.Player directly.

Ensured all rule implementations now fully satisfy the GameRules interface.
This commit is contained in:
2025-12-01 17:02:57 +05:30
parent 3c81a8bf29
commit 3eadb49a72
5 changed files with 109 additions and 67 deletions

View File

@@ -12,7 +12,7 @@ type GameRules interface {
MaxPlayers() int
// Assign symbols/colors/pieces at start.
AssignPlayerSymbols(players []*Player)
AssignPlayerSymbols(players []*structs.Player)
// Apply a move.
// Returns: (changed, gameOver, winnerIndex)