Ronit Rai | M00872394 |
---|---|
CST 3170 | Chris Huyck |
Pandemic Board Game JAVA | 04/04/23 |
The code is an extension of the starter code provided by Chris. Features that I have implemented in the game are:
All of these allow me to successfully play the game and get a win/loss result.
public static ArrayList<String[]> playerDeck = new ArrayList<String[]>();
The player deck is represented in an Array List, this makes get and set operations easier since we do not need to keep them in a fixed order.
A new file called playerDeck.txt has been created which stores all the initial values for all the Player Deck Cards. Data for the cards has been represented as such:
City Name; **Color ID**
-----
Milan;**1**
St. Petersburg;**1**
Los Angeles;**2**
Mexico City;**2**
Lima;**2**
The “readPlayerDeck” function reads the data from the playerDeck file, stores it in the playerDeck Array List and shuffles it before any use.
After the initial shuffle, 4 cards are distributed to each player since it is a 2 player game.
public static ArrayList<String[]> playerHands = new ArrayList<String[]>();
//1. [0, 1 ,1]
Player Hands represents all the cards each player has.