public class RoundUpdateEvent extends GameEvent implements java.io.Serializable
An event to report changes to the current status of a game. This event should trigger playing, either in bots (automated players) or in human players, if the game was not yet terminated.
This event report the nick of player with the turn to play
(getNickWithTurn()
). If the game
doesn't have turns this value is null
and the players play
(almost) simultaneously; i.e. upon receiving the event. In turn-based games
(most games are) only the player with the turn should play upon receiving
this event.
Using the getCardsOnTable()
method the player has access to
the cards on the table. It is map keyed by player's nicks, hence it is
possible to know who played which card. Have in mind that this map will
be empty for the first player in the round and only the last player in the
turn has information on cards played by all the others.
This event also includes a mode that can be retrieved with
getMode()
. Certain games may have different modes
(e.g. in WAR there is a special mode (war) when the two players played
a card with the same value.
jpleal@fc.up.pt
Constructor and Description |
---|
RoundUpdateEvent() |
RoundUpdateEvent(java.lang.String gameId,
java.util.Map<java.lang.String,java.util.List<Card>> onTable,
java.lang.String hasTurn,
int roundsCompleted,
java.lang.String mode)
Instantiate an event with given data.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.util.List<Card>> |
getCardsOnTable()
Cards on table in this turn for each player.
|
java.lang.String |
getMode()
Current mode
|
java.lang.String |
getNickWithTurn()
Nick of player with turn.
|
int |
getRoundsCompleted()
Number of rounds completed in this game.
|
public RoundUpdateEvent()
public RoundUpdateEvent(java.lang.String gameId, java.util.Map<java.lang.String,java.util.List<Card>> onTable, java.lang.String hasTurn, int roundsCompleted, java.lang.String mode)
gameId
- of game instanceonTable
- cards played so far in this round by each player.hasTurn
- nick of player who has the turn (or null
.)roundsCompleted
- in this game instance.mode
- of this game (game dependent)public java.util.Map<java.lang.String,java.util.List<Card>> getCardsOnTable()
public java.lang.String getNickWithTurn()
public int getRoundsCompleted()
public java.lang.String getMode()