Closed LarsGast closed 1 year ago
The getDisplayString() method for the rank gets a single character string for all values except 10. To keep this consistent 10 could be displayed as T, I've seen this being done before. This would mean that the display string for a card would always be 2 characters long. However, this might not be intuitive for everyone, so maybe an optional boolean parameter displayTenAsT
could work here.
I decided to go with a displayTenAsT
boolean optional parameter that is false by default. It being false by default seems more intuitive, as ten is not part of the royal cards.
Is your feature request related to a problem? Please describe. If you want to display the rank and the suit of a card right now, the only way of doing that would be to display the string values of those enums. It would be nice to be able to all a method that converts those enums to a prettier display string.
Describe the solution you'd like Create a method for each enum (Rank and Suit) that converts the value of that enum into single character strings.
For the Rank enum, the method could return the number of the value (so 2, 3, etc.) instead of the string value (so Two, Three, etc.) if the value if lower then Jack. For Jack, Queen, King, and Ace, the method could return the single letter that represents those values (so J, Q, K, and A).
For the Suit enum, the method could return the unicode string for the different type of suits. These are:
Describe alternatives you've considered Displaying the first letter of the Suit enum could also work instead of the unicode characters. These letters have no overlap with the first letters of Jack, Queen, King, and Ace.
Additional context I've already experimented with this in a different project. The code that I used for that is this: