Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need!! #3

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
37cbfbb
Added Untitled Diagram.xml
ElBell Feb 22, 2019
ac91aae
Update Untitled Diagram.xml
ElBell Feb 22, 2019
1594551
Added the basics for everyone to build from
Feb 22, 2019
5ca1132
Started on the Casino and Greeter
Feb 22, 2019
d816806
Added tests for Console
Feb 22, 2019
02037a9
Made a default console
Feb 22, 2019
184a66f
Merge branch 'working' of https://github.com/ElBell/Maven.Casino into…
MDMoll Feb 22, 2019
164c5b1
Merge branch 'working' of https://github.com/ElBell/Maven.Casino into…
Feb 22, 2019
c7c2e2d
Merge branch 'working' of https://github.com/ElBell/Maven.Casino into…
ashblox Feb 22, 2019
f53a8c4
to String() added for Card
Feb 22, 2019
45cd0e9
card tests
Feb 23, 2019
949cbfa
added enum changes for rank.
Feb 23, 2019
b48ce73
Added the first draft at GoFish
Feb 23, 2019
5885e16
fixed null pointer exception
Feb 23, 2019
6cfc94e
merged in Elenor's changes
Feb 23, 2019
efe6cc7
Merge https://github.com/clm5506/Maven.Casino
jlysglo Feb 23, 2019
b07f212
black jack change to display user cards on first deal
Feb 23, 2019
390e52e
Merge pull request #1 from clm5506/blackJack
ElBell Feb 23, 2019
3dca74d
Non-working Craps skeleton
MDMoll Feb 23, 2019
9a387f0
worked on macao
ashblox Feb 23, 2019
25570ff
Merge branch 'master' of https://github.com/ElBell/Maven.Casino into …
ashblox Feb 23, 2019
fdabaf8
Basic tests, more needed
MDMoll Feb 23, 2019
37644ec
Merge https://github.com/ElBell/Maven.Casino into LBlackJackCode
jlysglo Feb 23, 2019
c7c8dd8
moved BlackJack
MDMoll Feb 23, 2019
a3fa30b
Moved CardTest.java
MDMoll Feb 23, 2019
7d5fde5
Updated pom.xml to with explicit mention of Maven 1.8 and other Craps…
MDMoll Feb 23, 2019
c6bc1d0
Updated Craps and whatnot
MDMoll Feb 23, 2019
fc19fd0
finished macao
ashblox Feb 23, 2019
0d73bf5
Made GoFish play down with books (4 cards), another turn when you gue…
Feb 23, 2019
c3a92b0
Fixed merge conflict
Feb 23, 2019
055f56d
minor changes
ashblox Feb 23, 2019
4273bed
Made more tests for Casino
Feb 23, 2019
d62d1d7
Merge pull request #2 from ashblox/macao
ElBell Feb 23, 2019
f9805f3
created getters & setters
ashblox Feb 23, 2019
cccc65c
BlackJack evolved
jlysglo Feb 23, 2019
1611519
Merge pull request #3 from lthomas4912/BlackJackCode
ElBell Feb 23, 2019
e18828b
committing for merge
Feb 23, 2019
6944996
merged in Leah's changed
Feb 23, 2019
70820a1
Got to 100% test coverage on GoFish player
Feb 23, 2019
0071ada
Wrote some tests
Feb 23, 2019
6560165
Pulled down BlackJack and Macao
Feb 23, 2019
af5d7fb
Merge branch 'working'
Feb 23, 2019
a4aadee
Got GoFish working again
Feb 23, 2019
ee937d1
added additional black methods for dealerturn checkIfhandis21
Feb 23, 2019
edb28cd
double down features added
Feb 24, 2019
384759c
commit to pull
jlysglo Feb 24, 2019
cdee1db
mered with cris
jlysglo Feb 24, 2019
4013ca1
We Good
jlysglo Feb 24, 2019
b7e532e
Basic Dice class with roll method
MDMoll Feb 24, 2019
77bf8d1
Mostly working Craps simulation
MDMoll Feb 24, 2019
889a79d
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 24, 2019
8481edb
working on tests
ashblox Feb 24, 2019
4c1c90b
Merge branch 'master' of https://github.com/ElBell/Maven.Casino into …
ashblox Feb 24, 2019
5d75e81
commit to pull
Feb 24, 2019
b539dfa
fixed merge conflict
Feb 24, 2019
1a2a14a
finished macao tests
ashblox Feb 24, 2019
df66e99
Added cute cards and titles
Feb 24, 2019
6452775
added logic to handle user error
Feb 24, 2019
a80825f
more testing
ashblox Feb 24, 2019
8fcfcaa
Added faces for dice
Feb 24, 2019
267c131
refactored redundant code
Feb 24, 2019
306fdef
resolved merge conflicts
ashblox Feb 24, 2019
856023a
We Better
jlysglo Feb 25, 2019
8796cee
We mo betta
jlysglo Feb 25, 2019
0830467
Added more tests to GoFish
Feb 25, 2019
2b457bf
Merge pull request #4 from ashblox/macao
ElBell Feb 25, 2019
98931aa
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
Feb 25, 2019
2d1f859
Merge branch 'working'
Feb 25, 2019
2f11b29
Merged and fixed some tests inGoFish and Macao
Feb 25, 2019
f6a44f0
finished testing
ashblox Feb 25, 2019
96e0f98
Added a card back
Feb 25, 2019
4fc4ae8
Aces Yo
jlysglo Feb 25, 2019
9d0a80b
Added Test
jlysglo Feb 25, 2019
3ad333e
finished game
ashblox Feb 25, 2019
c81d84b
resolved conflicts
ashblox Feb 25, 2019
aeae0cc
Added card backs and more tests
Feb 25, 2019
bf3c504
added additional tests
Feb 25, 2019
a193d6f
Merge branch 'master' into macao
ElBell Feb 25, 2019
175438e
minor changes to game and rank and greeter classes
Feb 25, 2019
622b55d
added tests
Feb 25, 2019
67535e4
Merge pull request #5 from ashblox/macao
ElBell Feb 25, 2019
793de07
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
Feb 25, 2019
8ddd376
Fixed some merge issues. Passing all tests. Macao officially in and c…
Feb 25, 2019
fe92065
Created GameEnum to call new games based user input
Feb 25, 2019
302f91b
48percent bish
jlysglo Feb 25, 2019
0091164
Turned massive switch case into a HashMap<String, enum Rank>
Feb 25, 2019
e67b4d5
We got cards
jlysglo Feb 25, 2019
0eda46e
Merge https://github.com/ElBell/Maven.Casino into BlackJackCode
jlysglo Feb 25, 2019
5a6b4d3
Merge pull request #6 from lthomas4912/BlackJackCode
ElBell Feb 25, 2019
788736a
last commit
ashblox Feb 26, 2019
3087ac9
resolved conflicts
ashblox Feb 26, 2019
b35c4ae
Made game an interface and made play() return void
Feb 26, 2019
165236c
added more unit tests and refactored code
Feb 26, 2019
518ac68
merged in changes to push
Feb 26, 2019
69755ce
updates
MDMoll Feb 26, 2019
615d388
Changed Play() to void everywhere
Feb 26, 2019
9e2f25e
Merge pull request #7 from clm5506/blackJack
ElBell Feb 26, 2019
c960f2e
Fixed some tests, moved games to the proper folder, and renamed to Ca…
Feb 26, 2019
5f4d310
Added some test for card back and changed standardInput to use input …
Feb 26, 2019
cb2a47d
Merge branch 'master' of https://github.com/ElBell/Maven.Casino into …
ashblox Feb 26, 2019
92ef032
Craps nearly fully functional
MDMoll Feb 26, 2019
3f7f7ea
Beginning to integrate with casino skeleton
MDMoll Feb 26, 2019
ee605e5
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 26, 2019
20e9fe4
Updated with changes in main
MDMoll Feb 26, 2019
45cdb3f
Merge pull request #8 from MDMoll/master
ElBell Feb 26, 2019
0486a7a
Little gofish change
Feb 26, 2019
57323fd
Merged in the Craps game
Feb 26, 2019
724fa64
Get user balance correctly linked
MDMoll Feb 26, 2019
b4d0f1e
User balance should be correctly linked now across profiles
MDMoll Feb 26, 2019
3166b1d
Quitting and Continuing menu options work properly now
MDMoll Feb 26, 2019
7bf7c0d
Merge pull request #9 from MDMoll/master
ElBell Feb 26, 2019
9fa7446
Merge branch 'working' of https://github.com/ElBell/Maven.Casino
ashblox Feb 26, 2019
e3703a4
Replaced system.out.printlns with calls to the console
MDMoll Feb 26, 2019
45c8713
started craps testing
ashblox Feb 26, 2019
8dc51a2
Merge pull request #10 from MDMoll/master
MDMoll Feb 26, 2019
818cc9f
Merge pull request #11 from ashblox/master
MDMoll Feb 26, 2019
c2795f2
fixed test class
ashblox Feb 26, 2019
c4ae54a
Merge pull request #12 from ashblox/master
MDMoll Feb 26, 2019
c12ef02
more tests and some minor mods
Feb 26, 2019
c243396
added test for hit
Feb 26, 2019
8a1f444
Improved loop behavior for easier future testability
MDMoll Feb 26, 2019
4093e47
Merge pull request #13 from clm5506/blackJack
ElBell Feb 26, 2019
8534e9c
Merge pull request #14 from MDMoll/master
ElBell Feb 26, 2019
92d4227
test work
ashblox Feb 26, 2019
24a0a90
Balance working
MDMoll Feb 26, 2019
efa4959
Merge pull request #16 from MDMoll/master
ElBell Feb 26, 2019
1ac222d
resolved conflicts
ashblox Feb 26, 2019
1398dbd
added more tests
Feb 26, 2019
65b2ff1
committing some test stuff
ashblox Feb 26, 2019
0340987
Added colors
Feb 26, 2019
12cc2eb
fixed the colors
Feb 26, 2019
815b1a0
Merge pull request #17 from clm5506/blackJack
MDMoll Feb 26, 2019
9e1eb99
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 27, 2019
4ca08fe
Merge branch 'working' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 27, 2019
0e56261
Merge pull request #18 from ashblox/master
MDMoll Feb 27, 2019
dc48a94
updated with tests
MDMoll Feb 27, 2019
fb3dc09
finished tests/incorporated die
ashblox Feb 27, 2019
e1a35e9
minor changes
ashblox Feb 27, 2019
820dd3f
Merge pull request #20 from ashblox/master
ElBell Feb 27, 2019
36c03dc
Last changes
Feb 27, 2019
8d229d4
final draft:
ashblox Feb 27, 2019
acdb95d
Merge pull request #21 from ashblox/master
ElBell Feb 27, 2019
f194ac5
Merged in blackjack
Feb 27, 2019
6b4aa19
merged in craps
Feb 27, 2019
165c03f
Fixed a bunch of tests
Feb 27, 2019
041fa7b
Removed unnessecary imports and make everything that could be private…
Feb 27, 2019
f504995
Got profile to be added correctly to all the players
Feb 27, 2019
d0bf86c
pulled from Master
MDMoll Feb 27, 2019
3a95375
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 27, 2019
c3c4374
We really only need one loaded die
Feb 27, 2019
ef97c6e
changed project structure
Feb 27, 2019
2c63baf
Craps refactored to work with game status
MDMoll Feb 27, 2019
fd465e8
Streamlined program and updated tests
MDMoll Feb 28, 2019
70b2086
Merge branch 'master' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 28, 2019
fe33815
Merge pull request #1 from MDMoll/CrapsRefactor
MDMoll Feb 28, 2019
749ca46
Merge branch 'master' of https://github.com/MDMoll/Maven.Casino
MDMoll Feb 28, 2019
959870c
Merge branch 'working' of https://github.com/ElBell/Maven.Casino
MDMoll Feb 28, 2019
26c7efc
Craps and CrapsPlayer updated with new logic
MDMoll Feb 28, 2019
5bd0d50
Merge pull request #22 from MDMoll/master
ElBell Feb 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions Untitled Diagram.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile modified="2019-02-22T14:21:25.897Z" host="www.draw.io" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36" etag="aCPnVJQ17QeoS45Tly8A" version="10.2.6" type="github"><diagram name="Page-1" id="c4acf3e9-155e-7222-9cf6-157b1a14988f">7Zpdc5s4FIZ/jWe2F97hw2D7svbWrjtp0zrd7uxVRoYDqBaIChHb/fUrgcBgSLfdSQp07ZnE4tVBOjo6PAiZkbkMj2uG4uAtdYGMDM09jsw/Roah68ZcfEnllCv2zM4Fn2FXGZ2FO/wVlKgpNcUuJDVDTinhOK6LDo0icHhNQ4zRQ93Mo6Tea4x8aAh3DiJN9S/s8iBXZ5Z21l8D9oOiZ11TNTvk7H1G00j1NzJML/vk1SEq2lL2SYBceqhI5quRuWSU8rwUHpdAZGyLsOXnrR6pLf1mEPHvOmGKnB2yppMZWObc3o1VCw+IpCoWHkMhKG/5qYiQcDyWxTQkq8zAXBwCzOEuRo7UDyIxhBbwkIgjXRSzqIDsVxNH5cDlgUND7KgyQTsgizKMS0ooE1URjWQfCWd0D4Uooqtln7KmmC3ZoYcJqViqeRA6jfgKhZjI5PwEzEURUrLKRF1Tx20dIYL9SGiOCDGIykUz5kUQgXE4ViQ1B2ugIXB2EiaqdqLSQV0uRXYczrmna6YSg2riabZSkcp4v2z7POuioCa+PQks19Dn1s6daS7ydF0fF5dhJQtGhk1Ep4u4lgb2l1Rm6iJEzMciKC9FrRYfxf8sLlqujzmN87pJpU6Eho9VMGWdimfZpij56jvrGVcEFMrkIs2jjWzDkylYyPVTai2KuODLXnasoRTCGoU7giN/nV0PZRO7yxOEFl9qAZNxKzhXDFF/fLT/Kc4EPF4JdLNtaYtFlgpQAX98yD0fgYOSYBP99uJfPH5eB25T/g0PLmgpSYDF7eWlYkd2QZQkyftcUGHlkQyKEl0XSDIuyfUayAPIVnuK2afA4qzOxYk1b4LRaOOi8SxYtHqIxRI/S5TgiA4YTO8ZFbkEMmmKUhNQ0nAnloKAIlFKE2Cb5AbQg+CyXOghksBAhptwxLi4Dp39Z/FXY8nlgDPTNV3hJOiQepkXS7GuS7p24i1yEO3Iie+7Z175/xT8N7Xp71btDjCbtSyNZ1bLHeApFsabyVfKPjo2uv+gzxzvJtnO/255QurRTaDkyXDvA0PwUfOBf6QckSuEfnkIGdP6ItSetiCo/eHceiYEmX1GUL5OGS5/xHTtV5QtEXO7fMQMwOmBGz5+gI5diLGzfyeSsUM3rrj9ebgtt9L7g9tJn3GbPZANmLb5duQKs4RvqZyLQXgdMxrG/B0cFvCtbcArlH4NKE2s3kGp13uR2QbN4KHkpGFKEBdLoAGR6fpk+r+hkm13SaXPN5/uxtPE+/N2k26Ztd2+ub/v9+bY5nZJo4SSof56O8Cfa3/E5SuQegCkBn1aGPUokKZGfbd+bjaBNG/hUbGp/+Q4MvqMozUDyC2HCCNpWwGqfBXvAq199tyXsX9P0AlYl7trwOXOlnyhqEsvKHUXp648uPL55/HZmhh1Pre9aGhO2haMP05ocXh+jzWrq7wsbL76Bw==</diagram></mxfile>
21 changes: 21 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>

