Executes BerryBots matches and returns the results. Matches are queued asynchronously and run multi-threaded.
||Checks if the match queue is empty.
||Returns the next available match result.
|queueMatch (stage, ships)
||Queues a match.
||Saves the replay from the previous result.
||Sets the number of threads.
||Specifies the results of a BerryBots match.
||Specifies the rank, score, and statistics for a ship or team.
- empty ()
Checks if the match queue is empty.
true if the match queue is empty,
- nextResult ()
Returns the next available match result. This is a blocking call - it waits until the next match result is available.
The next available match result, or
nil if there are no matches queued.
- queueMatch (stage, ships)
Queues a match. This is a non-blocking call - it returns immediately. To block and wait for the next available match result, see
stage: The filename of the stage - e.g.,
ships: A table of one or more ship filenames - e.g.,
- saveReplay ()
Saves the replay from the previous result. Replays are HTML5 and should be viewable in most modern browsers.
The filename of the replay in the BerryBots replays directory, or
nil if no replay was saved.
- setThreadCount (threadCount)
Sets the number of threads. This is the maximum number of BerryBots matches that will be run in parallel. This should probably be less than or equal to the number of CPU cores on your system.
threadCount: The number of threads.
- Specifies the results of a BerryBots match.
stage: The filename of the stage.
errored: Whether the match was aborted due to errors.
errorMessage: A message describing the error, or
nil if the match completed successfully.
winner: The filename of the ship program that won the match. If no winner is set, the winner is set to the team with rank
nil if there is no such team.
teams: A table of
TeamResult tables with the score details for each ship or team.
- Specifies the rank, score, and statistics for a ship or team.
name: The filename of the ship or team.
rank: The rank of the team, or
0 if no rank was set. E.g.,
1 if this team was the winner. If no ranks are set by the stage, ranks are set according to highest scores.
score: The score of the team, or
nil if no score was set for any team in the match.
stats: A table with key/value pairs of statistics for this team, or
nil if no statistics were set.