jeopardy 0.0.26 → 0.0.27
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 +4 -4
- data/ext/jeopardy/Clue.c +0 -1
- data/ext/jeopardy/jeopardy.c +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b00543a1943b64e156309218d403ca767064d03b
|
4
|
+
data.tar.gz: 4615237f8e14a3c4419a001f87e09fa0b17515d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8733eba542d195357ab1969655f19603c13a72ed52571638db0b1844f691d128bd9962bb3c6be8acbd16723db4d069a3b7be6c017d9a9d6ad47efec19436d0a
|
7
|
+
data.tar.gz: d288f0d9b48ab512e40c0b58c5b42181ffef10a72ba21e48bfbfb9487d0761505522421f5833055f4e42a862a4da1d5b919acfcd375f5ff7af02c9d8702772c0
|
data/ext/jeopardy/Clue.c
CHANGED
data/ext/jeopardy/jeopardy.c
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "ruby.h"
|
2
2
|
#include "Game.h"
|
3
3
|
#include <time.h>
|
4
|
+
#include <limits.h>
|
4
5
|
|
5
6
|
VALUE Jeopardy;
|
6
7
|
VALUE rbGame;
|
@@ -198,20 +199,21 @@ static VALUE simulate(int argc, VALUE *argv, VALUE self)
|
|
198
199
|
VALUE trials_key = ID2SYM(rb_intern("trials"));
|
199
200
|
VALUE seed_key = ID2SYM(rb_intern("seed"));
|
200
201
|
rb_hash_set_if_nil(options, trials_key, INT2NUM(1));
|
201
|
-
|
202
|
+
|
203
|
+
VALUE rbRandom = rb_const_get(rb_cObject, rb_intern("Random"));
|
204
|
+
VALUE new_seed = rb_funcall(rbRandom, rb_intern("rand"), 1, UINT2NUM(UINT_MAX));
|
205
|
+
rb_hash_set_if_nil(options, seed_key, new_seed);
|
202
206
|
|
203
207
|
VALUE trials = rb_hash_aref(options, trials_key);
|
204
208
|
VALUE seed = rb_hash_aref(options, seed_key);
|
205
209
|
|
206
|
-
|
207
|
-
Check_Type(seed, T_FIXNUM);
|
210
|
+
|
208
211
|
if (NUM2INT(trials) < 1)
|
209
212
|
{
|
210
213
|
rb_raise(rb_eArgError, "The number of trials a game is simulated must be greater than zero.");
|
211
214
|
}
|
212
215
|
|
213
|
-
srand(
|
214
|
-
srand48(NUM2INT(seed));
|
216
|
+
srand(NUM2LL(seed));
|
215
217
|
|
216
218
|
Game game = c_game(self);
|
217
219
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeopardy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Devin Shelly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A fast Monte Carlo simulation of the television game show Jeopardy!
|
14
14
|
email: devin@devinshelly.com
|