From f8b30c1ec6e8d8a6a4b322a2ee19521b4d5d0c70 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 25 Jun 2017 07:12:05 -0400 Subject: [PATCH] Proof of concept for Section 3 report generator. --- travel.py | 701 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 701 insertions(+) create mode 100755 travel.py 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 -- 2.31.1