X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=travel.py;fp=travel.py;h=6e7a8f0dd7a0fc51393e019be4734d70880a5acc;hb=f8b30c1ec6e8d8a6a4b322a2ee19521b4d5d0c70;hp=0000000000000000000000000000000000000000;hpb=8a6e6aae7d289c4f7d5c419aba5f39f5eb74fb08;p=open-adventure.git diff --git a/travel.py b/travel.py new file mode 100755 index 0000000..6e7a8f0 --- /dev/null +++ b/travel.py @@ -0,0 +1,701 @@ +#!/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