poker-engine 1.0.0 → 1.1.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: bc329a00c9421d0689395ca15d79839d8f7141f7
4
- data.tar.gz: f5b4b1d27ee2fcc6dd929587a2336832f73c6037
3
+ metadata.gz: d5b342dc64e5de5a4827b69b56379d02fa4e405a
4
+ data.tar.gz: f272f5c396d251e4e06abf4a360103de445c38b8
5
5
  SHA512:
6
- metadata.gz: cbdc36361e03f6919bdbb3cfa729131a893741942afa915a20851482c1f7ca2b44cf2dc90cc2a843f75b97b47541db732d7a8c53ac0f993bd80d963943847ffe
7
- data.tar.gz: 52b87a7f764f916f2b0a035c72c6687212f46001c98dc8131a7b9cab4a0d0b78de53f77e9cbc6070578ee9cf71ffa9f04056841a9fd42c57a03cff577786d687
6
+ metadata.gz: c9291ea2973d06bdd189a8ff92aada42af0981b7e163c4fea37265be8fa285945cd8153f159e54acb5ed592b90b1e61d5bbd016985b8d7f3f18a5c91c55db794
7
+ data.tar.gz: 01b92df83ec947f38105b1f64b5b9167188fa22eae9f2e2465b8eaa34e1b3d3b2c9b6a63e428170b9f0cf464d16a9effabf0cad74a98fd4f4e1ea4674f981378
data/README.md CHANGED
@@ -1,24 +1,18 @@
1
1
  # poker-engine
2
2
  Poker library written in Ruby :heart:
3
3
 
4
- ![The price](the_price.jpg)
5
-
6
4
  ## Try it
7
5
 
8
- Currently there is simple 74% working console interface `./examples/console-ui`
9
-
10
- ## TODOs
11
-
12
- - [ ] Adding validators
6
+ There is simple console interface, run `./examples/simple-gameplay.rb` and play!
13
7
 
14
- Currently, the user moves are not validated and that can result in breaking the game logic.
15
- - [ ] Rethink the concept of aggressor
16
- - [ ] Plug-in the hand evaluation logic in to the game cycle
8
+ Valid moves:
9
+ - check
10
+ - fold
11
+ - call
12
+ - raise [bet amount], example: __raise 100__
17
13
 
18
- ## Test~~s~~
14
+ ## Documentation
15
+ In progress
16
+ ## Tests
19
17
 
20
18
  Run `rspec`
21
-
22
- ## Resources
23
-
24
- - https://www.pokernews.com/pokerterms
@@ -14,8 +14,8 @@ module PokerEngine
14
14
  run(state, &handler)
15
15
  end
16
16
 
17
- def next(state, player_action, &handler)
18
- state = Reducer.call state, player_action
17
+ def next(outer_state, player_action, &handler)
18
+ state = Reducer.call Hamster.from(outer_state), player_action
19
19
 
20
20
  run(state, &handler)
21
21
  end
@@ -23,13 +23,13 @@ module PokerEngine
23
23
  def run(state, &handler)
24
24
  subscribed_reducer = lambda do |old_state, action|
25
25
  new_state = Reducer.call old_state, action
26
- handler&.call [old_state, action], new_state
26
+ handler&.call action, Hamster.to_ruby(new_state)
27
27
 
28
28
  new_state
29
29
  end
30
30
 
31
31
  loop do
32
- break state if state[:pending_request] || state[:game_ended]
32
+ break Hamster.to_ruby(state) if state[:pending_request] || state[:game_ended]
33
33
 
34
34
  actions = NextActions.call(state)
35
35
  state = actions.reduce(state, &subscribed_reducer)
@@ -12,7 +12,7 @@ module PokerEngine
12
12
 
13
13
  def <=>(other)
14
14
  unless other.instance_of?(self.class)
15
- fail "Can't detail detail hands of different level"
15
+ fail "Can't detail compare hands of different level"
16
16
  end
17
17
 
18
18
  detail_compare(other)
@@ -91,7 +91,7 @@ module PokerEngine
91
91
  .put(:aggressor_id, nil)
92
92
  end
93
93
 
94
- def game_end(state, top_hands:, winner_ids:, **_action)
94
+ def game_end(state, top_hands: [], winner_ids:, **_action)
95
95
  state
96
96
  .put(:top_hands, top_hands)
97
97
  .put(:winner_ids, winner_ids)
@@ -1,3 +1,3 @@
1
1
  module PokerEngine
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poker-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamen Kanev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hamster
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry-byebug
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -97,8 +111,7 @@ dependencies:
97
111
  description: " Poker library introducing the game logic with a simple interface.
98
112
  Currently offering only 6-max Holdem games.\n"
99
113
  email: kamen.e.kanev@gmail.com
100
- executables:
101
- - console
114
+ executables: []
102
115
  extensions: []
103
116
  extra_rdoc_files: []
104
117
  files:
@@ -117,11 +130,11 @@ files:
117
130
  - lib/poker_engine/reducer.rb
118
131
  - lib/poker_engine/state_operations.rb
119
132
  - lib/poker_engine/version.rb
120
- homepage: https://github.com/kekanev/poker-engine
133
+ homepage: https://github.com/kanevk/poker-engine
121
134
  licenses:
122
135
  - MIT
123
136
  metadata:
124
- github: https://github.com/kekanev/poker-engine
137
+ github: https://github.com/kanevk/poker-engine
125
138
  post_install_message:
126
139
  rdoc_options: []
127
140
  require_paths: