Cctoide wrote:
>I was wondering whether you use any special
>software to edit the rulesets.

An ex-Acka player asked me about this privately a couple of months ago,
seeking advice about how to keep records for a hypothetical new nomic.
Here's what I wrote about the ruleset:

  My primary record is the current FLR, which I maintain as (yet again)
  a plain text file which I edit manually.  I have no difficulty adhering
  to its fairly strict formatting, but probably other people would.
  I maintain the file under revision control using CVS.  (I may well
  switch to Subversion at some point.)  I publish the current FLR and the
  underlying RCS file, which goes back to when Michael became rulekeepor.

  I have a(nother) small Perl program which converts the FLR to the SLR.
  Publication of FLR and SLR are both triggered by cron jobs.

  To generate the historical rules record is a much more complicated
  undertaking.  A lot of complication comes from the fact that I have
  incomplete data.  If you're starting from scratch and recording
  everything, you can avoid much of what I have to do.

  The core of my historical rules system is a lengthy Perl program which
  takes as input assorted rulesets, seeks correlations between parts of
  the data, and generates structured output representing various aspects
  of the data.  By design it does not require a complete record; it allows
  any data to be missing, and will do the best with what it has.  It is
  also somewhat tolerant of inconsistent data, which is necessary because
  mistakes have been made in past recordkeeping that I have not been able
  to resolve.  The program also includes a large roster of known errors in
  previous ruleset publications, and it will use this to remove known-bad
  parts of the input.

  The main input to the rules program is the RCS record of the FLR.
  Every distinct version of the FLR is used as input.  I also have several
  historical published rulesets, predating the RCS record, from various
  archives that patchily cover most of Agora's history.  I also maintain
  some additional input files for data not covered by published rulesets:
  there is a file recording repeals, one for corrections of mistakes (where
  the corrected version was never published), and one for short-lived rule
  versions that didn't live long enough to be published.  These additional
  files are mainly a product of my research, but also get additions in
  the course of my rulekeeping duties concerning current rules.  They are
  plain text files that I edit manually.

  If I were rulekeeping for a new nomic from scratch, I'd organise it all
  the opposite way round.  I'd maintain as my master record a sequential
  list of all rule changes.  This record would only be appended to in
  the normal course of events; modifying or deleting existing data would
  happen only to correct a recordkeeping error.  Thus the file would be
  the complete and canonical historical record.  I'd generate the current
  ruleset for publication by a program that parses the historical record
  and keeps track of which rules haven't been repealed yet.  One of my
  historical rule files is actually in this form, of a sequence of rule
  changes: it covers a period of a few months in 1994 where there is
  (unusually) a complete mail archive to work from.

I'll just add to that that I have a small Perl program to do ruleset-style
paragraph filling for me.  Originally I used GNU fmt(1), as I do on
non-ruleset text (such as this message), and was tolerant of paragraphs
that exceeded 70 columns.  (Its fill width is somewhat unpredictable,
as it tries to make adjacent lines similar lengths.)  My special-purpose
program, which I call "afmt", never emits overlong lines and does plain
greedy filling.  Here's the code:

        #!/usr/bin/perl
        use warnings;
        use strict;
        while(<STDIN>) {
                print, next unless /\S/;
                my $inpara = $_;
                my $nextline;
                while(1) {
                        $nextline = <STDIN>;
                        $nextline = "" unless defined $nextline;
                        last unless $nextline =~ /\S/;
                        $inpara .= $nextline;
                }
                $inpara =~ s/\n\z//;
                $inpara =~ s/\t/        /g;
                $inpara =~ /(?:\A|\n)( *)[^\n]*\z/;
                my $prefix = $1;
                $inpara =~ s/([.!?])\n\s*/$1  /g;
                $inpara =~ s/\n\s*/ /g;
                my $outpara = "";
                while($inpara !~ /\A *\z/) {
                        $inpara =~ s/\A(.{0,69}\S|\S{70,})(?:\z|\s+)//;
                        $outpara .= $1."\n";
                        $inpara = $prefix.$inpara;
                }
                print $outpara;
                $_ = $nextline;
                redo;
        }
        exit 0;

-zefram

Reply via email to