#!/usr/bin/env python3 # # Enhance adventure.yaml entries with explicit properties based on Section 3 # of adventure.text. # # This script is meant to be gotten right, used once, and then discarded. # We'll leave a copy in the repository history for reference # # When in doubt, make the code dumber and the data smarter. # # Here's the original format description: # # Section 3: Travel table. Each line contains a location number (X), a second # location number (Y), and a list of motion numbers (see section 4). # each motion represents a verb which will go to Y if currently at X. # Y, in turn, is interpreted as follows. Let M=Y/1000, N=Y mod 1000. # If N<=300 it is the location to go to. # If 300500 message N-500 from section 6 is printed, # and he stays wherever he is. # Meanwhile, M specifies the conditions on the motion. # If M=0 it's unconditional. # If 0 -1: genline(ln) ln += 1 sys.stdout.write(line) # end