commit 90ec28647b4856a7bc62171c8aa416ce8337c4a3
parent 56e5953db975b8f3f65db3862d347fda7bac3bdf
Author: Michael Neuper <73108749+michaelneuper@users.noreply.github.com>
Date: Fri, 7 Oct 2022 21:21:59 +0200
add makeDecision method
Diffstat:
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/model/Player.java b/src/model/Player.java
@@ -1,7 +1,5 @@
package model;
-import java.io.File;
-import java.io.FileNotFoundException;
import java.util.Scanner;
/**
@@ -11,6 +9,8 @@ import java.util.Scanner;
*/
public class Player extends Person {
+ Scanner input = new Scanner(System.in);
+
/**
* Creates a new player
*/
@@ -18,8 +18,22 @@ public class Player extends Person {
super.setName("Player");
}
- public void makeDecision() {
- // TODO
+ public void makeDecision(Deck deck, Deck discard) {
+
+ int decision = 0;
+ boolean getNum = true;
+
+ while(getNum) {
+ try {
+ System.out.println("Would you like to Hit[1] or Stand[2]");
+ decision = input.nextInt();
+ getNum = false;
+
+ } catch (Exception e) {
+ System.out.println("Invalid");
+ input.next();
+ }
+ }
}
// Deck playerDeck = new Deck(); // empty deck for the player