Simulating a variation of Blackjack (no splits or doubles), in Java. The player is "Sam".
Gradle is required. Tested with OpenJDK 11 on Arch Linux.
gradle build -x test
gradle test
gradle run
gradle run --args=-v
gradle run --args='-n cards.txt'
gradle jar
java -jar build/libs/blackjack-1.0.0.jar -v
java -jar build/libs/blackjack-1.0.0.jar -n cards.txt
gradle javadoc && xdg-open build/docs/javadoc/index-all.html
java -jar build/libs/blackjack-1.0.0.jar -t -s
This strategy doesn't perform too well. Sam wins around 38% of the rounds.
java -jar build/libs/blackjack-1.0.0.jar -t -b
This strategy performs better. Sam wins around 76% of the rounds.
Usage: blackjack [ flags ] FILE
The BasicOptimized strategy is used by default for Sam.
Flags:
-b | --basicopt Use the BasicOptimized strategy for Sam. (default)
-2 | --second Use the SecondOptimized strategy for Sam.
-3 | --third Use the Third strategy for Sam.
-a | --always-hit Use a strategy where Sam always hits.
-s | --always-stay Use a strategy where Sam always stays.
-t | --test Quickly test the current strategy.
-n | --noshuffle Don't shuffle the cards.
-o | --optimize Optimize the parameters of the chosen strategy.
-r | --random Randomize parameters when optimizing them.
-h | --help Output this help.
-v | --verbose Output detailed information about the games.
--version Output the current version number.
- Version: 1.0.0
- License: BSD-3
The Blackjack image is from WikiMedia and is licensed under a Creative Commons license.