-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,87 @@ | ||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.NoSuchElementException; | ||
import java.util.Scanner; | ||
|
||
public class Game { | ||
|
||
public String name; | ||
public static int minBet, maxBet; | ||
public static int transactionNumber; | ||
public static int houseMoney; | ||
public String name; | ||
|
||
public static int minBet, maxBet; | ||
|
||
public static ArrayList<Player> playersInGame = new ArrayList<Player>(); | ||
public static int transactionNumber; | ||
|
||
public static ArrayList<Transaction> transactionLines = new ArrayList<Transaction>(); | ||
public static int houseMoney; | ||
|
||
public Game( String name, int minBet, int maxBet) { | ||
public ArrayList<Player> playersInGame = new ArrayList<Player>(); | ||
|
||
this.name = "100A" + name; | ||
this.minBet = minBet; | ||
this.maxBet = maxBet; | ||
public ArrayList<Transaction> transactionLines = new ArrayList<Transaction>(); | ||
|
||
transactionNumber = 0; | ||
public Game(String name, int minBet, int maxBet) { | ||
|
||
} | ||
this.name = "100A" + name; | ||
|
||
this.minBet = minBet; | ||
|
||
public static void addPlayerFromQueue() { | ||
//take player out of queue and put into playersInGame | ||
this.maxBet = maxBet; | ||
|
||
if(Mainpp.waitingPlayers.peek() == null) { | ||
System.out.println("No waiting players to pull from Queue"); | ||
} | ||
else { | ||
playersInGame.add(Mainpp.waitingPlayers.poll()); // adding to arrayList playersInGame from Queue waitingPlayers | ||
} | ||
transactionNumber = 0; | ||
|
||
} | ||
} | ||
|
||
public static boolean hasSpace() { | ||
public void addPlayerFromQueue() { | ||
|
||
|
||
if(playersInGame.size() < 5) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
public void addPlayer(Player p) { | ||
playersInGame.add(p); | ||
} | ||
// take player out of queue and put into playersInGame | ||
|
||
public static void printPlayers() { | ||
for (int i = 0; i < playersInGame.size(); i++) { | ||
System.out.println("Player " + playersInGame.get(i).name + " \t Money: $" + playersInGame.get(i).money); | ||
} | ||
if (Implementation.waitingPlayers.peek() == null) { | ||
|
||
} | ||
System.out.println("No waiting players to pull from Queue"); | ||
|
||
} | ||
|
||
|
||
else { | ||
|
||
playersInGame.add(Implementation.waitingPlayers.poll()); // adding to arrayList playersInGame from Queue | ||
// waitingPlayers | ||
|
||
} | ||
|
||
} | ||
|
||
public boolean hasSpace() { | ||
|
||
if (playersInGame.size() < 5) { | ||
|
||
return true; | ||
|
||
} | ||
|
||
else { | ||
|
||
return false; | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public void printPlayers() { | ||
|
||
for (int i = 0; i < playersInGame.size(); i++) { | ||
|
||
System.out.println("Player " + playersInGame.get(i).name + " \t Money: $" + playersInGame.get(i).money); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
public boolean playAgain(Scanner scan) { | ||
String answer; | ||
System.out.print("Play again [y/n]? "); | ||
answer=scan.next(); | ||
return answer.equalsIgnoreCase("y"); | ||
} | ||
|
||
} |