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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 116128e753df7d33bdbbf92dff21cc56f44e2712
4
- data.tar.gz: eb7424abd1a29cd3d0940bcc5eca8e7e3d8303f6
3
+ metadata.gz: 95003f09c263a8235c172a6916d125b1ed1dfad5
4
+ data.tar.gz: ac9fe48a00e794703184c3022685e1f799b4917d
5
5
  SHA512:
6
- metadata.gz: 786ec4e653b8bc177b9f34800960aeb76410c2a28c12595d353426fb71326f85bc55f5922b30163c71315313b68982af9ac8e820af71ffad408134677749b125
7
- data.tar.gz: 602402ad77e0bc9318b8be79bc7d82ab2b633f303c24dc2e5781c926e0caf9b97746876bb35e2fb6b180176c6e7f383ef03638b2c81fc1fce3ba421d1298ea8f
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.0"
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.1"
28
- spec.add_development_dependency "minitest-reporters", "~> 1.1.4"
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
@@ -11,6 +11,10 @@ module CardsLib
11
11
  @ranker = ranker.new(self.rank)
12
12
  end
13
13
 
14
+ def inspect
15
+ "(Card)"
16
+ end
17
+
14
18
  def face
15
19
  @face
16
20
  end
@@ -7,6 +7,10 @@ module CardsLib
7
7
  @cards = cards.map {|c| Card.new(c) }.shuffle(random: Random.new(@seed)).to_enum
8
8
  end
9
9
 
10
+ def inspect
11
+ "<Deck: #{size} Cards - Seed##{@seed}>"
12
+ end
13
+
10
14
  def cards
11
15
  @cards
12
16
  end
@@ -1,3 +1,3 @@
1
1
  module CardsLib
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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: 2015-12-13 00:00:00.000000000 Z
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.0
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.0
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.1
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.1
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.4
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.4
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