acpc_poker_types 7.2.5 → 7.3.0

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: 9127758f2204df342861cdd5e76c6de58a78fdee
4
- data.tar.gz: 502b43ac46044d4132f09fe30978d1b1931adbce
3
+ metadata.gz: 420a31712b46aefd6c8af8e3e3511bfde1376f7b
4
+ data.tar.gz: 4f27b80f00a3696a789a09564d63c3384b6efc2e
5
5
  SHA512:
6
- metadata.gz: 8ff33a4324600f23aece029bb96fbc40a5fddf4fe545a8145f898c4671aa56a03d70deb50417864726e3820f815624fdcf4b7d7c0c6ed7c2dcc201df88b40ba0
7
- data.tar.gz: 676bb3d6b95d46da2f8e712d2afa812e9147c840c60d3da179bd49f67742a6470ae8570d8e52d6605543a1399a5b9f6c5c6c11201586a33a96b3cb0cbc712d9c
6
+ metadata.gz: b32c17d595b04f275e3cf0c61bc10ead3834148bd42f5bb60191835c1a6e5f7d615813a00d58b72edfdf6596875b274267e3eeffacc974544243b27dbaa11e0c
7
+ data.tar.gz: 5944fd75d1e3e351aa66c547789ed8528580f5af9d6f6af4424776e2f90621e4face4c771c3d36109cbae659a53ab29b16752b6cc76cb53fea3f2422e2d94e10
@@ -50,6 +50,14 @@ class HandPlayer
50
50
  @winnings - total_contribution
51
51
  end
52
52
 
53
+ def contributions_before(cur_round = round)
54
+ if cur_round > 0
55
+ contributions[0..cur_round-1].inject(:+)
56
+ else
57
+ 0
58
+ end
59
+ end
60
+
53
61
  def contributions
54
62
  contribution_list = @actions.map do |actions_per_round|
55
63
  actions_per_round.inject(0) { |sum, action| sum += action.cost }
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerTypes
2
- VERSION = '7.2.5'
2
+ VERSION = '7.3.0'
3
3
  end
@@ -40,6 +40,35 @@ describe HandPlayer do
40
40
  end
41
41
  end
42
42
  end
43
+ describe '#contributions_before' do
44
+ it 'works' do
45
+ x_actions = [
46
+ [
47
+ PokerAction.new('c', cost: 100),
48
+ PokerAction.new('r200', cost: 100)
49
+ ],
50
+ [
51
+ PokerAction.new('r400', cost: 200),
52
+ PokerAction.new('c', cost: 0)
53
+ ]
54
+ ]
55
+ x_actions.each_with_index do |actions, in_round|
56
+ actions.each do |action|
57
+ patient.append_action!(action, in_round)
58
+ end
59
+ end
60
+
61
+ x_contributions = x_actions.map do |actions|
62
+ actions.inject(0) { |sum, action| sum += action.cost }
63
+ end
64
+ x_contributions[0] += ANTE
65
+
66
+ patient.contributions_before.must_equal(x_contributions[0])
67
+ patient.contributions_before(0).must_equal(0)
68
+ patient.contributions_before(1).must_equal(x_contributions[0])
69
+ patient.contributions_before(2).must_equal(x_contributions.inject(:+))
70
+ end
71
+ end
43
72
  describe '#append_action!' do
44
73
  describe 'raises an exception if it is not active' do
45
74
  it 'if it has folded' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.5
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill