Skip to content

dipeti/pokerhand

Repository files navigation

PokerHand

Description

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.

Using with Docker

If you want to run the application in Docker you need the following commands:

  1. Build the app
docker build -t peterdinya/poker .
  1. Run the app
docker run -p 8000:80 --name poker peterdinya/poker
  1. Open localhost:8000 in your browser.

Enjoy!

About

Dockerfile included

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published