acpc_table_manager 2.1.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76faf8f320816c313b3c3a55af0f7dd1640fa282
4
- data.tar.gz: acc0794208af9a2077cffd08a8cd08e3e0d48e2d
3
+ metadata.gz: 37d318b3c7a7ae1cb0bb9dac04919a4e26423968
4
+ data.tar.gz: 5a54e7687c8bcee32cd2b213846c9193967d711d
5
5
  SHA512:
6
- metadata.gz: 106363e9b850eb4c91b02cb5e590af41605d61ff3a04acdde56904787f585a233f00a758b08dae66eec6b8ee39b71cfd550308b6de754424f91064483b67e5f2
7
- data.tar.gz: eab711e93fe26b0af86c59fa0e1b049e15cf49ebfce1db2473fd05ca735755b3e980b1a24554282cca2dbccaa633bb4cde5f937de25bc91e20315933a9988a1c
6
+ metadata.gz: 3043fa0b107b23f92fbb9cfbaac6ca52fb7a963ff1bed375f7d690f5412c4bc152d8380f8981494939d6198826182e1e8fa97fdc6e1c718662bb18dde7158b36
7
+ data.tar.gz: 76cad3c88f1e4905f7bf9209a0d93036ba8e7371e975dcb29bc5efc2d2f0fa924f69e6adebc288383131affefcdc5b7db545302364e3afd1fdf26eee4d677c29
@@ -49,6 +49,8 @@ Signal.trap("TERM") { exit }
49
49
 
50
50
  must_send_ready = AcpcTableManager.config.respond_to?(:next_hand_request_code)
51
51
 
52
+ last_message_received = Time.now
53
+
52
54
  begin
53
55
  proxy = AcpcTableManager::Proxy.start match, must_send_ready
54
56
  proxy.log __method__, options
@@ -68,6 +70,17 @@ begin
68
70
  else
69
71
  proxy.play! action
70
72
  end
73
+ last_message_received = Time.now
74
+ elsif (
75
+ AcpcTableManager.config.proxy_timeout &&
76
+ (
77
+ Time.now > (
78
+ last_message_received + AcpcTableManager.config.proxy_timeout
79
+ )
80
+ )
81
+ )
82
+ # @todo Allow different behaviour on timeout
83
+ proxy.play_check_fold!
71
84
  end
72
85
  if proxy.match_ended?
73
86
  AcpcTableManager.redis.rpush(
@@ -128,6 +128,24 @@ class Proxy
128
128
  self
129
129
  end
130
130
 
131
+ def play_check_fold!
132
+ log __method__
133
+ if @player_proxy.users_turn_to_act?
134
+ play!(
135
+ if (
136
+ @player_proxy.legal_actions.any? do |a|
137
+ a == AcpcPokerTypes::PokerAction::FOLD
138
+ end
139
+ )
140
+ AcpcPokerTypes::PokerAction::FOLD
141
+ else
142
+ AcpcPokerTypes::PokerAction::CALL
143
+ end
144
+ )
145
+ end
146
+ self
147
+ end
148
+
131
149
  # @see PlayerProxy#match_ended?
132
150
  def match_ended?
133
151
  return false if @player_proxy.nil?
@@ -1,3 +1,3 @@
1
1
  module AcpcTableManager
2
- VERSION = "2.1.5"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_table_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill