Back to Game Engine Challenge
Code Studio · Level 10

Game Rules

Write the rulebook. Conditional rules decide who wins, who keeps playing, and who still needs the key — your code is the referee.

15-20 min Ages 9-12 Real Code JavaScript
Code Editor

Check a win rule.

Example code
class Player {
  constructor(name) {
    this.name = name;
    this.items = [];
  }

  collect(item) {
    this.items.push(item);
  }

  hasItem(item) {
    return this.items.includes(item);
  }
}

let player = new Player("Bolt");
player.collect("star");

if (player.hasItem("star")) {
  say("Mission complete!");
} else {
  say("Keep searching for the star.");
}
Output

Program result

Robot ready to speak your strings

Type real JavaScript, then run it.