MikeTaylor / scottkit

Scott Adams adventure toolkit: compile, decompile and play 80s-style adventure games
30 stars 10 forks source link

Wrap use of `decompile` to resolve entity-names #22

Open MikeTaylor opened 6 years ago

MikeTaylor commented 6 years ago

As noted in PR #16, the play function in the top-level scottkit program invokes decompile (discarding its output) to force resolution of entity names in the same order that they will be resolved in decompilation:

def play(game)
  # Decompile (and discard result) to get entity names resolved in
  # right order.  This ensures that debugging output that uses these
  # names will use them in the same way as decompiler output.
  dummy = StringIO.new
  game.decompile(dummy)
  game.play
end

I need to look into this, figure out why it's happening, and (if necessary) make some kind of canonicalise_entites method that does this.