Archive for the ‘Uncategorized’ Category

Metalexicon

Thursday, December 1st, 2011

I’m planning on running an “alternative metahistory” game in three levels, with two groups (potentially three if we’re crowded) of players.  This is an experiment with canon, the history of history, and recontextualization.

The overview of the game is that it consists of three subgames.   I will explain them here, initially in a sequential format.  If you haven’t read the last post explaining the game of Lexicon, do so now.

  1. The first group of players (the Historians) will play a game of Lexicon, describing a situation somehow affecting their present.
  2. The second group of players (the Metahistorians) will play a different group of historians in the future of the world described by the first group.  Their work is the study of the Historian group, examining their biases, historical inaccuracy, and generally explaining why and how they managed to get everything all wrong.  They will write a metahistorical work, annotating the original lexicon (the Annotations).  The second group is for some reason better aware of what was actually going on, and explains this at length.  For an interesting ‘historical’ bent to change creative processes, the second group of players will have the Lexicon gradually revealed as more historical evidence is ‘dug up’.
  3. The third group of players will play a simple RPG set in the same time period as the first group.  They will have access to the unannotated Lexicon created by the first group, but the lexicon created by the second group will be treated as describing the actual state of the RPG world.

I played with various interesting ways to set up the groups, including collapsing groups, running things simultaneously, and messing with information flow.  I decided one week- to month-long worldbuilding phase with two groups (1+2), and an indefinite-length RPG running with one of the two groups afterwards (3):

  1. First, one group of players (the Historians), will play Lexicon.
  2. Second, the Metahistorians will play a simultaneous game of Metalexicon with the first Lexicon as source material, creating the Annotations or Metahistory.  The Lexicon will be released to them on a slightly delayed basis (probably three days or so) to allow for some groups skipping days.
  3. I think the most fun option for the RPG is to have the original Historians play after the Annotations are completed, with the gamemaster having read the Annotations.

Lexicon

Thursday, December 1st, 2011

How to Play Lexicon

I found this game floating around the depths of the internet.  Sadly, the original page is only on Wayback, so I thought I’d re-write (a variant of) the rules here.

From the original rules:

The basic idea is that each player takes on the role of a scholar, from before scholarly pursuits became professionalized (or possibly after they ceased to be). You are cranky, opinionated, prejudiced and eccentric. You are also collaborating with a number of your peers — the other players — on the construction of an encyclopedia describing some historical period (possibly of a fantastic world).

The owner of the wiki should set the general subject of the Lexicon. I suggest that he or she make use of the technique of “open reference” when describing the historical period: “You are all revisionist scholars from the Paleotechnic Era arguing about how the Void Ghost Rebellion led to the overthrow of the cyber-gnostic theocracy and the establishment of the Third Republic.” What a cyber-gnostic theocracy is, or what happened to the first two republics, or what the Paleotechnic Era is are all unknown — they are named to specifically to evoke a mood and inspire the other players’ creativity.

  1. Each player starts on a different letter of the alphabet – say the first letter of their name.
  2. An index for the lexicon is created, listing the titles of all the articles in the lexicon.  A wiki is suggested as a good medium in the original because of cross-linking.  If there are 6 players, there will be 6 slots for each letter in the alphabet (6 slots under A, 6 under B, etc.).  A slot can be empty, it can be a ‘phantom article’ (title but not yet any content), or it can be a full article.  Player are allowed to call ‘dibs’ on up to one phantom article at a time.
  3. Each turn (there are 26), each player writes an entry in the lexicon.  Each turn is associated with a letter.  If your name is Za3k, you will use the letter ‘Z’ the first turn, ‘A’ the second turn, ‘B’ the third turn, etc.  I predict scheduling will work out more easily if everyone starts on a different letter.
  4. On your turn, you can either add a flesh out a phantom article starting with that letter into a full article by adding content, or you can write a new full article if there are empty slots.  On the first turn, you always write a full article.  When writing a full article, you should choose a title beginning with the letter for that turn, and then write the article on that subject.
  5. Articles should be 100-200 words, and you sign your name at the end.
  6. At the end of an article, you cite two forward references to as-yet-unwritten articles in the lexicon.  If using a wiki, hyperlinks/wikiwords can be used in place of citations.  These phantom articles may already exist, or you may add them to the index as you make the citation (your choice).  One forward reference should be earlier in the alphabet, and one later in the alphabet.  (If the turn is A or Z, do two references earlier/later instead)
  7. Also, at the end of the article you should cite another article which has already been written, assuming it’s not the first turn.
  8. It’s an academic sin to cite yourself, you can never cite an entry you’ve written.
  9. Despite the fact that your peers are self-important, narrow-minded dunderheads, they are honest scholars. No matter how strained their interpretations are, their facts are accurate as historical research can make them. So if you cite an entry, you have to treat its factual content as true! (Though you can argue vociferously with the interpretation and introduce new facts that shade the interpretation.)

