From f6c0f93c7da4f16016ba3bc54752f1d559323eb4 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Thu, 18 Feb 2021 11:36:56 -0500 Subject: [PATCH] First test --- ...ock.CIS 217 Project 1 Winter 2021(4).docx# | 1 - Project/DiceCup.java | 7 ++ Project/GameManager.java | 12 ++- Project/notes/temp-notes.java | 83 ------------------- 4 files changed, 17 insertions(+), 86 deletions(-) delete mode 100644 Project/.~lock.CIS 217 Project 1 Winter 2021(4).docx# diff --git a/Project/.~lock.CIS 217 Project 1 Winter 2021(4).docx# b/Project/.~lock.CIS 217 Project 1 Winter 2021(4).docx# deleted file mode 100644 index 2570aaf..0000000 --- a/Project/.~lock.CIS 217 Project 1 Winter 2021(4).docx# +++ /dev/null @@ -1 +0,0 @@ -,logen,logen,18.02.2021 09:04,file:///home/logen/.config/libreoffice/4; \ No newline at end of file diff --git a/Project/DiceCup.java b/Project/DiceCup.java index ec1cd66..2689067 100644 --- a/Project/DiceCup.java +++ b/Project/DiceCup.java @@ -51,6 +51,13 @@ public class DiceCup{ public void updateCredits(){ if (enoughCredits()){ creditBalance -=1; + checkTriplets(); + checkDouble(); + checkLarge(); + + } + else{ + System.out.println("You do not have enough credits! \n"); } } diff --git a/Project/GameManager.java b/Project/GameManager.java index 0abb1df..fec6b5e 100644 --- a/Project/GameManager.java +++ b/Project/GameManager.java @@ -39,9 +39,17 @@ public class GameManager{ break;} if (userInput.toLowerCase() == "roll"){ System.out.println("Credits before bet: " + - game.diceCup.getCredits() + "\n"); - System.out.println(game.toString() + "\n"); + game.diceCup.getCredits()); + // Roll Dice + game.diceCup.roll(); + game.diceCup.updateCredits(); + System.out.println(game.toString()); + + System.out.println("Total sum of Dice: " + + game.diceCup.getTotal()); + System.out.println("Credits after bet: " + + game.diceCup.getCredits()); } diff --git a/Project/notes/temp-notes.java b/Project/notes/temp-notes.java index 4789320..25605c0 100644 --- a/Project/notes/temp-notes.java +++ b/Project/notes/temp-notes.java @@ -1,95 +1,12 @@ /* Make a dice game */ /* - * played with three d6 or d8 - * bets placed on combinations that can apear on dice - * - * game begins with 10 credits - * rolls cost one credit - * - * Bets are placed on possible outcomes - * Payout increases number of credits by one if that outcome appears - * - * Large -- total value over 10 - * Three of a kind -- face value of all dice identical - * Two of a kind -- face value of two are identical - * So... I guess you need to get at least two in order to gain credits - * - * sixDie.java is premade and complete. Don't make changes. * *****************DiceCup****************************** - * create class DiceCup - * - * Create appropriate private vars for the Following - * - * an ArrayList of three MyDie objects - * credit balance int - * - * Constructors - * public DiceCup () - * instantiate and populate the arraylist - * instantiate arraylist of three SixDie or EightDie objects - * use loop to assign them to the elements of the arraylist - * Initialize credit to 10 - * - * Accessor Methods - * public int getCredits() return current credit balance - * public ArrayList getDice() - return the - * arraylist of the MyDie objects. - * - * public void roll() -- call the die object method to generate a new random - * number for each die in the arraylist - * - * public int getTotal() -- return the total addition of the values in all - * of the dice - * - * public void checkTriplets() -- Check if all three are same - * +1 credit if true - * public void checkDoubles() -- check for two of a kind - * - * public void checkLarge() -- Check if the sum of all dice is 10 or more - * +1 credit if true - * * public void updateCredits() - Calls on all bets and removes one credit * per play. Only allowed if enough credits. * - * public boolean enoughCredits() -- return true if player has enough - * credits to play this rounte;else false - * - * public void testRoll(int [] values) -- - * This method will roll the dice until the desired values entered - * as the array of 3 int values have been rolled. This makes the - * testing a lot easier because you can control what numbers are - * rolled - * If there are enough credits to play, this method has to do the - * following: - * Repeatedly roll each die in the array of dice until the desired - * value is obtained. - * - * For example, if the method is called like this: - * game.testRoll(new int [] {6,3,3}); - * - * The arrayList should have those value in each die in that order. *******************GameManager************************** * GameManager Class * The GameManager will have to control and access the container class, * DiceCup.java - * - * GameManager should have only one variable. It'll be an instance of - * DiceCup. - * Constructors - * Public GameManager ( int num ) - - * instantiate a DiceCup object - * The number determines SixDie or EightDie - * - * Accessor Methods - * public String toString() - return the representation of the Game - * public DiceCup getDice() - return the DiceCup Objects - * - * Main Method - * Create an instance of GameManager - * Take input from user to see if you want six or eight - * Take input in loop to roll or stop - * - * Provide a print statement with Credits before bet, total sum of dice - * and credits after bet */