Archive for March, 2008

Mar 12 2008

A sorting game

Published by Dougal under Maths & Computer Science

You will need:

  • A deck of cards (it doesn’t matter if a few are missing).
  • A table.
  • Two hands.

Take the deck and remove the jokers. Shuffle the remaining cards and spread out a number of them on the table in a neat line face down. Start off small — say, 6 cards — and then when you get the hang of it you can use more cards. Put the remainder of the deck to one side; we won’t be needing them again.

In front of you there should be six cards. They are probably not in order because you shuffled them earlier. But if you didn’t shuffle them very well, maybe they are ordered. Your job is to put them into order, but with a number of constraints:

  • No memorising values. If you want to know what the face value of a card is, you pick it up and look at it.
  • You cannot turn over more than two cards at a time. To make sure of this, hold onto your card as you look at it, then place it back face down.
  • You can rearrange cards by swapping pairs or by creating a new line and moving cards into the correct place in the new line.

The ultimate constraint, of course, is your time. Can you do it efficiently, with the minimum of checking and swapping?

(Bonus question 1: Having decided on an efficient way to do it, does it work well on pre-sorted decks? What if the deck is sorted in the opposite direction from your intended arrangement?)

(Bonus question 2: If the original deck was sorted into colours, can you arrange them so that the colours are still in the same order? Eg, if they were originally Red8 Red3 Black3 Black8 (reds before blacks), can you turn it into Red3 Black3 Red8 Black8.)

Comments Off

Mar 12 2008

6.40pm Restate my assumptions

Some random thoughts on intelligence, language and related matters.

Creating intelligent agents must be done organically

Human babies don’t learn about the world through databases, but through the input of their own senses. So to create a human-equivalent agent it makes sense to give it the equivalent set of sensors and effectors as a human being.

This also suggests that any agent modelled on something else — a spider, a cat, a condor — would be as alien in thought from us as the animal it is designed after.

If you can’t understand how your cat thinks, how can you expect to find something in common with a being whose only knowledge of the world is through a text terminal or a single fixed camera?

Human languages are too opaque for serious use

“Normal” — accepted (behaviour) or average (production) or perpendicular (line)? No wonder people spend so much time arguing.

Shibboleths are words which mark you out as a member of a particular group. What’s the word for a word which different groups have in common, but with wildly different definitions?

Creating a more explicit imperative language

In light of Simon Peyton Jones’ remark of Haskell being an excellent imperative language, what exact combination of “programmable semicolons” is needed to recreate something like C?

newtype C a = C (ReaderT Const (StateT Global IO) a)
    deriving (Functor, Monad, MonadIO, MonadState Global, MonadReader Const)

(The above example is basically just the X monad from the window manage Xmonad.) Is there anything else? Disregarding syntax, is the C monad equivalent to a standard imperative language? (In fact it maybe be more like Python than C, given its higher-levelness.)

Language ambiguity redux

Can we create a similar stack of environments and assumptions for conversation, from more primitive/abstract building blocks? (Obviously, short answer is no. But bear with me.)

More useful would be a type checker for internet arguments that spits out the following when required:

