Class: GfobhScorer::Scorer

Inherits:
Object
  • Object
show all
Defined in:
lib/gfobh_scorer/scorer.rb

Constant Summary collapse

BASE_URL =
'https://gfobh.herokuapp.com'

Instance Method Summary collapse

Constructor Details

#initialize(track_name, opts = {}) ⇒ Scorer

Returns a new instance of Scorer.



8
9
10
11
12
13
14
# File 'lib/gfobh_scorer/scorer.rb', line 8

def initialize(track_name, opts = {})
  @track_name = track_name
  @stdout = opts[:stdout] || STDOUT
  @stderr = opts[:stderr] || STDERR
  @config = opts[:config] || {}
  @current_example = 1
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gfobh_scorer/scorer.rb', line 16

def run
  # grab our inital seed value for this example se
  curr = fetch_initial_seed

  # loop through til we get a wrong answer (curr is false) or
  # we have reached the end (curr is true)
  while (curr = run_current_example(curr)) && is_seed_value(curr)
    report_success
    @current_example += 1
  end

  report_results(curr)
  curr
end