Minor fix for simulator logic

This commit is contained in:
Michael Schmatz 2014-06-06 12:18:00 -07:00
parent 51f7aa1743
commit 24452026d1
2 changed files with 4 additions and 4 deletions

View file

@ -85,7 +85,7 @@ module.exports = class Simulator extends CocoClass
console.log "Processing results:", taskResults
humanSessionRank = taskResults.sessions[0].metrics.rank
ogreSessionRank = taskResults.sessions[1].metrics.rank
if @options.headlessClient
if @options.headlessClient and @options.simulateOnlyOneGame
if humanSessionRank is ogreSessionRank
console.log "GAMERESULT:tie"
else if humanSessionRank < ogreSessionRank
@ -96,8 +96,6 @@ module.exports = class Simulator extends CocoClass
else
@sendSingleGameBackToServer(taskResults)
@cleanupAndSimulateAnotherTask()
sendSingleGameBackToServer: (results) ->
@trigger 'statusUpdate', 'Simulation completed, sending results back to server!'
@ -239,7 +237,8 @@ module.exports = class Simulator extends CocoClass
sendResultsBackToServer: (results) ->
@trigger 'statusUpdate', 'Simulation completed, sending results back to server!'
console.log "Sending result back to server:", results
console.log "Sending result back to server:"
console.log JSON.stringify results
if @options.headlessClient and @options.testing
return @fetchAndSimulateTask()

View file

@ -19,6 +19,7 @@ options =
exitOnLeak: false # Exit if leak is found. Only useful if leaktest is set to true, obviously.
heapdump: false # Dumps the whole heap after every pass. The heap dumps can then be viewed in Chrome browser.
headlessClient: true
simulateOnlyOneGame: simulateOneGame
options.heapdump = require('heapdump') if options.heapdump
server = if options.testing then "http://127.0.0.1:3000" else "https://codecombat.com"