started on ActionHandler States

This commit is contained in:
Johannes Schmelz 2024-06-08 21:51:49 +02:00
parent d58672a097
commit a5632304bf
10 changed files with 21 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,7 @@ package cards.maumau.model;
import cards.Card; import cards.Card;
import cards.Suit; import cards.Suit;
import cards.maumau.model.gamestate.*;
/** /**
* Manages the actions and state transitions within a MauMau game. * Manages the actions and state transitions within a MauMau game.
@ -11,6 +12,10 @@ class ActionHandler {
private Suit chosenSuit; private Suit chosenSuit;
private int ctr7 = 0; private int ctr7 = 0;
private GameState gameState;
private GamePlay gameplay;
/** /**
* Constructs an ActionHandler for the specified MauMau game. * Constructs an ActionHandler for the specified MauMau game.
* *
@ -18,6 +23,8 @@ class ActionHandler {
*/ */
ActionHandler(MauMau game) { ActionHandler(MauMau game) {
this.game = game; this.game = game;
gameState = GameState.GAME_PLAY;
gameplay = new Initialized();
} }
/** /**

View File

@ -7,23 +7,14 @@ public enum GameState {
/** /**
* The game has been initialized, but has not yet started. * The game has been initialized, but has not yet started.
*/ */
GAME_INITIALIZED, GAME_PLAY,
/** /**
* The game is over. The final ranking of players can be * The game is over. The final ranking of players can be
* obtained using {@link MauMau#getRanking()}. * obtained using {@link MauMau#getRanking()}.
*/ */
GAME_OVER, GAME_FINISHED,
/** /**
* The game has been canceled due to insufficient cards. * The game has been canceled due to insufficient cards.
*/ */
GAME_CANCELED, GAME_CANCELED,
/**
* The game is currently in progress with players taking turns.
*/
PLAY,
/**
* The game is in progress and the current player has played
* a Jack, and is required to choose a suit.
*/
CHOOSE_SUIT
} }

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public interface GamePlay<T> {
}

View File

@ -0,0 +1,7 @@
package cards.maumau.model.gamestate;
import cards.maumau.model.GameState;
public class Initialized implements GamePlay <GameState> {
}