1
2
3
4
5
6
7
8
9
10
11
12
t = TrafficLight(); b = Button(); es = [];
b.onclick(function () {
t.red(); es.push(now());
if (es.length == 6) report(); else start();
});
start = function () {setTimeout(go, Math.random() * 3000)}
go = function () {t.green(); es.push(-now())};
report = function () {
print("Average: " + 0 + "ms");
print("Longest: " + 0 + "ms");
};
start(); "Ready...";