added all the ActionHandler states

This commit is contained in:
Johannes Schmelz 2024-06-09 14:34:52 +02:00
parent a5632304bf
commit 49d958652a
25 changed files with 34 additions and 27 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,8 +14,6 @@ class ActionHandler {
private GameState gameState; private GameState gameState;
private GamePlay gameplay;
/** /**
* Constructs an ActionHandler for the specified MauMau game. * Constructs an ActionHandler for the specified MauMau game.
* *
@ -23,8 +21,7 @@ class ActionHandler {
*/ */
ActionHandler(MauMau game) { ActionHandler(MauMau game) {
this.game = game; this.game = game;
gameState = GameState.GAME_PLAY; gameState = new Initialized();
gameplay = new Initialized();
} }
/** /**

View File

@ -1,20 +0,0 @@
package cards.maumau.model;
/**
* Represents the state of the Mau-Mau game.
*/
public enum GameState {
/**
* The game has been initialized, but has not yet started.
*/
GAME_PLAY,
/**
* The game is over. The final ranking of players can be
* obtained using {@link MauMau#getRanking()}.
*/
GAME_FINISHED,
/**
* The game has been canceled due to insufficient cards.
*/
GAME_CANCELED,
}

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.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class Canceled implements GameState{
}

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class Finished implements GameState{
}

View File

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

View File

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

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class JackChosen implements GameState{
}

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class Normal implements GameState{
}

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class SevenChosen implements GameState{
}

View File

@ -0,0 +1,5 @@
package cards.maumau.model.gamestate;
public class SuitChosen implements GameState{
}