https://github.com/gitmaz/Poker-Pro
This is second test I successfully passed for Newscorp. It is a sample to show my proficiency SOLID oop concepts and design patterns. It implement strategy design pattern. It solves how to find Straightness in a set of Poker cards.
https://github.com/gitmaz/Poker-Pro
composer phpunit strategy-design-pattern vanilla-php
Last synced: 3 months ago
JSON representation
This is second test I successfully passed for Newscorp. It is a sample to show my proficiency SOLID oop concepts and design patterns. It implement strategy design pattern. It solves how to find Straightness in a set of Poker cards.
- Host: GitHub
- URL: https://github.com/gitmaz/Poker-Pro
- Owner: gitmaz
- Created: 2020-04-23T23:31:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T06:30:21.000Z (about 5 years ago)
- Last Synced: 2024-07-29T17:40:02.431Z (10 months ago)
- Topics: composer, phpunit, strategy-design-pattern, vanilla-php
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About Poker-Pro
Poker-Pro is a demo application that demonstrates basic oop concepts (SOLID principals) and how to use Strategy Design Pattern.
- Functionality: It picks a random set of playing cards hand and checks whether they are "Straight" or "Straight Flush" according to Poker's
high low standard rules.
Reference:
Straight : http://en.wikipedia.org/wiki/List_of_poker_hands#Straight
Straight Flush : http://en.wikipedia.org/wiki/List_of_poker_hands#Straight_flush
#### How to installAfter cloning this code repository to your local computer and changing directory to the created folder, run fallowing commands on the console:
(first make sure php, composer are installed on your computer).1. composer install
2. composer dump-autoload#### How to run
Note: to run, type:php Play.php
on the console and then press enter.
To test with arbitrary set of hands, just write a new strategy similar to StraightHandSelection.php to see if
the application really works (you need to then add this at the end of $strategies array defined at the beginning Play.php in root folder).
Alternatively, pay attention to the random selection of cards appearing on the first line of output when running this
app and check the results logically.
To see how the app deals with the wrong input, simply uncomment /*"WrongRank", "MisspelledSuit",*/ in Play.php individually and rerun
the program.
#### Unit testsTest cases for final functionality of project is put in test directory for each of the main classes
to run test cases individually use this syntax:
vendor/bin/phpunit --filter testExampleCase ExampleTests ./tests/ExampleTests.php
## License
This source code is based on vendor libraries, therefore fallows all included open source vendor copyrights. Users are granted
the right to copy/modify and distribute Poker-Pro by keeping all main code and included library's copyright details including @author tags.- Author:
Maziar Navabi [email protected]
23/04/2020