Skip to content

Commit

Permalink
Small cosmetic code improvements
Browse files Browse the repository at this point in the history
* Some comments have been updated to describe their respective procedures more accurately.
* `g-confidence` is now always reset to 0 when scientists are not converged.
* This allowed for a slightly more concise formulation of the `average-confidence` reporter.
  • Loading branch information
daimpi committed Nov 11, 2017
1 parent 6f3355a commit 1b95229
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions protocol.nls
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ to-report exit-condition
]
][
set converged-ticks 0
if ticks >= max-ticks [
set g-confidence 0
if ticks >= max-ticks [
set-converge-reporters-values
report true
]
Expand Down Expand Up @@ -246,7 +247,8 @@ end


; reports the last time-point scientists converged. The + 1 correction is due
; to the way how `converged-ticks` is set.
; to the assumption that this reporter is called after `exit-condition` had a
; chance to update `converged-ticks`
to-report round-converged
report ticks - converged-ticks + 1
end
Expand Down Expand Up @@ -337,14 +339,10 @@ end



; reports the average confidence of scientists; if scientists haven't
; converged it reports 0
; reports the global confidence of scientists at the point of convergence
to-report average-confidence [rec?]
let identifier "avgconfidence"
ifelse rec? [
if ticks >= max-ticks and not converged [
report (list identifier 0)
]
ifelse rec? [
let avg-confidence g-confidence
report (list identifier avg-confidence)
][
Expand Down

0 comments on commit 1b95229

Please sign in to comment.