New language fluency test

Sunday, July 31st, 2011

Shannon tested and found the “the enormous implicit [...] statistical knowledge of” the English language most people have.  His measure, predictability of the next letter given the previous 100 letters seems like a universal, simple, and objective measure of how well one knows a language not specifically dependent of spelling rules, vocabulary, grammar, understanding, and idioms.  It could be used to measure fluency in place of ESL tests, and I probably will use it when learning foreign languages to measure improvement, etc. from now on.  Probably should be used to represent the difficulty of languages as well.

GPG Key

Wednesday, May 11th, 2011

http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x7A86A2D5D55D7CF8

—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: SKS 1.1.0

mQENBE3K908BCADRjSSFXnXjY1jI0b8VEmHQ7KvfQ5xNsbVh11uLkFlPwzSrtXbeXhAsSdoH
TM5LhRGaxiEZAnkcb6hA4kIn70as5a1OgMTEVEvL1/CZBCDeOSrk9guVGvLvbBQ6h8jVYhoF
63GpguYkNEmJSmC84TyMMgTd0ujoEtDfvhxV/fCsrkQVcJO8y6SH5M+uKgNAlJdak0EdaEBd
MiX89/EQVGX4XP03HMYoUZGzFvbFx+VaQnY4s3R7yNgzQqhdkpaYLrlOHBNnmuIgSpKwEEJ/
P3Ou5/8fanY59/1HnYB7nRAFCe0AFj1bJyqKu8NU3lMyDaEF6xuQSUOzp2yiSOSTynWBABEB
AAG0IVphY2hhcnkgVmFuY2UgPHZhbmNlemFAZ21haWwuY29tPokBPgQTAQIAKAUCTcr3TwIb
AwUJAHanAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQeoai1dVdfPgJTQf8DhXvbsKJ
5ti69uYTSJzd8HmFU3QtGmZ7wtV4gEVSc/H2cmkHVcdtI9mFt/L3TVCXSXDWyRJV8f12OHyq
JyU6WTfkYiqSBdFAzUqkMlu8FaFhXI4yqFyN+eoefmkcUhWS8CgKLX+5LTgQEuTRq1FHLVxH
uTf3G3JeqPeeYqx9i3GuJDSTV6gyJWKkT+z+2r3aGCTqtHiCgpTPdizYMxH5QBoCfv6AMttM
Y25MpSWOLcr3/HkoyvYe8afdtl5MQbYHySwFuT0KAt3EZTEVsvB6cb1XO3mYHZmDNT8Ur/r+
CPDP1J5/mPeAfY68VqcPULuMT34hGlcYvp/6Ewa5X2j7ObkBDQRNyvdPAQgAl2ob8qpshTu6
mEgyu3ekZ8ecDJnqLyOuthYCMdZ3eWxo0Dqo+qiZPrqDuOQ4IPLOZAfC7O8sjvUE9T2kXKtz
PIjMg+noX063Q10FNz2VpUQG/LJhD3VQbZiw9erdwXW1TlCaqtBlpOKgEucNsiZzDftEKAeS
JvFc4LkncDnMR+stxHqlc8I0fkR/M2MDRKh98Ivqvqr8ozAkEqdmJypXFfaMof1k2fDGeEU4
tMbSEYev4qayWjXgamdGTIfnfINtIiu6ZhdH4Q/C4k1SqrmFmSFwM+IUylk+mhgGfCSn9UsC
aoSWULoYi5mmVv9/ry8mKw+oofq4tZKdfo41dbymBQARAQABiQElBBgBAgAPBQJNyvdPAhsM
BQkAdqcAAAoJEHqGotXVXXz4B78IAJWklSpfpAtYu5+ApSBCwnCj3ZFaHJZ3YQpLCx07NXQh
yxTQkv5YgB0HsxXVDidNwkj3JH8pmArI2YHIKM6Xq0Pr5P663yb/V14PY+AZQv2KfqjdgU01
TVm0sF1rIhOH6JF9ARje7gEzj1o3k2+X85tOQDDNYjFmY+VXQPuAsN5UTER2Hr6sXqFXbGpf
I+EAAL6iL7tuE/Ju/uvKvCLB/AxcDHgo1YgLc5x9Njeal0QgqjdLXZUbXHHvk0QjQ4LdxDzw
pybDL4H6MMh1kWDh92gIDk1R+FPTfM148Tsu26bknyrKlyG02EcDth6inbesIKiEBKtRpl3O
+8G9l//E53A=
=v5QJ
—–END PGP PUBLIC KEY BLOCK—–

