cards_lib 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -0
- data/cards_lib.gemspec +3 -4
- data/lib/cards_lib/card.rb +4 -0
- data/lib/cards_lib/deck.rb +4 -0
- data/lib/cards_lib/version.rb +1 -1
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95003f09c263a8235c172a6916d125b1ed1dfad5
|
4
|
+
data.tar.gz: ac9fe48a00e794703184c3022685e1f799b4917d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25d28d3d04807b82ca9e1f8108e94515bfd4033d7d3c6aa948984aa24a2eb15ff6892f411f6dcf232964e0b8362eb5aed56988787a94b02096a43852df6c9ae7
|
7
|
+
data.tar.gz: 275b2e39c1a2bc67af05a5171147dcdffb035abff7bb2c094f6d31d62acdff2f76518eddbb2dda5bd0872708e1835749002429498894f201e9253cbd38b1f627
|
data/README.md
CHANGED
@@ -74,6 +74,33 @@ CardsLib::IsSet.verify(
|
|
74
74
|
|
75
75
|
* In **lib/cards_lib/standard/evaluators/blackjack_evaluator.rb** there is a Blackjack hand worth evaluation tool. See the **test/standard/evaluators/blackjack_evaluator_test.rb** for examples.
|
76
76
|
|
77
|
+
##Definitions
|
78
|
+
|
79
|
+
The main difference between **Rules** and **Evaluators** is Rules are purposed
|
80
|
+
for exact precedence and exact given matches (eg: two_pair only accepts
|
81
|
+
4 cards). An Evaluator can take all cards in a "Hand" *(Hand is not yet
|
82
|
+
defined in specification or implementation)* and give a complete evaluation
|
83
|
+
of the hands worth. To make a PokerEvaluator work for two_pair; one way you
|
84
|
+
could implement it is with
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
hand.combination(4).detect {|cards| two_pair(cards)}
|
88
|
+
```
|
89
|
+
|
90
|
+
but this is a very inefficient way to implement this. Perhaps a more
|
91
|
+
efficient way would be to use groupings
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
hand.group_by(&:rank).values.count {|group| group.length == 2} > 1
|
95
|
+
```
|
96
|
+
|
97
|
+
But that's pretty mutch the gist of it. The Evaluators can give the
|
98
|
+
entire hand evaluation where-as Rules are specific scenarios.
|
99
|
+
|
100
|
+
**Ranker** is a card evaluation object that is passed into a Card when
|
101
|
+
the Cards are first initialized. Each Card holds its own Ranker
|
102
|
+
object.
|
103
|
+
|
77
104
|
##License
|
78
105
|
|
79
106
|
The MIT License (MIT)
|
data/cards_lib.gemspec
CHANGED
@@ -21,10 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.0.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.11
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.4"
|
26
26
|
spec.add_development_dependency "color_pound_spec_reporter", "~> 0.0.5"
|
27
|
-
spec.add_development_dependency "minitest", "~> 5.8
|
28
|
-
spec.add_development_dependency "minitest-reporters", "~> 1.1
|
29
|
-
spec.add_development_dependency "minitest-byebug", "~> 0.0.3"
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
28
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
30
29
|
end
|
data/lib/cards_lib/card.rb
CHANGED
data/lib/cards_lib/deck.rb
CHANGED
data/lib/cards_lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cards_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel P. Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.11
|
19
|
+
version: '1.11'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.11
|
26
|
+
version: '1.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.8
|
61
|
+
version: '5.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.8
|
68
|
+
version: '5.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest-reporters
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.1
|
75
|
+
version: '1.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.1
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: minitest-byebug
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.0.3
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.0.3
|
82
|
+
version: '1.1'
|
97
83
|
description: Card Game Library. Testable and Object Oriented.
|
98
84
|
email:
|
99
85
|
- 6ftdan@gmail.com
|