Skip to content

Commit 386c7c8

Browse files
committed
Travis Readme Changelog License
1 parent 6b87645 commit 386c7c8

File tree

4 files changed

+104
-1
lines changed

4 files changed

+104
-1
lines changed

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: php
2+
3+
php:
4+
- 7.0
5+
- 7.1
6+
- 7.2
7+
- 7.3
8+
- 7.4
9+
10+
before_script:
11+
- travis_retry composer update
12+
13+
script:
14+
- vendor/bin/phpunit

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [1.0.0] - 2020-11-25
10+
### Added
11+
- Initial release
12+
- Texas Holdem Hand

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Michael Perks
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ composer require simple-hacker/PHPoker
1111
## Usage
1212

1313
```php
14-
use simple-hacker\PHPoker\Hands\TexasHoldemHand
14+
use simplehacker\PHPoker\Hands\TexasHoldemHand;
1515

1616
$communityCards = '3hJdQdAdKd';
1717
$holeCards = 'Td6s';
@@ -29,9 +29,65 @@ $communityCards = ['3h', 'Jd', 'Qd', 'Ad', 'Kd'];
2929
$communityCards = [new Card('3h'), new Card('Jd'), new Card('Qd'), new Card('Ad'), new Card('Kd')];
3030
$communityCards = [new Card('3h'), 'Jd', new Card('Qd'), 'Ad', new Card('Kd')]; // A mix of both
3131
```
32+
33+
Once a hand has been instantiated, you are able to get the hand description as well as a numerical value of the hand used for comparing against other hands.
34+
35+
```php
36+
use simplehacker\PHPoker\Hands\TexasHoldemHand;
37+
38+
$communityCards = '3hJdQdAdKd';
39+
$holeCards = 'Td6s';
40+
41+
$hand = new TexasHoldemHand($communityCards, $holeCards);
42+
43+
// Royal Flush, Ace to Ten of Diamonds
44+
$hand->getDescription();
45+
46+
// AdKdQdJdTd
47+
$hand->getShortDescription();
48+
49+
// 10
50+
$hand->getHandRank();
51+
52+
// const ROYAL_FLUSH_RANK = 10;
53+
// const STRAIGHT_FLUSH_RANK = 9;
54+
// const FOUR_OF_A_KIND_RANK = 8;
55+
// const FULL_HOUSE_RANK = 7;
56+
// const FLUSH_RANK = 6;
57+
// const STRAIGHT_RANK = 5;
58+
// const THREE_OF_A_KIND_RANK = 4;
59+
// const TWO_PAIR_RANK = 3;
60+
// const ONE_PAIR_RANK = 2;
61+
// const HIGH_CARD_RANK = 1;
62+
63+
// 11459770
64+
$hand->getHandValue();
65+
66+
// Hand value is generated from converting Hand Rank and all Card values to a binary string, and converting back to base 10. This ensures the best hand will always be the highest number
67+
```
68+
69+
3270
## Cards
71+
Cards can be instantiated in numerous ways. The follwing all result in the Ace of Spades:
72+
73+
```php
74+
// As a short value where the first character is 23456789TJQKA and the suit as shcd
75+
new Card('As');
3376

77+
// Arguments for both value and suit
78+
new Card('Ace', 'Spades');
79+
new Card('A', 's');
3480

81+
// As numerical values
82+
// Jack = 11, Queen = 12, King = 13, Ace = 1 or 14
83+
// Clubs = 1, Diamonds = 2, Hearts = 3, Spades = 4
84+
new Card(14, 4);
85+
86+
// Or any combination of the above
87+
new Card('Ace', 's');
88+
new Card(1, 'spades');
89+
```
90+
A InvalidCardException will be thrown for invalid values or suits
3591

3692
## Upcoming releases
3793
- Compare TexasHoldemHands to determine winner

0 commit comments

Comments
 (0)