The application is able to find the highest combination of 5 randomly generated French playing cards. You can use multiple decks which the five cards are chosen from. To do so, enter an integer parameter after the base url. Eg.: http://localhost:8000/5
Each card instance is created using a string parameter passed through to the static Card::getInstance(string $text)
method. The Singleton pattern is ensured by making the constructor private. However, the proper formatting of the parameter needs to be highlighted. Be wary that the first character represents the suit (Clubs, Diamonds, Spades, Hearts) of the card. The following characters need to be one of the possible ranks defined by the rules of poker (... 8, 9, 10, K, A etc.). Sticking with the aforementioned assertions you will get a Hearts of 2 by using Card::getInstance("H2");
Tests were also created for the app to avoid erroneous outcomes. These are run while building the application.
The result you will see includes the 5 randomly generated cards and the highest hand possible.
If you want to run the application in Docker you need the following commands:
docker build -t peterdinya/poker .
docker run -p 8000:80 --name poker peterdinya/poker
- Open localhost:8000 in your browser.
Enjoy!