<groupId>io.zipcoder</groupId>
Expand All @@ -15,5 +28,13 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>

Binary file added src/.DS_Store
Binary file not shown.
8 changes: 0 additions & 8 deletions src/main/java/io/zipcoder/casino/Casino.java

This file was deleted.

75 changes: 75 additions & 0 deletions src/main/java/io/zipcoder/casino/casino/Casino.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package io.zipcoder.casino.casino;


import io.zipcoder.casino.casino.games.Game;


public class Casino {
private static Profile profile = new Profile();
private static Greeter greeter = new Greeter();
private static boolean userIsLeaving = false;

public static void main(String[] args)
{
entertainUser();
}

static void entertainUser() {
greetUser();
while (!userIsLeaving) {
Game nextGame = offerUserGames();
playGameWithUser(nextGame);
offerUserLeave();
}
seeUserOut();
}

static void greetUser() {
String name = greeter.getUserName();
Boolean gambing = greeter.getIfGambling(name);
profile = new Profile(name, gambing);
}

static Game offerUserGames() {
Game nextGame;
if(profile.isGambler()) {
nextGame = greeter.getNextGame();
} else {
nextGame = greeter.getNextCleanGame();
}
return nextGame;
}

private static void playGameWithUser(Game nextGame) {
nextGame.play();
}


static void offerUserLeave() {
if(profile.getBalance() > 0) {
userIsLeaving = greeter.getIfLeaving();
} else {
greeter.balanceTooLow();
userIsLeaving = true;
}
}

static void seeUserOut() {
greeter.goodBye();
}

public static Profile getProfile() {
return profile;
}
static void setProfile() {
profile = new Profile();
}

static void setGreeter(Greeter newGreeter) {
greeter = newGreeter;
}

static boolean isUserIsLeaving() {
return userIsLeaving;
}
}
194 changes: 194 additions & 0 deletions src/main/java/io/zipcoder/casino/casino/Greeter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
package io.zipcoder.casino.casino;

import io.zipcoder.casino.casino.games.cardgames.BlackJack;
import io.zipcoder.casino.casino.games.cardgames.GoFish;
import io.zipcoder.casino.casino.games.Game;
import io.zipcoder.casino.casino.games.dicegames.Craps;
import io.zipcoder.casino.casino.games.dicegames.Macao;
import io.zipcoder.casino.casino.utilities.Console;

import java.io.ByteArrayInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.function.Supplier;

public class Greeter {
private Console console;
private static final String casinoName =
"\u001b[30;1m __ __ __ __ ______ __ \n" +
"/ \\ / | / | / | / \\ / | \n" +
"$$ \\ $$ |__ __ _____ ____ ______ ______ ______ $$ | $$ |_______ ______ /$$$$$$ | ______ _______$$/ _______ ______ \n" +
"$$$ \\$$ / | / / \\/ \\ / \\ / \\ / \\ $$ | $$ / \\ / \\ $$ | $$/ / \\ / / / \\ / \\ \n" +
"$$$$ $$ $$ | $$ $$$$$$ $$$$ /$$$$$$ /$$$$$$ /$$$$$$ | $$ | $$ $$$$$$$ /$$$$$$ | $$ | $$$$$$ /$$$$$$$/$$ $$$$$$$ /$$$$$$ |\n" +
"$$ $$ $$ $$ | $$ $$ | $$ | $$ $$ $$ $$ | $$/$$ | $$ | $$ | $$ $$ | $$ $$ | $$ | $$ | __ / $$ $$ \\$$ $$ | $$ $$ | $$ |\n" +
"$$ |$$$$ $$ \\__$$ $$ | $$ | $$ $$$$$$$$/$$ | $$ \\__$$ | $$ \\__$$ $$ | $$ $$ \\__$$ | $$ \\__/ /$$$$$$$ |$$$$$$ $$ $$ | $$ $$ \\__$$ |\n" +
"$$ | $$$ $$ $$/$$ | $$ | $$ $$ $$ | $$ $$/ $$ $$/$$ | $$ $$ $$/ $$ $$/$$ $$ / $$/$$ $$ | $$ $$ $$/ \n" +
"$$/ $$/ $$$$$$/ $$/ $$/ $$/ $$$$$$$/$$/ $$$$$$/ $$$$$$/ $$/ $$/ $$$$$$/ $$$$$$/ $$$$$$$/$$$$$$$/ $$/$$/ $$/ $$$$$$/ \n" +
" \u001b[0m";
private static final String blackJackName =
"\u001b[31m██████╗ ██╗ █████╗ ██████╗██╗ ██╗ ██╗ █████╗ ██████╗██╗ ██╗\n" +
"██╔══██╗██║ ██╔══██╗██╔════╝██║ ██╔╝ ██║██╔══██╗██╔════╝██║ ██╔╝\n" +
"██████╔╝██║ ███████║██║ █████╔╝ ██║███████║██║ █████╔╝ \n" +
"██╔══██╗██║ ██╔══██║██║ ██╔═██╗ ██ ██║██╔══██║██║ ██╔═██╗ \n" +
"██████╔╝███████╗██║ ██║╚██████╗██║ ██╗╚█████╔╝██║ ██║╚██████╗██║ ██╗\n" +
"╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝\n" +
" \u001b[0m";
private static final String goFishName =
"\u001b[32;1m ██████╗ ██████╗ ███████╗██╗███████╗██╗ ██╗\n" +
"██╔════╝ ██╔═══██╗██╔════╝██║██╔════╝██║ ██║\n" +
"██║ ███╗██║ ██║█████╗ ██║███████╗███████║\n" +
"██║ ██║██║ ██║██╔══╝ ██║╚════██║██╔══██║\n" +
"╚██████╔╝╚██████╔╝██║ ██║███████║██║ ██║\n" +
" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝\n" +
" \u001b[0m";
private static final String crapsName =
"\u001b[35m ██████╗██████╗ █████╗ ██████╗ ███████╗\n" +
"██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝\n" +
"██║ ██████╔╝███████║██████╔╝███████╗\n" +
"██║ ██╔══██╗██╔══██║██╔═══╝ ╚════██║\n" +
"╚██████╗██║ ██║██║ ██║██║ ███████║\n" +
" ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝\n" +
" \u001b[0m";
private static final String macaoName =
"\u001b[34;1m███╗ ███╗ █████╗ ██████╗ █████╗ ██████╗ \n" +
"████╗ ████║██╔══██╗██╔════╝██╔══██╗██╔═══██╗\n" +
"██╔████╔██║███████║██║ ███████║██║ ██║\n" +
"██║╚██╔╝██║██╔══██║██║ ██╔══██║██║ ██║\n" +
"██║ ╚═╝ ██║██║ ██║╚██████╗██║ ██║╚██████╔╝\n" +
"╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ \u001b[0m";

public static String getBlackJackName() {
return blackJackName;
}

public static String getGoFishName() {
return goFishName;
}

public static String getCrapsName() {
return crapsName;
}

public static String getMacaoName() {
return macaoName;
}

Greeter(){
this.console = Console.getConsole();
}

Greeter(Console console) {
this.console = console;
}

String getUserName() {
try {
console.println(casinoName);
return console.getStringInput("Welcome to our casino! What's your name?");
} catch (NoSuchElementException exception) {
return "Jane Doe";
}
}

Boolean getIfGambling(String name) {
Integer age = console.getIntegerInput(String.format("It's great to meet you, %s. How old are you?", name));
if (age >= 18) {
String isGambling = console.getStringInput("And will you be gambling here today?");
return parseIsGambling(isGambling);
} else {
console.print("No problem, we're happy to offer GoFish and Macao for our nongamblers. They do still" +
" cost money, though. Your starting balance is \u20A6500 NUC Bucks.\n");
return false;
}
}

private Boolean parseIsGambling(String isGambling) {
isGambling = isGambling.toLowerCase().trim();
if ("yes".equals(isGambling)) {
console.println("Your starting balance with us is \u20A6500 NUC Bucks. Best of luck!");
return true;
} else if ("no".equals(isGambling)) {
console.println("Okay, but our non-gambling games do still cost money to play. You have \u20A6500 NUC Bucks to start.");
return false;
} else {
console.println("That sounds like a yes!");
return true;
}
}

Game getNextGame() {
String requestedGame = console.getStandardInputCaps(
"Would you like to play BlackJack, GoFish, Craps or Macao?");
return parseGame(requestedGame);
}

Game getNextCleanGame() {
String requestedGame = console.getStandardInputCaps("Would you like to play GoFish or Macao?");
if (requestedGame.equals("BLACKJACK") || requestedGame.equals("CRAPS")) {requestedGame = "GOFISH";}
return parseGame(requestedGame);
}

private Game parseGame(String requestedGame) {
if (requestedGame.equals("TESTINGCHEATSENABLEDTRUE")) {return getCheatingTest();}
GameEnum enumeration = GameEnum.getValueOf(requestedGame);
return enumeration.create();
}



public enum GameEnum {
BLACKJACK(BlackJack::new),
CRAPS(Craps::new),
GOFISH(GoFish::new),
MACAO(Macao::new);

private final Supplier<Game> supplier;

GameEnum(Supplier<Game> supplier) {
this.supplier = supplier;
}

public Game create() {
return this.supplier.get();
}

public static io.zipcoder.casino.casino.Greeter.GameEnum getValueOf(String userInput) {
try {
return valueOf(userInput);
} catch (IllegalArgumentException var2) {
return valueOf("GOFISH");
}
}
}

private Game getCheatingTest() {
String input = "yes\nno";
byte[] inputBytes = input.getBytes();
ByteArrayInputStream inputByteArray = new ByteArrayInputStream(inputBytes);
Console console = new Console(new Scanner(inputByteArray), System.out);
return new Macao(console);
}

boolean getIfLeaving() {
String isLeaving = console.getStringInput("\n\n\nGood Game. Would you like to stay in our casino?");
if (isLeaving.equals("no") || isLeaving.equals("n")) {
return true;
} else if (isLeaving.toLowerCase().trim().equals("yes")) {
console.println("We're happy you're staying!");
return false;
} else {
console.println("It sounds like you'd like to play another game!");
return false;
}
}

void balanceTooLow() {
console.println("Sorry, your balance is too low to keep playing.");
}

void goodBye() {
console.println(casinoName);
console.println("Thank you so much for coming! Please come again!");
}

}
17 changes: 17 additions & 0 deletions src/main/java/io/zipcoder/casino/casino/Player.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.zipcoder.casino.casino;


public abstract class Player {
private Profile profile;
public Player(Profile profile) {

this.profile = profile;
}
public Player() {
profile = new Profile();
}

public Profile getProfile() {
return this.profile;
}
}
35 changes: 35 additions & 0 deletions src/main/java/io/zipcoder/casino/casino/Profile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.zipcoder.casino.casino;

public class Profile {
private String name;
private boolean gambler;
private Integer balance;

public Profile(String name, boolean canGamble) {
this.name = name;
this.gambler = canGamble;
this.balance = 500;
}

public Profile() {
this.name = "Dealer";
this.gambler = true;
this.balance = 5000000;
}

public String getName() {
return name;
}

public boolean isGambler() {
return gambler;
}

public Integer getBalance() {
return balance;
}

public void setBalance(Integer balance) {
this.balance = balance;
}
}
5 changes: 5 additions & 0 deletions src/main/java/io/zipcoder/casino/casino/games/Game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.zipcoder.casino.casino.games;

public interface Game {
void play();
}
Loading