librejack

Blackjack clone written in java
git clone https://github.com/michaelneuper/librejack.git
README | Files | Log | Refs | LICENSE

commit 48e1866c3e679343c6f9e4c43775894e122ef1ff
parent 70bc23d69d140855498ac05ec97d984194851b9d
Author: Michael Neuper <73108749+michaelneuper@users.noreply.github.com>
Date:   Mon, 17 Oct 2022 14:51:24 +0200

remove redundant method

Diffstat:
Msrc/model/Player.java | 124++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 62 insertions(+), 62 deletions(-)

diff --git a/src/model/Player.java b/src/model/Player.java @@ -48,71 +48,71 @@ public class Player extends Person { // this.balance = balance; // TODO: is neccesary? } - /** - * Allows the player to decide to hit or stand - * - * @param deck deck to draw from - * @param discard deck to discard to - */ - public void makeDecision(Deck deck, Deck discard) { - - int decision = 1; // default decision is to stand - boolean doubleDown = false; - // 0 = stand - // 1 = hit - // 2 = double - - if(doubleDown) { - // TODO: add message dialog saying they can't hit - return; // don't allow them to hit again if they double - } - - if(this.getHand().calculateValue() > 20) { - return; // return if they have blackjack or busted - } - - switch(decision) { - case 0 : // stand -// this.makeDecision(deck, discard); - return; - case 1 : // hit - this.hit(deck, discard); // hit deck and discard - break; - case 2 : // double - // TODO: double bet in gui - doubleDown = true; - this.hit(deck, discard); - break; - - } - - // 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("Error:\n" + e); -// input.next(); -// } +// /** +// * Allows the player to decide to hit or stand +// * +// * @param deck deck to draw from +// * @param discard deck to discard to +// */ +// public void makeDecision(Deck deck, Deck discard) { +// +// int decision = 1; // default decision is to stand +// boolean doubleDown = false; +// // 0 = stand +// // 1 = hit +// // 2 = double +// +// if(doubleDown) { +// // TODO: add message dialog saying they can't hit +// return; // don't allow them to hit again if they double // } - - // if they decide to hit -// if (decision == 1) { // TODO: add option to double // -// this.hit(deck, discard); // hit the deck and discard +// if(this.getHand().calculateValue() > 20) { +// return; // return if they have blackjack or busted +// } // -// if(this.getHand().calculateValue() > 20) { -// return; // return if they have blackjack or busted -// } else { -// this.makeDecision(deck, discard); // allow them to hit or stand if they don't have 21 or blackjack -// } -// } else { -// System.out.println("You stand."); // assume they stand if they hit a number other than 1 +// switch(decision) { +// case 0 : // stand +//// this.makeDecision(deck, discard); +// return; +// case 1 : // hit +// this.hit(deck, discard); // hit deck and discard +// break; +// case 2 : // double +// // TODO: double bet in gui +// doubleDown = true; +// this.hit(deck, discard); +// break; +// // } - } +// +// // 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("Error:\n" + e); +//// input.next(); +//// } +//// } +// +// // if they decide to hit +//// if (decision == 1) { // TODO: add option to double +//// +//// this.hit(deck, discard); // hit the deck and discard +//// +//// if(this.getHand().calculateValue() > 20) { +//// return; // return if they have blackjack or busted +//// } else { +//// this.makeDecision(deck, discard); // allow them to hit or stand if they don't have 21 or blackjack +//// } +//// } else { +//// System.out.println("You stand."); // assume they stand if they hit a number other than 1 +//// } +// } }