marnanel: (Default)
Today I decoded the secret competition questions from a 1984 Thames Television computer show. I still don't know the answers, but I'm probably a bit late to send in a postcard!

A friend pointed out this copy of Thames Television's 1984 Database programme, and wondered what the files transmitted over the closing credits are.



I took a look at the audio. All the signal is on the right channel, so I threw away the left. This is what the remaining channel looks like:
http://www.chiark.greenend.org.uk/~tthurman/thames/waveform.png

You can see that most of the signal is a lead tone, and there are two files each of four blocks. In fact the files have the same content, and they're both called THAMES.

Before I did any analysis on the waveform, though, I amplified it so that all peaks were at the same volume, on the grounds that the volume isn't significant. At first I tried to load these files into BeebEm. The trouble is that BeebEm doesn't take .wav files directly-- you have to convert them to a format called .uef-- and the conversion programs were reallyt finicky with noisy signals. And this signla is very noisy, having been transmitted over UHF, recorded on home video, and then digitised. In the end, I ended up writing my own demodulator based on the specs given here. Then I ran the file from the tape through Matt Godbolt's BBCBasicToText script, ,slightly modified not to give up around the occasional bit of noise.

Fortunately, the resulting file did not say "be sure to drink your Ovaltine".. BBCBasicToText doesn't implement target line number conversion, so those are missing, and as you see some noise remains. This has been an interesting diversion-- sort of like a cryptic crossword puzzle.

