-
Notifications
You must be signed in to change notification settings - Fork 54
/
Evaluate.lua
37 lines (29 loc) · 891 Bytes
/
Evaluate.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--[[
Evaluate.lua
This script is used to evaluate how good an AI is on a track. It plays the AI for a
configurable number of runs, recording the finish time. It reports DNF if the AI fails to
finish the race and gets stuck.
]]--
--[[ BEGIN CONFIGURATION ]]--
local NUM_RUNS = 10
--[[ END CONFIGURATION ]]--
local util = require("util")
local play = loadfile("Play.lua")
local START_STATE_FILE = util.getTMPDir() .. '\\eval-start.state'
savestate.save(START_STATE_FILE)
client.unpause()
event.onexit(function()
client.pause()
savestate.load(START_STATE_FILE)
end)
print("Mode:", util.readMode(), "Course:", util.readCourse())
for i=1, 10 do
-- Start from the beginning and play.
savestate.load(START_STATE_FILE)
play()
if util.readProgress() >= 3 then
print ("Run " .. i .. ":", util.readTimer())
else
print ("Run " .. i .. ":", "DNF")
end
end