mygame/lib/mygame/boot.rb

require 'mygame'
include MyGame
init_game

END {
  unless $! or ran_loop?
    exit(main_loop || 1)
  end
}