Skip to content

Instantly share code, notes, and snippets.

@avescodes
Created June 15, 2009 16:48
Show Gist options
  • Save avescodes/130209 to your computer and use it in GitHub Desktop.
Save avescodes/130209 to your computer and use it in GitHub Desktop.
def process_nethack_log(log)
data = log.scan(/#{"(.*) "*15}(.*),(.*)/)[0]
fields = %W| version score dun_number dun_level max_level hp max_hp deaths end start uid role race gender alignment name ending|
results = {}
(0..16).each do |i|
results[fields[i]] = data[i]
end
results
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment