Hot poatato

var expire = 0;
var tosses = 0;

async function startProgram() {
setStabilization(false);
await speak(‘Welcome to hot potato’, true);
while (true) {
expire = getRandomInt(5, 25);
while (!(tosses > expire)) {
setMainLed({ r: 255, g: 0, b: 16 });
await rawMotor(0, 255, 0.1);
await Sound.Game.Abrupt.play(true);
if (Math.sqrt((getAcceleration().x ** 2) + (getAcceleration().y ** 2) + (getAcceleration().z ** 2)) > 3) {
await strobe({ r: 255, g: 231, b: 0 }, 0.2, 1);
tosses = tosses + 1;
}
await delay(0.025);
}
await delay(1);
await Sound.Game.YouLose.play(false);
setMainLed({ r: 235, g: 255, b: 0 });
await rawMotor(255, 255, 2);
await delay(1);
await speak(‘You’re out!’, true);
tosses = 0;
exitProgram();
await delay(0.025);
}
}