initial commit
This commit is contained in:
106
src/cards/maumau/model/PlayerHandler.java
Normal file
106
src/cards/maumau/model/PlayerHandler.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package cards.maumau.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles players in a MauMau game.
|
||||
*/
|
||||
class PlayerHandler {
|
||||
private final MauMau game;
|
||||
private final List<Player> players = new LinkedList<>();
|
||||
private final List<Player> ranking = new ArrayList<>();
|
||||
private Player remember;
|
||||
|
||||
/**
|
||||
* Constructs a PlayerHandler for the specified MauMau game.
|
||||
*
|
||||
* @param game The MauMau game instance.
|
||||
*/
|
||||
PlayerHandler(MauMau game) {
|
||||
this.game = game;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the next turn in the game.
|
||||
*
|
||||
* @param n The number of turns to proceed.
|
||||
*/
|
||||
void nextTurn(int n) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a player calling "Mau".
|
||||
*
|
||||
* @param p The player calling "Mau".
|
||||
*/
|
||||
void mau(Player p) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a player calling "Mau-Mau".
|
||||
*
|
||||
* @param p The player calling "Mau-Mau".
|
||||
*/
|
||||
void maumau(Player p) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of players participating in the game.
|
||||
*
|
||||
* @return The list of players.
|
||||
*/
|
||||
List<Player> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ranking of players based on the order they finished the game.
|
||||
*
|
||||
* @return The ranking of players.
|
||||
*/
|
||||
List<Player> getRanking() {
|
||||
return ranking;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a player to the game.
|
||||
*
|
||||
* @param player The player to add.
|
||||
* @throws IllegalArgumentException if a player with the same name already exists.
|
||||
*/
|
||||
void addPlayer(Player player) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves to the next player's turn in the game.
|
||||
*
|
||||
* @param n The number of turns to proceed.
|
||||
*/
|
||||
private void localNextTurn(int n) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes a player's participation in the game.
|
||||
*
|
||||
* @param p The player to finish.
|
||||
*/
|
||||
private void finishPlayer(Player p) {
|
||||
//TODO implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current player whose turn it is.
|
||||
*
|
||||
* @return The current player.
|
||||
*/
|
||||
Player getCurrentPlayer() {
|
||||
return players.isEmpty() ? null : players.getFirst();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user