I live.

Tuesday, February 8th, 2011

So, I’ve always made sure on this blog to post on a strict basis of “when I have something interesting to say”, which means it didn’t get updated often.  However, the last year or two has been tremendously exciting for me, and I’ve done lots of self-experimentation, learning, research, and even my personal life might be interesting to blog about.  In fact, I’ve been so distracted, I didn’t blog about any of it.

I’ve spent a lot of my time lately relating what I’ve been doing to other people, so I guess that people find it interesting.  In an effort to save time, and so people not in my immediate social circle can get my experimental data, I’m going to try to debrief–post all of this backlog online.  Probably the hardest part will be coming up with a list of topics, so if there’s anything I should blog about, contact me or add a comment with the topic here.

How to write a compiler generator

Wednesday, February 10th, 2010

http://www.cubiclemuses.com/cm/blog/archives/000419.html/

I read this article recently.  It talks about how to use a partial evaluator to write a compiler generator (a program that transforms an interpreter for a language, into a compiler for that language).

Now, while I don’t have a partial evaluator, I do have a compiler generator, PyPy.  It takes an interpreter written in RPython, a subset of Python, and makes a compiler out of it.  This is fine, except what if I prefer not to use RPython, but my language of choice?  Say I’m working in Scheme.  If I get:

  1. A Scheme -> RPython compiler written in RPython
  2. A Scheme interpreter written in Scheme

Then by running (1a) with the code to (2a), I get a Scheme interpreter written in RPython.  PyPy converts this to a Scheme compiler to any bytecode PyPy supports.

Let’s assume PyPy can compile to RPython, in particular (I do not know that this is true, but if it’s not, it’s useful enough to be worth writing).  Then if we write a Scheme interpreter in RPython, we can use PyPy to get (1) directly.  Start with any version of Scheme, Scheme1, then all I really need is to write a Scheme1 to RPython compiler.   Then, write (2b), a Scheme2 interpreter in Scheme1.  Running (1a) with (2b) gives us a Scheme2 -> anything compiler.  In particular, it gives us (1b), a Scheme2 -> RPython compiler.  And we can use this to take a Scheme3 interpreter written in Scheme2 and get a Scheme3 -> RPython compiler, and so on.  Eventually, we opt to compile to bytecode rather than RPython, and get a Scheme3 -> Bytecode compiler in addition.  So basically, we start with

  1. A Scheme1 interpreter, written in RPython
  2. A Scheme2 interpreter, written in Scheme1
  3. A Scheme3 interpreter, written in Scheme2 (and so on)

