librejack

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

commit 4546e4c6577e2aea8fd9e412da51dd792b349283
parent c9c113cbf6d62882c5696dd40a3d3e5e93155fe1
Author: Michael Neuper <73108749+michaelneuper@users.noreply.github.com>
Date:   Mon, 10 Oct 2022 08:40:23 +0200

remove redundant code
Diffstat:
Msrc/model/Deck.java | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/model/Deck.java b/src/model/Deck.java @@ -42,11 +42,11 @@ public class Deck { ArrayList<Card> shufDeck = new ArrayList<Card>(); // temporary deck for storing cards in random order - Random random = new Random(); + Random random = new Random(); // FIXME: use math method instead int randomCardIndex = 0; while (deck.size() > 0) { - // Generate random index + // generate random index randomCardIndex = random.nextInt(this.deck.size()); shufDeck.add(this.deck.get(randomCardIndex)); // add card to random index of temporary deck this.deck.remove(randomCardIndex); // remove card from original deck @@ -72,6 +72,7 @@ public class Deck { public Card takeCard() { // TODO: change take to draw Card cardToTake = new Card(deck.get(0)); deck.remove(0); + return cardToTake; }