Skip to content
copton edited this page May 13, 2011 · 2 revisions

== Interface to user-provided player

Give player 5 seconds per move without race conditions

  • Player actor receives request to make next move
  • request is added to a fifo queue
  • extra thread continuously blocks on the queue head and calls nextMove
  • within nextMove user-provided player frequently updates the improved next move
  • within nextMove user-provided player frequently calls checkpoint function that reports if timeout has been reached
  • nextMove is supposed to return soon if timeout has been reached or computation is done.
  • any delay reduces the time available for the next move!
  • if queue is not empty reported moves are ignored (user player is delayed)
  • after 5 seconds
  • the timeout flag is set, i.e. checkpoint function reports timeout
  • the latest reported move is sent back to the game actor
  • Game actor sends SIGSTOP to player’s JVM
  • Game actor sends SIGSTART to other player’s JVM
  • Game actor sends request to make next move to other player
  • loop

Clone this wiki locally