And we can get a bytecode compiler for Scheme3, with only PyPy, an RPython -> Bytecode and RPython -> RPython compiler generator.

This is to say the least, fairly neat.  Now, remember that we don’t have to write interpreters the hard way.  So here’s an interesting option–use eval.  Then, we can add just one tiny feature (say, writing a function or macro to be a new keyword), and we can take our two old programs, the two compilers PyPy generated at the last stage, and get a new pair of compilers (one RPython, one bytecode).

Of course, we don’t really care directly about the RPython compiler.  One possibility is to wrap this somehow.  We could easily write a
“compiler generator N” wrapper function that takes as arguments the new SchemeN+1 eval function, as written in SchemeN, and a SchemeN->RPython function, runs things through PyPy, and outputs a SchemeN+1 RPython compiler and a SchemeN+1 bytecode compiler.  Now, just hide the RPython compiler input and output in global variables somewhere in the compiler itself (okay, it’s actually a bit harder than I make it sound), and you have new new built-in, compiler-generator.  It takes as arguments a replacement eval function, and outputs a compiler (with the compiler-generator function updated to use the new global variable, and thus accept eval written in the new language).  Using compiler-generator it’s a few lines to redefine lambda or macro so that they output a new compiler with that function or macro as a keyword!  Happy hacking,

-Za3k

Objects in Scheme

Friday, January 29th, 2010

Last night, I hacked up an object system in scheme.  I’ve been meaning to learn one, and but somehow I ended up writing one instead.  It is currently rather Pythonesque, but can be subtly modified to give a number of object system I find interesting.  It is most suitable for flexible duck typing, in my opinion.

The starting object system is very basic – there is no inheritance.  You can dynamically assign attributes and methods.  If you assign a method, it binds the first argument of the method to the object–denoted “self” in Python, or “this” in C++ based languages.  You can freely reassign both, but there’s currently no support for deleting.

So, it’s basically a dynamic version of ‘struct’.  We could have a version that doesn’t allow modifying methods (only adding them).  This would mean any object that “inherited” from an earlier version would be guaranteed to have not only the same methods as is true right now, but also the same versions of those methods.  This is a somewhat interesting type system–it’s monotonic in a sense.  If we disallow even modifying methods, we ‘freeze’ the class and get a static interface.

If we disallow adding new attributes or adding or modifying methods, we get something like a static struct.  If we disallow any changes, we freeze the struct into a single, nonmodifiable object.

By adding a “derive” operation (perhaps used by calling the object itself, with no arguments), we can add prototyping.  An object looks for an attribute in its current namespace.  If it’s not there, it looks in the parent object.  If we start allowing methods to be deleted, we can decide that a child object no longer implements the same interface.  This is not inheritence any more, but could allow more efficient implementation for the programmer (a la “private” inheritance in C++ or the “not defined” I’ve heard the Gang of Four reference in Smalltalk).

The biggest thing I’d like to add personally is this derivation I mention, and deletion of at least attributes.

