 
   say('play', "Waiting for processes to settle")
 
+  def = Q.defer()
+
+  d = _.after(MATCHES.length, () ->
+    def.resolve()
+  )
+
   setTimeout(() ->
     say('play', "Starting all matches")
     _.each(MATCHES, (match) ->
       p1 = PARTICIPANTS[match[0]]
       p2 = PARTICIPANTS[match[1]]
 
-      run_match(p1, p2)
+      run_match(p1, p2, d)
     )
   , 1000)
+
+  def.promise
+).then(() ->
+  winners = _.chain(PARTICIPANTS)
+             .each((p) -> p.proc.kill('SIGKILL') )
+             .sortBy((p) -> -p.score)
+             .map((p) -> [p.name, p.score])
+             .value()
+  console.log()
+  console.log()
+
+  console.log("Results:")
+  _.each(winners, (w) ->
+    console.log("#{w[0]} won #{w[1]} matches")
+  )
+
+  process.exit(0)
 )

get_cmd = (p, game_state, player_state) ->
  "coffee botResponder.coffee --bot '#{p.file}'"

run_match = (p1, p2) ->
  p1.state = {}
  p2.state = {}



  g = new Game([p1.name, p2.name], true)
  g.run((result) ->
    p1.score += result[0]
    p2.score += result[1]

    if (result[0] == 0.5)
      say("results", "Tie!")
    else if (result[0] == 1)
