+var game_timer;
+
+const levels = [
+ {
+ title: "Calibrate the Trans-Dimensional Field Accelerator",
+ words: [
+ "What", "was", "the", "year", "of", "Coda's", "birth?"
+ ],
+ answer: 2098
+ },
+ {
+ title: "Reverse the Polarity of the Neutrino Flow Coil",
+ words: [
+ "How", "many", "years", "had", "Zombo.com", "been", "running",
+ "when", "Coda", "sent", "the", "message", "you", "first",
+ "received?"
+ ],
+ answer: 123
+ },
+ {
+ title: "Give a good whack to Hydro-chronometric Energy Feedback Retro-stabilizer",
+ words: [
+ "What", "is", "the", "sum", "of", "Cameron's", "age", "plus", "Andrew's", "age", "at", "Christmas", "time", "the", "year", "when", "Hyrum's", "age", "is", "25", "years", "older", "than", "Scott's", "age", "will", "have", "been", "when", "Scott's", "age", "will", "be", "half", "of", "Dad's", "age?"
+ ],
+ answer: 111
+ },
+ {
+ title: "Disable the Fragmentary Spatio-temporal Particle Detector",
+ words: [
+ "What", "is", "the", "product", "of", "the", "last", "three", "numbers?"
+ ],
+ answer: 28643994
+ }
+];
+
+var show_word_interval;
+
+function show_word() {
+ const tardis = state.tardis;
+ const room = "room-" + (tardis.word % 4).toString();
+ const word = levels[tardis.level].words[tardis.word];
+ io_tardis.to(room).emit('show-word', word);
+ tardis.word = tardis.word + 1;
+ if (tardis.word >= levels[tardis.level].words.length)
+ tardis.word = 0;
+}
+
+function start_game() {
+ const tardis = state.tardis;
+
+ tardis.state = "game";
+ tardis.level = 0;
+ tardis.word = 0;
+
+ // Let all companions know the state of the game
+ io_tardis.emit("level", levels[tardis.level].title);
+ io_tardis.emit("state", tardis.state);
+ show_word_interval = setInterval(show_word, 1200);
+}