Objects with optional mutation in Scheme
  1. ;An object has one special method, "call-method", which is called when the object is invoked as a function.
  2. ;All methods including call-method may or may not mutate the object.
  3. ;Attributes are accessed like (dot obj attribute-name).
  4. ;Methods are accessed like (dot obj method-name) — this returns the (bound) method
  5. ;Attributes and methods are modified or set with dota and dotm, which return a modified object without changing the original object.
  6. ;Attributes and methods are dota! and dotm! do the same thing, except that they modify the original object and return it.
  7.  
  8. (define (remassq obj list) (remq (assq obj list) list))
  9.  
  10. (define (make-object)
  11.   (letrec ([make-object-raw-helper (lambda (self attributes methods)
  12.                                      (lambda function-and-args
  13.                                        (if (null? function-and-args)
  14.                                            (begin (error "Object cannot be called as a function") #f)
  15.                                            (let ([function (car function-and-args)]
  16.                                                  [args (cdr function-and-args)])
  17.                                              (cond [(and (eq? function 'dot) (= (length args) 1))
  18.                                                     (let ([attr (assq (car args) attributes)])
  19.                                                       (if (list? attr)
  20.                                                           (second attr)
  21.                                                           (let ([meth (assq (car args) methods)])
  22.                                                             (if (list? meth)
  23.                                                                 (let ([unbound-method (second meth)])
  24.                                                                   (lambda (parameters) (unbound-method self parameters)))
  25.                                                                 (begin (error "Invalid attribute.") #f)))))]
  26.                                                    [(and (eq? function 'dota) (= (length args) 2))
  27.                                                     (make-object-raw (cons args (remassq (car args) attributes)) (remassq (car args) methods))]
  28.                                                    [(and (eq? function 'dotm) (= (length args) 2))
  29.                                                     (make-object-raw (remassq (car args) attributes) (cons args (remassq (car args) methods)))]
  30.                                                    [(and (eq? function 'dota!) (= (length args) 2))
  31.                                                     (set! attributes (cons args (remassq (car args) attributes)))
  32.                                                     self]
  33.                                                    [(and (eq? function 'dotm!) (= (length args) 2))
  34.                                                     (set! methods (cons args (remassq (car args) methods)))
  35.                                                     self]
  36.                                                    [(eq? function 'initialize-self!) (set! self (first args)) self]
  37.                                                    [else (error "Object cannot be called as a function") #f])))))]
  38.            [make-object-raw (lambda (attributes methods) (let ((obj (make-object-raw-helper 'dummy attributes methods)))
  39.                                                            (obj 'initialize-self! obj)))])
  40.     (make-object-raw '() '())))
  41.  
  42. (define (dot obj attribute-or-bound-method) (obj 'dot attribute-or-bound-method))
  43. (define (dota! obj attribute-name attribute-value) (obj 'dota! attribute-name attribute-value))
  44. (define (dotm! obj unbound-method-name unbound-method-value) (obj 'dotm! unbound-method-name unbound-method-value))
  45. (define (dota obj attribute-name attribute-value) (obj 'dota attribute-name attribute-value))
  46. (define (dotm obj unbound-method-name unbound-method-value) (obj 'dotm unbound-method-name unbound-method-value))

There are two downsides of the system that I don’t see a way around.  First, you can’t use the object like a function.  To allow this, we’d have to disallow passing certain symbols as the first argument, which is extremely clunky (see code below to understand why).  Second, I’d much prefer the operator to be . rather than “dot”, but that’s a reserved word in Scheme.  It’s not used for much, so that’s rather annoying.  .a and .m would are allowable, but for consistency they’re dota and dotm here.  If anyone knows a way to allow calling the object like a function, please let me know.

Portable, Virtual Me (Part 1)

Saturday, September 12th, 2009

I recently purchased a flash drive.  Surprisingly, I still have it; probably won’t last long.  I wanted to put all my data on it and be portable.  Unfortunately, this wouldn’t let me keep my installed programs or settings, and so forth.  Ideally, I’d like to keep everything down to the applications I have running.  Virtual computing lets me do that.  Specifically, I’d like to

  • Have one copy of my data, for space and synchronization.  This should be accessible quickly in one format by all operating systems; no networking, and I picked FAT32.
  • Have several operating systems I can copy like files, and which are machine-independent.  Running an OS in a virtual machine means that even when I switch computers, it seems the same hardware.  This is nice for Linux and vital for Windows, which doesn’t like switching computers.
  • Be able to version my data and optionally my operating system.
  • Ideally, be able to run more than one OS at a time.  I’m lazy, and prefer to do things the easiest way possible.  Also, running stuff on two computers could again cause sync issues.
  • Be able to work offline.  This means I need to carry it, not have it on a server somewhere.  Of course, I can still use a remote server if I need computing power (I’ve been itching for a netbook); it’s just an option.

For those of you who may not know, a virtual computer is a program that acts like a generic computer emulator.  It runs virtual hardware, on which you can install an operating system, insert CDs, etc.  Setups can be a little more flexible this way, of course.  To add a hard drive, you can just tell the program to use a specific file.  A friend recommended I try VirtualBox, which can do almost everything I need.  It’s put out by Sun and will run on most major operating systems.  (Unfortunately, it’s doesn’t have full support for FreeBSD and some other linux Distros). There’s a closed- and open-source version; the closed-source version adds a “remote desktop” type feature and USB support.  Since I want to run this on a USB drive, I need to use the closed-source edition until open-source catches up.  This is not big problem for me since I don’t compile from source and don’t have any hangups about whether something is open-source or not.

This means I need installs for virtualbox on the USB drive (sadly, it does need to install on the OS, since to emulate hardware at a reasonable speed (near real-time) requires kernel-level methods.  Also, I’d like to be able to run something off *only* the USB drive, so I want to add a bootable OS that can run VirtualBox and a windowing system for display.  I don’t need much else, and since space is at a premium, I installed a minimal version of Ubuntu (FreeBSD doesn’t support some advanced features).

I have a Ubuntu virtual machine as well now.  After I pick up probably Windows XP and some dialect of DOS (maybe FreeBSD or Win 98 too), that’s about everything I need.  Right now, XP and Ubuntu would match my current setup, so that’s my goal.  Unforunately, the virtual machine files, installs, etc. need to go on a FAT32 partition of the drive I can’t get XP to see right now.  I wonder if it’s formatted?

Last, I need to move a data directory onto the drive.  It’ll be shared between the operating systems to keep everything in sync, and so I can automatically version the machines seperately from my files.  Also, on one machine I’ll need to setup some kind of backup mechanism.  I’m thinkin rsync or more likely rdiff-backup.

So my checklist is:

  1. Select and install a virtual computing program.  Done: VirtualBox is installed on Vista (my laptop) and Ubuntu (the flash drive).
  2. Create a bootable flash drive with a data area.  Bootable done.  Data might or might not have worked, though, so we’ll see.
  3. Copy data and virtualbox installs to drive.
  4. Create virtual machines (Ubuntu, Windows XP, DOS 6 / FreeDOS, FreeBSD, Win98 in order of priority).  Make sure supports add-ons (cool drivers which interact with the “guest” operating system, allowing things like shared mouse, shared windowing system, shared clipboard, etc.).  I’m using these right now before I make the other virtual machines, but I’ll have to add them to everything and get stuff working more smoothly.
  5. Allow virtual machines to access data folder.  Since I didn’t seperate the partitions, this means virtual machines could modify their own files and virtualbox.  However, since the other steps involve partitioning a flash drive and so forth, this seemsless scary in comparision.
  6. Add backups.

(Not Currently) At Work

Monday, August 31st, 2009

For the past three months or so I’ve been programming 99% of the time in C++ (I had a recent excursion to perl to autogenerate some code).

I now know much, much more than I ever expected or wanted to know about C++.  To give you a sample, here are the books I bought for work:

Also, I plan to learn Ruby, but I’m having trouble finding a good tutorial (that is, a tutorial for non-beginners).  Please comment with any recommendations.

Learning Java and a Scheme program

Thursday, April 16th, 2009

In answer to my last post I encountered this interesting snippit:

Can you figure out what it does? Why it does it?
  1. (let* ((yin ((lambda (foo) (newline) foo)
  2.              (call/cc (lambda (bar) bar))))
  3.        (yang ((lambda (foo) (write-char #\*) foo)
  4.               (call/cc (lambda (bar) bar)))))
  5.  (yin yang))

In other news, due to this that and the other, I have to learn Java.  So far, I’ve not learnt much.  I’ve found out two interesting things.  First, threads are remarkably easy to make.  Now, I’ve never done threading before, so I’m wondering how easy it is to do in other languages I’ve used.

Second, Java code is far too long.  I’ve always been annoyed with “code generation” features for just this reason.  If you need to generate code, you’re doing something wrong, IMO.  Code completion, (as in function parameters and variable names) is fine since that’s for human legibility and saves typing.  But generating whole skeletons?  Puh-lease.

Kinda turned me off C# before I took a good look at it (one of these days, I tell you).