Commit Graph

19 Commits

Author SHA1 Message Date
Dave Burke
cdf194f770 Remove redundant Card record code
Java Records automatically acquire an implementation of equals and
hashCode that accounts for their components. They also have read
accessors for their components (card.suit() to get the suit).
2022-03-18 17:01:06 -05:00
Mitch Peck
0b1f809707 Clean up comments and convert Card to a record 2022-03-18 12:52:14 -05:00
Mitch Peck
14123c9a4f shouldPlayDealer & playDealer implementations, formatting to mimic original code 2022-03-11 21:12:59 -06:00
Mitch Peck
34574d60cb Handle dealer's total in evaluateRound 2022-03-09 20:43:56 -06:00
Mitch Peck
5bfb8a4088 Implement evaluateRound with tests 2022-03-09 20:25:10 -06:00
Dave Burke
926612b736 Test insurance collection 2022-03-05 09:28:27 -06:00
Dave Burke
375f16c4a8 Print total after STAY 2022-03-03 22:10:54 -06:00
Dave Burke
f7a257e6ae Refactor scoreHand and compareHands into ScoringUtils 2022-03-03 21:55:30 -06:00
Dave Burke
1f24d98a72 Make play() tests more readable 2022-03-03 21:49:47 -06:00
Dave Burke
a8d2e12597 Add a couple TODOs 2022-03-02 22:20:41 -06:00
Dave Burke
5e950275fa Refactor Game.play() to handle split hands more elegantly 2022-03-02 22:15:44 -06:00
Dave Burke
5aee1ecd09 Initial playSplitHand implementation 2022-02-22 13:03:35 -06:00
Mitch Peck
1592263258 Update player with split fields, stub out playSplit, and playSplit tests 2022-02-19 18:06:20 -06:00
Mitch Peck
5f28cd03fe Implement compareHands method, add compareHands tests and fix UserIO Test 2022-02-18 19:35:54 -06:00
Dave Burke
2b2f9327f7 Implement play() and scoreHand() 2022-02-09 21:19:04 -06:00
Dave Burke
0760f22494 Add example i/o test 2022-02-07 21:59:02 -06:00
Dave Burke
0b1f57ae4f Refactor to allow testing side effects
By externalizing the source of i/o and randomness for shuffling, we can
inject non-interactive and deterministic behavior during unit tests.
2022-02-07 21:59:02 -06:00
Dave Burke
15c26cbe09 Limit number of decks to 1
The subroutine to get a card shuffles 52 cards when the deck is run
through:

100 REM--SUBROUTINE TO GET A CARD.  RESULT IS PUT IN X.
110 IF C<51 THEN 230
120 PRINT "RESHUFFLING"
130 FOR D=D TO 1 STEP -1
140 C=C-1
150 C(C)=D(D)
160 NEXT D
170 FOR C1=52 TO C STEP -1
180 C2=INT(RND(1)*(C1-C+1))+C
190 C3=C(C2)
200 C(C2)=C(C1)
210 C(C1)=C3
220 NEXT C1
230 X=C(C)
240 C=C+1
250 RETURN
2022-02-03 08:31:04 -06:00
Dave Burke
914f123bfc Implement unit tests for Blackjack Java 2022-02-02 21:36:16 -06:00