Rubeuler 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -1
- data/README.md +13 -0
- data/lib/rubeuler/problem.rb +1 -2
- data/lib/rubeuler/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
@@ -7,5 +7,7 @@
|
|
7
7
|
0.0.4 - Add tests using minitest
|
8
8
|
|
9
9
|
0.0.5 - Feature: Track other variables... the options `tracked: {foo: @foo}` would track a variable set as `@foo` in Rubeuler::Problem's `:answer` argument
|
10
|
-
Improve on tests, improve timer by moving Benchmark closer to code being evaluated
|
10
|
+
Improve on tests, improve timer by moving Benchmark closer to code being evaluated
|
11
|
+
|
12
|
+
0.0.6 - Reverting the change to the Benchmark implementation from 0.0.5
|
11
13
|
|
data/README.md
CHANGED
@@ -18,7 +18,20 @@ If the answer to problem one is 42, the code below should produce a successful r
|
|
18
18
|
Rubeuler::Problem.new(number: 1, answer: "7*3*2").execute!
|
19
19
|
```
|
20
20
|
|
21
|
+
Extra options (just one right now):
|
22
|
+
```ruby
|
23
|
+
answer = "@loop_count = 0; 1001.times do; @loop_count += 1; end; result = 42"
|
24
|
+
|
25
|
+
# Use :tracked option to track extra variables included in your algorithm
|
26
|
+
Rubeuler::Problem.new(number: 1, answer: answer, tracked: {loop_count: "@loop_count"}).execute!
|
27
|
+
=> #<Rubeuler::Result:0x007fef81c221f8
|
28
|
+
@data={:solution=>42, :loop_count=>1001},
|
29
|
+
@runtime=0.0002689361572265625,
|
30
|
+
@success=true>
|
31
|
+
```
|
32
|
+
|
21
33
|
__NOTE__: Solutions (see Rubeuler::Solution) are not provided for you. Successfully solve some ProjectEuler problems to build your own list, then use Rubeuler to judge the quality of your solutions.
|
34
|
+
__NOTE__: The last expression in the `:answer` argument will be compared to solution predefined in `Rubeuler::Solution` for that problem number.
|
22
35
|
|
23
36
|
### Pull requests/issues
|
24
37
|
|
data/lib/rubeuler/problem.rb
CHANGED
@@ -19,8 +19,7 @@ module Rubeuler
|
|
19
19
|
|
20
20
|
private
|
21
21
|
def timed_answer
|
22
|
-
timer_endpoints =
|
23
|
-
instance_eval(timer_endpoints.join(@answer.gsub("\n",";")))
|
22
|
+
timer_endpoints = Benchmark.measure { @data = instance_eval(@answer.gsub("\n",";"))}.real
|
24
23
|
end
|
25
24
|
|
26
25
|
def solution
|
data/lib/rubeuler/version.rb
CHANGED