Error: Ambiguous context for keyword `normal' at line 17.

Comments Off

Mar 10 2008

More house-buying shenanigans

Published by Dougal under Home

Earlier today Helen and I submitted a bid for a flat in Edinburgh. I am neither optimistic nor pessimistic about our chances, because honestly I don’t have any information to go on. We know what flats in that area went for within the last 8 months, and we know what people are offering at the moment (ie, silly money) and we have an upper limit on our own budget. But whether our bid is anything close to what the sellers want — and whether other people will beat us out — is something we cannot tell. This is our first time, after all.

The bids close at midday tomorrow. I don’t know how long it will take them to decide once they’ve closed but I figure we’ll know one way or another by the end of the day tomorrow.

2 responses so far

Mar 09 2008

How to parse “offer subject to survey”

Published by Dougal under Language, Society

What do you think “make an offer subject to survey” would mean?

  1. We get the place valued and then, if the lenders say aye, we make an offer.
  2. We make an offer and if the sellers accept it the place is valued and the lenders say aye or nay.
  3. We make an offer and get the place valued at the same time. Then the lenders say aye or nay and so do the sellers.

I assumed 2. The lenders seem to prefer 1. The actual state of affairs seems to be 3. Which is the only one that couldn’t be inferred from the text. What the hell? 1 and 3 are also the only ones that penalise the buyer if they don’t get accepted by the seller.

I hate house-buying. :-(

5 responses so far

Mar 09 2008

In correspondence

Published by Dougal under Culture, Society

I have just written three actual letters, using paper and ink, written by my own fair hand. This is quite amazing, and constitutes the most handwriting I’ve done in several weeks, I think.

My only regret is that I didn’t use a fountain pen and I didn’t seal these important missives with wax. I do feel very proud though. There’s something very old-fashioned about sitting down and composing a letter to someone — especially an off-the-cuff letter to some financial institution or other, which two of mine were.

4 responses so far

Mar 09 2008

Lovin’ at the church

Published by Dougal under Family, Gig, Music, Reviews

This evening we saw Helen’s mum sing with the Garleton Singers at St Cuthbert’s — they did some Brahms love songs, there was a piano duet by Schubert, and then after the interval the all-conquering Carmina Burana. It seems you are allowed to sing about drinking and hot sex in church, as long as you do it in Latin.

I enjoyed this one more than previous trips to see the Garleton Singers. It really helps to know the tunes so we’ve been listening to some of the Brahms in the last couple of days. And of course everyone knows Carl Orff, right? He appears in enough football/car/deoderant adverts.

It was pretty rockin’ anyway, and the reprise of O Fortuna had a little extra excitement because the timpanist’s music kept falling off the stand. But, quite frankly, if you play timpani and don’t know how O Fortuna goes then you’re doing it wrong. She just kept playing through…

2 responses so far

Mar 08 2008

Islamofascists vandalise ethical shopping website

Published by Dougal under Computing, Politics, Religion, Security

Helen just pointed out that ‘The Green Apple’, an ethical/Fairtrade craft store online, has been hacked by some Islamic fundamentalists. The main page currently has a “closed for maintenance notice” but if you click straight through to the store you see a protest page from some nutty religious group:

Screenshot of the protest

After thirty seconds the page directs you to some other site which is about the wonderful prophet.

From a quick look at the guy they’re protesting — Geert Wilders — I don’t really have any sympathy for either side. He seems like the Dutch equivalent of Robert Kilroy Silk (he even has the same daft haircut…):

Take a walk down the street and see where this is going. You no longer feel like you are living in your own country. There is a battle going on and we have to defend ourselves. Before you know it there will be more mosques than churches!

Oh no! More mosques than churches!

On the other side, the Islamofascists are no better. I feel quite happy denouncing someone who would hijack a third party website for their own pointless protest and then claim “sorry for the inconvenience. Our aim is not to harm your system”. Er, yes it is. It was an effective online shop before and now it doesn’t sell anything — what other meaning of harm do you want to use?

Bunch of nutters, the lot of them.

Comments Off

Mar 07 2008

I don’t have as mature a palate as I hoped

Published by Dougal under Family, Films, Food

Helen cooked liver for tea this evening and, ulp, I didn’t like it. I feel quite ashamed. It was a bit embarrassing because we’d invited my mother for tea as well. Oh well.

The two of them have gone out to watch a Hunting and Gathering — Helen got the book from her at Christmas. Tis a French film (and a French book). I’m trying to catch up on some code that I’ve been writing in dribs and drabs for the last week. It’s moving slowly.

I can hear the grindstone calling.

Comments Off

Mar 06 2008

‘Don’t Tell Mum I Work on the Rigs…’

Published by Dougal under Books, Reviews, Work

The full title of this little gem of a book is Don’t Tell Mum I Work on the Rigs: She Thinks I’m a Piano Player in a Whorehouse, written by Paul Carter. He’s a slightly jaded oil rig worker who’s been to a lot of terrifying and absurd places in the name of Big Oil.

There isn’t much in the book about the process of digging or the oil industry. Mostly it’s tales of derring-do and idiocy. For instance, you learn what happens if you sneak into a mosque at night and change the pre-recorded call to prayer for a recording of Ring of Fire. (The answer, in this case, is get thrown out the country as a religious undesirable.)

But you also get a picture of some of the scarier ends of the nearly civilised world — where you need a code word to exchange with your driver to ensure he’s not some random person who wants to rob and kill you.

I can’t pretend this is the best written book in the world. A somewhat scattergun approach to punctuation and the like. But it’s certainly entertaining.

Comments Off

Mar 06 2008

Version Control Airlines (with added Rationality)

Published by Dougal under Computing, Humour

An addendum to John Goerzen’s version control–airline analogy.

ClearCase doesn’t let you travel to foreign places, but brings bits and pieces of other countries into your living room. So you can still sit on your own sofa while perusing the menu in a rustic Italian restaurant on the Amalfi coast. Of course, because you’re not actually there, it takes about 24 hours for your meal to arrive.

Comments Off

« Prev - Next »