school/Project/GameManager.java
2021-02-18 11:26:36 -05:00

55 lines
1.1 KiB
Java

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();
}
}