10MODE7:COLOUR129:CLS
20PRINT"Thames  Television"
30 PRINT"-------------------"
40PRINT:PRINT:PRINT"DATABASE COMPETITION"
50 PRINT:PRINT:PRINT:PRINT"Send solutions on a postcard only to:"
60PRINT:PRINT"    Database"
70PRINT"     THAMES TV"
80PRINT"      149 TOTTENHAM COURT ROAD"
90PRINT"       LONDON"
100PRINT"        W1P 9LL"
109 PRINT:PRINT:FOR"PRNOTLN SPACE BAR TO CONTINUE"
110 A$=GET$:IFA$="" THEN 110
111 IFA$<>" "THEN 110
120 MODE5
130COLOUR129:CLS
140PRINT:PRINT;
150FORI=1TO8:READA$:IFI=1 THENGOTO [...line...] ELSE [...line...]
160 COLOUR4:GOTO180
170 IFI=5THENCOLOUR3ELSE COLOURI
180PRINTA$;:NEXT
190COLOUR3=PRINT" COMPETITION"
195PRINT"--------------------"
200 PRINT:PRINT:PRINT:PRINT:PRINT
210COLOUR2:PRINTSPC( [... corrupt ...]
220COLOUR2:PRINTSPC(8);"4";
230COLOUR3:PRINT" *"
240COLOUR3:PRINTSPC(8);"* *"
250COLOUR2::PRINTSPC(6);"1";:COLOUR3:PRINT"******" 
260PRINTSPC(8);"* *"
270COLOUR2::PRINTSPC(6);"3";:COLOUR3:PRINT"******"
280PRINTSPC(8);"*"
290PRINT:PRINT:PRINT:COLOUR2:PRINT"1.";:COLOUR6:PRINT" Arresting pop       group1
300 PRINT:COLOUR2:PRINT"2.";:COLOUR4:PRINT"_ to me only" 
310PRINT:COLOUR2:PRINT"3.";:COLOUR4:PRINT" Four star           transport"
320PRINT:COLOUR2:PRINT"4.";:COLOUR4:PRINT" Underwater         computer language?"
325 GOTO [...line...]
330"DATA "D","A","T","A","B","A","S","E"

One last mystery remains: what are the answers to the competition questions? (Edit: we have answers!)
marnanel: (Default)
In case you're interested, here's how the triolet builder works.

We start by taking a set of words. Then we remove all the words which don't alternate between stressed and unstressed syllables. Next, we assign each of them a stress number whose absolute value is the number of syllables, and which is positive if the word begins on a stressed syllable and negative if it begins on an unstressed syllable. The stress numbers -1 and 0 are not allowed. Then we also assign each one a rhyme number, such that words with the same rhyme number rhyme. Here is the lexicon with stress numbers and rhyme numbers.

Next, we assign each word its most likely part of speech, as given in the Brown corpus tagset. If the word doesn't exist in that tagset, we throw it out. We use only the first character, so for example "NNS" is represented as "N". The part of speech gets concatenated with the stress number to form a "tag". For example, "N+3" is a three-syllable noun which begins on a stressed syllable, such as "cauliflower".

Then we make up a battery of phrases, each consisting of terminals (such as "if"), and nonterminals (such as "N" for noun). A script is then run over the battery to create all possible tags for the nonterminals which would fit into iambic tetrameter.

For example, this line, where R is a pronoun, A is an article, J is an adjective and N is a noun,

R are A J N

produces these arrangements. Note that R and A are constrained to be no longer than +1, and that A+1 is special-cased so that it cannot fall on a stressed syllable. Note also that we provide for both masculine (here, 8-syllable) and feminine (9-syllable) lines.

R+1 are A+1 J+1 N-4
R+1 are A+1 J+1 N-5
R+1 are A+1 J+2 N+3
R+1 are A+1 J+2 N+4
R+1 are A+1 J+3 N-2
R+1 are A+1 J+3 N-3
R+1 are A+1 J+4 N+1
R+1 are A+1 J+4 N+2


At runtime, we pick a random word from the lexicon, and select a list of words which rhyme with that word. Then for each word in the list, we note its tag, and find an arrangement that ends with that tag. We then proceed by matching nonterminals as appropriate. If after all this we find we don't have enough entries, we throw it all out and start again.

The back end is only polled twice, for the first and second lines. The rhymes for each are stored at the time. This is why all other lines will eventually loop around (as noticed by Sally and Simon).

All the lines we produce are logged and kept for a week. The front end can tell the back end to turn a triolet into a permanent post, but it can only do so for lines which exist in the log.
marnanel: (Default)
I've been thinking about the way Spurge works, and how it should be debianised.  Do any of you have strong opinions as to whether services whose traffic is not great should
  1. be launched from inetd or xinetd?
  2. listen for themselves?
  3. be able to do both, and the administrator can choose according to expected load?  This appears to combine the faults of both schemes.
Pros and cons:
  • The process is constantly running with (2), and not with (1).  Then again, if you're only running [x]inetd in order to run one service, you're running one extra process all the time anyway.
  • Configuration (by the user or the package) is far simpler with (2), especially because xinetd and inetd have different configuration file formats.
  • with (2), the service has to be capable of handling simultaneous connections in-house, whereas this isn't necessary with (1).
  • (1) has an extra dependency.
What are your thoughts?

I think bucktooth might be a vaguely comparable system to look at.  (It uses xinetd.)

Grogblog

Jul. 30th, 2009 03:32 pm
marnanel: (Default)
Nargery-filled thought experiment: It just occurred to me that with a very little amount of extra hacking I could simply implement my entire blog in Yarrow.  At a pinch, the system as it stands would work out of the box.  I still haven't found a CMS I really like, and Yarrow+RGTP is basically a very simple CMS, and I know it like the back of my hand.  Other things which would be useful if I did this:
  • possibly an option in the server so that only Editors (i.e. me) could create new items
  • RSS/Atom output from the web client; this would be fairly trivial to implement.  (Or do this externally to the web client, and only list items created by me; that way we wouldn't need to restrict the creation of new items.)
  • probably a magic option in the web client so that on that specific site the content of new items (but not the replies to them) was rendered as HTML rather than plain text; this would mean existing content could be kept as-is
  • skinning support, but if we switch to genshi as planned, this will be easy anyway
  • automatic crossposting to Dreamwidth (and thence to LJ) and GNOME Blogs; not sure at what level this would be best implemented; maybe on the server side as some kind of hook
  • I wonder whether we could have automatically-created accounts using OpenId somehow
It would actually be pretty nifty, all told.

Profile

marnanel: (Default)
Monument

August 2017

S M T W T F S
  1234 5
67 8 9101112
13141516171819
20212223242526
2728293031  

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 19th, 2017 06:41 pm
Powered by Dreamwidth Studios