public final class Main
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
private static Deck |
deck |
The game deck.
|
private static int |
numPlayers |
The number of players currently in the game.
|
private static java.util.ArrayList<Player> |
players |
Stores all of the current players in the game.
|
private static java.util.Scanner |
userInput |
Accepts user input from the console.
|
Modifier | Constructor | Description |
---|---|---|
private |
Main() |
Don't let anyone instantiate this class (prevents an object of this class from being created).
|
Modifier and Type | Method | Description |
---|---|---|
private static boolean |
anyPlayersDeckSizeIsZero(java.util.ArrayList<Player> playersAtWar) |
|
private static void |
deal() |
Creates a new deck, shuffles it, and deals out cards equally to all players.
|
private static boolean |
hasWinner() |
Determines if a player has won the game.
|
static void |
main(java.lang.String[] args) |
The main entry point.
|
private static void |
play() |
Runs the game turn by turn until a player wins.
|
private static void |
terminate() |
Removes all pointers to objects, closes resources, and terminates the program.
|
private static boolean |
war(java.util.ArrayList<Player> playersAtWar,
java.util.ArrayList<Card> currentCards) |
Plays a war between any number of players.
|
private static java.util.ArrayList<Player> players
private static Deck deck
private static int numPlayers
private static java.util.Scanner userInput
private Main()
public static void main(java.lang.String[] args)
args
- Command line arguments.private static void deal()
private static void play()
private static boolean war(java.util.ArrayList<Player> playersAtWar, java.util.ArrayList<Card> currentCards)
playersAtWar
- The list of players involved with the war.currentCards
- The current cards that were placed down in the turn.private static boolean hasWinner()
private static boolean anyPlayersDeckSizeIsZero(java.util.ArrayList<Player> playersAtWar)
playersAtWar
- The list of players currently in the war.private static void terminate()