GameManager progress
This commit is contained in:
parent
36da98836d
commit
9ed826bcb0
54
Project/GameManager.java
Normal file
54
Project/GameManager.java
Normal file
@ -0,0 +1,54 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class GameManager{
|
||||
private DiceCup diceCup;
|
||||
|
||||
public GameManager (int num){
|
||||
diceCup = new DiceCup(num);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
ArrayList<MyDie> dice = diceCup.getDice();
|
||||
return "GameManager{\n" +
|
||||
"Die 1 = " + dice.get(0).getValue() +
|
||||
"\nDie 2 = " + dice.get(1).getValue() +
|
||||
"Die 3 = " + dice.get(2).getValue() + "}\n";
|
||||
}
|
||||
|
||||
public DiceCup getDice(){
|
||||
return diceCup;
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
Scanner scnr = new Scanner(System.in);
|
||||
int diceSides;
|
||||
|
||||
System.out.println("Do you want to play with 6 or 8 dice?\n");
|
||||
diceSides = scnr.nextInt();
|
||||
GameManager game = new GameManager(diceSides);
|
||||
|
||||
String userInput;
|
||||
|
||||
while (true){
|
||||
System.out.println("Type Roll to play, Stop to end\n");
|
||||
userInput = scnr.next();
|
||||
|
||||
if (userInput.toLowerCase() == "stop"){
|
||||
break;}
|
||||
if (userInput.toLowerCase() == "roll"){
|
||||
System.out.println("Credits before bet: " +
|
||||
game.diceCup.getCredits() + "\n");
|
||||
System.out.println(game.toString() + "\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
scnr.close();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user