The coverage relates to the Scala 2 version of the project
A CLI version of Texas Holdem using Scala 3 for the course "Reactive Programming" at HTWG WS20/21.
All typical cash game rules are covered.
You can play poker with one of two card deck. One has symbols on the cards (♥,♦,♣,♠), and one has letters (h,d,c,s).
To play with the symbols run
sbt "run symbols"
to play with letters run
sbt "run letters"
HINT: h = hearts = ♥, d = diamonds = ♦, c = clubs = ♣, s = spades = ♠
The symbols are unicode characters that cannot be rendered by every console, use letters if you encounter rendering issues.
You can use these commands if it is your turn:
fold
check
call
raise 42
all-in
Here is an example of how it looks if you call. Look at your current bet (that 6 above the betting line) to understand what is going on.
Pot 0
⬇️
0 1 2 2 6 0
________________________________________________________________________________________
[xx][xx] [xx][xx] [xx][xx] [xx][xx] [xx][xx] [7♦][8♦]
Amy (D) Bob Dev Fox Udo You
200 199 198 198 194 200
________
call
Pot 0
⬇️
0 1 2 2 6 6
________________________________________________________________________________________
[xx][xx] [xx][xx] [xx][xx] [xx][xx] [xx][xx] [7♦][8♦]
Amy (D) Bob Dev Fox Udo You
200 199 198 198 194 194
________
Here you have called Udo's bet of 6 with [7♦][8♦]
.
If you ever get confused on what happened, have a look into what_happened.txt, where you can analyse your current match in detail.
You are playing against our bots Amy, Bob, Dev, Fox and Udo that make their actions based on multiple parameters.
The bot evaluates his hand by
- If the values are high
- If the values are close to each other, which increases the chances to get a straight (cards are "connectors")
- If the values have the same symbol (cards are "suited") If the evaluation of the hole cards is
- good, the bot will play aggressively
- mediocre, the bot will play passively
- bad, the bot is likely to fold
After the flop, the bot evaluates his own hand in combination with the board. This is a more complex process, since the evaluation is multidimensional:
- The bot might have nothing
- The bot might have something, e.g. a pair
- The bot might have nothing yet, but a relatively high chance to get a flush or a straight (a "draw")
All that is taken into consideration.
One thing that is not taken into consideration is a differentiation between the absolute and the relative hand value.
If the board is a flush and the bot has no card of that suit, he will play aggressively, since he thinks he has a great hand, without taking into consideration, that EVERYONE has a flush.
- Side pots, so that if two players with different stacks go all-in, they win different amounts. Reason: A player should not be able to win more than what he invested.
Many different aspects of the Scala Programming Language and surrounding libraries are covered, therefore some effort is put onto the technology rather than the game itself.
You can find the basics (Introduction to Scala, More Scala, Tests, Functional Style and Monads) everywhere around the code. The more specific aspects and technologies are linked below:
To evaluate hands, we borrowed the solution from the TwoPlusTwo hand ranks evaluator as described here. To get the implementation of the evaluation done, we looked here, here and here.