hand_rank 0.0.1 → 0.0.3

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: 30f8feb7d175b7d18eea2d0ec62b0dfc5be18385
4
- data.tar.gz: 3dd0df03ee14c44b5c124cfea0e1eeb9b3856446
3
+ metadata.gz: e36f8916be5288dcd1b0fb1db594c9a7e680f649
4
+ data.tar.gz: d52d06ba112ef0e978ec109bc3c5667f92eaa21e
5
5
  SHA512:
6
- metadata.gz: 583bb9aa4b113c1869cc47328ea3a69aeee27e0ff9f3df01055cb19adfa23403b5b254cbc979046c3ad60b1018304eb4054ac1478fc961ff6325d6f0b222a46c
7
- data.tar.gz: a1757fc164bfce4d8f2292c74a8e820ddec579f5117db0a0d9ab4a529fc479137dcec80e7b50545cfa1aa73fa853a4e168b04495d2122c4493ef889527828484
6
+ metadata.gz: d59eefce6a3d9e2184d829b2be92a2b86e34c6abeae8321def485f70b4d2e718c1658725740c35414fea9570ecc504b47fe1dfe7e98a06591d858f86d7e39409
7
+ data.tar.gz: 5d2a41c87a478fa45f278b8fd2499abb3809d2b39b21a5c5c6b7a9a215875784a9baeedef8815f6f3ed2f0816df28911463fa555a11789453ffcd963bff9e7bd
data/.gitignore CHANGED
@@ -8,3 +8,5 @@
8
8
  *.a
9
9
  mkmf.log
10
10
  .DS_Store
11
+ hand_rank-*.gem
12
+ lib/hand_rank/ranks.data*
data/README.md CHANGED
@@ -9,7 +9,7 @@ Please read this entire readme before using the gem, thank you.
9
9
 
10
10
  # HandRank
11
11
 
12
- The hand_rank gem is a Ruby, with C extension, implementation of the 2 plus 2
12
+ The hand_rank gem is a Ruby, with C extension, implementation of the Two Plus Two
13
13
  hand evaluation algorithm for Texam Hold'em hands (or any hands following the
14
14
  same ranking order).
15
15
 
@@ -21,7 +21,7 @@ Each, final, cell contains the Cactus Kev hands equivalence number, a number
21
21
  describing the hand among every possible hand. This number can then be compared
22
22
  to any other hands equivalence number to see who is the winner.
23
23
 
24
- The 2 plus 2 version also reorders the equivalence classes to allow for getting
24
+ The Plus Two version also reorders the equivalence classes to allow for getting
25
25
  a rank within a category. So you can split the rank into a category and a rank
26
26
  within that category.
27
27
 
@@ -37,9 +37,9 @@ equivalence classes.
37
37
 
38
38
  [Paul Senzee - "Some Perfect Hash"](http://www.paulsenzee.com/2006/06/some-perfect-hash.html)
39
39
  describes a hashing algorithm to improve on the size of the Cactus Kev lookup
40
- table and is the same that is used for the lookup table to the 2 plus 2 solution.
40
+ table and is the same that is used for the lookup table to the Two Plus Two solution.
41
41
 
42
- [The original thread on the 2 plus 2 forums]() where it all came together. It's
42
+ [The original thread on the Two Plus Two forums]() where it all came together. It's
43
43
  long and threatens to become a bit flamy at times. But in the end I think it is
44
44
  a great example of what you can accomplich on the internet, with strangers if
45
45
  you are all prepared to act for the greater good.
@@ -12,6 +12,8 @@ const char * const HAND_CATEGORY_KEYS[] = { "invalid_hand", "high_card", "one_pa
12
12
  /* conversions. */
13
13
  /******************************************************************************/
14
14
 
15
+ char* rb_get_gem_path();
16
+
15
17
  char* concat( char* first, char* second ){
16
18
  size_t first_length = strlen( first );
17
19
  size_t second_length = strlen( second );
@@ -24,8 +26,8 @@ char* concat( char* first, char* second ){
24
26
  return both;
25
27
  }
26
28
 
27
- char* with_path( char* file_name ){
28
- char* path = get_path_from_ruby();
29
+ char* c_prefix_with_gem_path( char* file_name ){
30
+ char* path = rb_get_gem_path();
29
31
 
30
32
  return concat( path, file_name );
31
33
  }
@@ -166,7 +168,7 @@ VALUE rb_explain( VALUE klass, VALUE rb_rank ){
166
168
  return result;
167
169
  }
168
170
 
169
- char* rb_get_path(){
171
+ char* rb_get_gem_path(){
170
172
  VALUE cHandRank = rb_const_get(rb_cObject, rb_intern("HandRank"));
171
173
  ID sym_mymodule = rb_intern( "HOME" );
172
174
  VALUE home = rb_const_get( cHandRank, sym_mymodule );
@@ -174,8 +176,8 @@ char* rb_get_path(){
174
176
  }
175
177
 
176
178
  void rb_load_lut(){
177
- with_path("ranks.data")
178
- if( c_load_lut() == -1 ){
179
+ char* path = c_prefix_with_gem_path( "ranks.data" );
180
+ if( c_load_lut( path ) == -1 ){
179
181
  rb_raise( rb_eIOError, "could not open data file.");
180
182
  exit( 1 );
181
183
  }
data/hand_rank.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = "Jonas Schubert Erlandsson"
10
10
  spec.email = "jonas.schubert.erlandsson@my-codeworks.com"
11
11
  spec.summary = "Implements fast poker hand ranking algorithms in C and exposes them through a Ruby API."
12
- spec.description = "This gem implements the 2 plus 2 forum algorith for ranking \"normal\" poker hands, such that are used in Texas Hold'em for example. Support for more hand types, such as high/low hands, will be added in future versions."
12
+ spec.description = "This gem implements the Two Plus Two forum algorithm for ranking \"normal\" poker hands, such that are used in Texas Hold'em for example. Support for more hand types, such as high/low hands, will be added in future versions."
13
13
  spec.homepage = "https://github.com/replaygaming/hand_rank"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,3 +1,3 @@
1
1
  module HandRank
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hand_rank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Schubert Erlandsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.9'
55
- description: This gem implements the 2 plus 2 forum algorith for ranking "normal"
55
+ description: This gem implements the Two Plus Two forum algorithm for ranking "normal"
56
56
  poker hands, such that are used in Texas Hold'em for example. Support for more hand
57
57
  types, such as high/low hands, will be added in future versions.
58
58
  email: jonas.schubert.erlandsson@my-codeworks.com