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 +4 -4
- data/README.md +9 -15
- data/lib/poker_engine/game.rb +4 -4
- data/lib/poker_engine/hand_levels.rb +1 -1
- data/lib/poker_engine/reducer.rb +1 -1
- data/lib/poker_engine/version.rb +1 -1
- metadata +19 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5b342dc64e5de5a4827b69b56379d02fa4e405a
|
4
|
+
data.tar.gz: f272f5c396d251e4e06abf4a360103de445c38b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
9
|
-
|
10
|
-
## TODOs
|
11
|
-
|
12
|
-
- [ ] Adding validators
|
6
|
+
There is simple console interface, run `./examples/simple-gameplay.rb` and play!
|
13
7
|
|
14
|
-
|
15
|
-
-
|
16
|
-
-
|
8
|
+
Valid moves:
|
9
|
+
- check
|
10
|
+
- fold
|
11
|
+
- call
|
12
|
+
- raise [bet amount], example: __raise 100__
|
17
13
|
|
18
|
-
##
|
14
|
+
## Documentation
|
15
|
+
In progress
|
16
|
+
## Tests
|
19
17
|
|
20
18
|
Run `rspec`
|
21
|
-
|
22
|
-
## Resources
|
23
|
-
|
24
|
-
- https://www.pokernews.com/pokerterms
|
data/lib/poker_engine/game.rb
CHANGED
@@ -14,8 +14,8 @@ module PokerEngine
|
|
14
14
|
run(state, &handler)
|
15
15
|
end
|
16
16
|
|
17
|
-
def next(
|
18
|
-
state = Reducer.call
|
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
|
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)
|
data/lib/poker_engine/reducer.rb
CHANGED
data/lib/poker_engine/version.rb
CHANGED
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.
|
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-
|
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/
|
133
|
+
homepage: https://github.com/kanevk/poker-engine
|
121
134
|
licenses:
|
122
135
|
- MIT
|
123
136
|
metadata:
|
124
|
-
github: https://github.com/
|
137
|
+
github: https://github.com/kanevk/poker-engine
|
125
138
|
post_install_message:
|
126
139
|
rdoc_options: []
|
127
140
|
require_paths:
|