/** This code runs the game in a different thread. */
  @Override
  public void run() {
    while (this.isRunning) {
      try {
        // Tell model to update, send next key press.
        // or 0 if no new keypress since last update.
        this.gameModel.gameUpdate(nextKeyPress());

        this.view.repaint();

        Thread.sleep(this.updateInterval);
      } catch (GameOverException e) {
        // we got a game over signal, time to exit...
        // The current implementation ignores the game score
        this.isRunning = false;
        System.out.println("Game over: " + e.getScore());
      } catch (InterruptedException e) {
        // if we get this exception, we're asked to terminate ourselves
        this.isRunning = false;
      }
    }
  }