mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 00:40:56 -05:00
Improve verifier.
This commit is contained in:
parent
0416528de0
commit
ceb64ce9ca
4 changed files with 49 additions and 20 deletions
|
@ -90,7 +90,7 @@ module.exports = class God extends CocoClass
|
|||
return if hadPreloader
|
||||
|
||||
@angelsShare.workQueue = []
|
||||
@angelsShare.workQueue.push
|
||||
work =
|
||||
userCodeMap: userCodeMap
|
||||
level: @level
|
||||
levelSessionIDs: @levelSessionIDs
|
||||
|
@ -103,8 +103,10 @@ module.exports = class God extends CocoClass
|
|||
preload: preload
|
||||
synchronous: not Worker? # Profiling world simulation is easier on main thread, or we are IE9.
|
||||
realTime: realTime
|
||||
@angelsShare.workQueue.push work
|
||||
angel.workIfIdle() for angel in @angelsShare.angels
|
||||
|
||||
work
|
||||
|
||||
getUserCodeMap: (spells) ->
|
||||
userCodeMap = {}
|
||||
for spellKey, spell of spells
|
||||
|
|
|
@ -2,24 +2,42 @@ extends /templates/base-flat
|
|||
|
||||
block content
|
||||
.container
|
||||
each test in view.tests
|
||||
each test, id in view.tests
|
||||
if test.level
|
||||
h2= test.level.get('name')
|
||||
small= ' in ' + test.language + ''
|
||||
div.well(style='width: 300px; float: right')
|
||||
if test.goals
|
||||
each v,k in test.goals || []
|
||||
case v.status
|
||||
when 'success': div(style='color: green') ✓ #{k}
|
||||
when 'incomplete': div(style='color: orange') ✘ #{k}
|
||||
when 'failure': div(style='color: red') ✘ #{k}
|
||||
default: div(style='color: blue') #{k}
|
||||
else
|
||||
h3 Running....
|
||||
if test.solution
|
||||
pre(style='margin-right: 350px') #{test.solution.source}
|
||||
|
||||
if !test.goals
|
||||
h2(style='color: orange')= test.level.get('name')
|
||||
small= ' in ' + test.language + ''
|
||||
else if test.isSucessful()
|
||||
h2(style='color: green')= test.level.get('name')
|
||||
small= ' in ' + test.language + ''
|
||||
else
|
||||
h4 Solution not found...
|
||||
h2(style='color: red')= test.level.get('name')
|
||||
small= ' in ' + test.language + ''
|
||||
|
||||
div.row(class=(test.isSucessful() && id > 1 ? 'collapse' : 'collapse in'))
|
||||
div.col-xs-8
|
||||
if test.solution
|
||||
pre #{test.solution.source}
|
||||
else
|
||||
h4 Solution not found...
|
||||
div.col-xs-4.well
|
||||
if test.goals
|
||||
if test.frames == test.solution.frameCount
|
||||
div(style='color: green') ✓ Frames: #{test.frames}
|
||||
else
|
||||
div(style='color: red') ✘ Frames: #{test.frames} vs #{test.solution.frameCount}
|
||||
|
||||
each v,k in test.goals || []
|
||||
if !test.solution.goals
|
||||
div(style='color: orange') ? #{k} (#{v.status})
|
||||
else if v.status == test.solution.goals[k]
|
||||
div(style='color: green') ✓ #{k} (#{v.status})
|
||||
else
|
||||
div(style='color: red') ✘ #{k} (#{v.status} vs #{test.solution.goals[k]})
|
||||
else
|
||||
h3 Running....
|
||||
|
||||
else
|
||||
h1 Loading Level...
|
||||
|
||||
|
|
|
@ -78,12 +78,21 @@ module.exports = class VerifierTest extends CocoClass
|
|||
@updateCallback? state: 'running'
|
||||
|
||||
processSingleGameResults: (e) ->
|
||||
console.log(e)
|
||||
@goals = e.goalStates
|
||||
@frames = e.totalFrames
|
||||
@lastFrameHash = e.lastFrameHash
|
||||
@state = 'complete'
|
||||
@updateCallback? state: @state
|
||||
|
||||
isSucessful: () ->
|
||||
return false unless @frames == @solution.frameCount
|
||||
if @goals and @solution.goals
|
||||
for k of @goals
|
||||
continue if not @solution.goals[k]
|
||||
return false if @solution.goals[k] != @goals[k].status
|
||||
return true
|
||||
|
||||
fail: (e) ->
|
||||
@error = 'Failed due to infinate loop.'
|
||||
@state = 'error'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
useEsper = false
|
||||
useEsper = true
|
||||
bowerComponentsPath = './bower_components/'
|
||||
headlessClientPath = './headless_client/'
|
||||
|
||||
require 'aether'
|
||||
# SETTINGS
|
||||
options =
|
||||
workerCode: require headlessClientPath + 'worker_world'
|
||||
|
|
Loading…
Reference in a new issue