public class GameLoop
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int |
current |
private boolean |
done |
private KripkeModel |
model |
private int |
numPlayers |
private java.io.PrintStream |
out |
private Player[] |
players |
private int |
round |
private java.util.Set<java.lang.Integer> |
skip |
| Constructor and Description |
|---|
GameLoop()
Create a new loop using a random dealing of cards.
|
GameLoop(Dealing deal,
int players)
Create a new loop using the given dealing of cards, number of players
|
GameLoop(Dealing deal,
int players,
java.io.PrintStream out)
Create a new loop using the given dealing of cards, number of players
and PrintStream
|
GameLoop(Dealing deal,
java.io.PrintStream out,
Player... players)
Create a new loop for the given dealing, players and PrintStream
|
GameLoop(KripkeModel model,
Player... players)
Create a new loop using the given model
|
GameLoop(KripkeModel model,
java.io.PrintStream out)
Create a new loop for the given model and PrintStream
|
GameLoop(KripkeModel model,
java.io.PrintStream out,
Player... players)
Create a new loop using the given model and PrintStream.
|
GameLoop(java.io.PrintStream out)
Create a new loop using a random dealing of cards and PrintStream
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkAccusation(CardSet accusation)
Check if a accusation is correct, and if so, end the game
|
private void |
checkSuspicion(CardSet suspicion)
Given an suspicion, check the other players and see if they have one of
the cards in the suspicion.
|
void |
game()
Play the game until someone wins
|
Dealing |
getDealing()
Get the dealing in state 0 for this GameLoop
|
Player[] |
getEliminatedPlayers() |
Player[] |
getPlayers()
Get the players in this game
|
int |
getRound()
Get the number of the current round
|
private static Player[] |
initPlayers(Dealing deal,
int players,
KripkeModel model)
Given a dealing and number of players, adds `players` number of players
into the game and deals them their cards
|
boolean |
isDone()
Check if the current game is finished
|
static void |
main(java.lang.String[] args)
Play one random game of Cluedo with `System.out` as output
|
void |
round()
End this round of the game
|
java.util.Set<java.lang.Integer> |
set(int... agents)
Create a set of agents
|
void |
step()
Play one turn of the game for the current player
|
private KripkeModel model
private int numPlayers
private int current
private int round
private java.io.PrintStream out
private Player[] players
private boolean done
private java.util.Set<java.lang.Integer> skip
public GameLoop(KripkeModel model, java.io.PrintStream out, Player... players)
model - The model that the players of this game will useout - PrintStream that this object uses to print towards.players - The players that are going to play this gamepublic GameLoop(KripkeModel model, Player... players)
model - The model that the players of this game will useplayers - The players that will play this gamepublic GameLoop(KripkeModel model, java.io.PrintStream out)
model - The model that the players of this game will useout - PrintStream this object uses for printingpublic GameLoop(Dealing deal, java.io.PrintStream out, Player... players)
deal - The dealing of cards for this gameout - PrintStream this object uses for printingplayers - The players that will play this gamepublic GameLoop(Dealing deal, int players, java.io.PrintStream out)
deal - The dealing of the cardsplayers - the number of players in this game.out - PrintStream this object uses for printingpublic GameLoop(Dealing deal, int players)
deal - The dealing of the cardsplayers - the number of players in this game.public GameLoop(java.io.PrintStream out)
out - The PrintStream used for printingpublic GameLoop()
private static Player[] initPlayers(Dealing deal, int players, KripkeModel model)
deal - The deal for this gameplayers - The number of players in this gamemodel - The model that these agents will use to reason about the worldpublic Dealing getDealing()
public Player[] getPlayers()
public java.util.Set<java.lang.Integer> set(int... agents)
agents - The agents that should be in the setprivate void checkSuspicion(CardSet suspicion)
suspicion - The suspicion to checkprivate void checkAccusation(CardSet accusation)
accusation - The accusation to checkpublic void step()
public void round()
public void game()
public boolean isDone()
public Player[] getEliminatedPlayers()
public int getRound()
public static void main(java.lang.String[] args)
args - unused