Archive for January, 2010

n-queens Mexican Standoff

The first day back at work has proved fruitful in the form of someone coming up with the opposite of the traditional n-queens problem: the n-queens Mexican standoff. Instead of minimising the number of mutually attacking queens (to zero), the objective of the standoff version is to maximise the number of attacks.

We haven’t done an exhaustive search yet, but I’ve been running a simulated-annealing-ish script for a while, and it looks like the most attacks is 34 (17 pairs of mutual attacks), in two configurations:

QQ.    .QQ.
QQQ or QQQQ
QQQ    .QQ.

…either of which can be expanded by adding gaps between the queens, or rotating by multiples of 45 degrees.

Q.Q..   .Q.Q.   Q...Q..
.....   Q.Q.Q   .......
Q.Q.Q   .Q.Q.   ..Q...Q
.....   ..Q..   .......
Q.Q.Q           Q...Q..
                .......
                ..Q...Q
Q...Q...

Update: Python code below the fold.

» Continue reading “n-queens Mexican Standoff”

Leave a Comment

New Year’s Resolution

This year I intend to learn to use Emacs properly. I’ve always liked Emacs in principle but never really been able to remember the arcane command sequences to do anything beyond undo, search/replace, and some basic navigation and file stuff. This is the year to jump down the rabbit hole.

A backup resolution, in case the rabbit hole turns out to stink, is to switch to vi.

Comments (2)

Fibonacci music

I spent most of today messing around with music based on the Fibonacci sequence. The result I’m happiest with has four voices, each using the Fibonacci sequence mod 12 to determine the pitch (in semitones), and using the sequence with other moduli (4, 5, 3 and 2 respectively) to determine the timing.

Fibonacci MIDI (9.8KB)

Fibonacci MP3 (3.0MB)

It could generously be described as “atonal crap”, but it sort of has moments of not-completely-awful-ness. Sort of.

Python code below the fold.

» Continue reading “Fibonacci music”

Leave a Comment

Zendo and inductive logic

…is what I’m thinking about now. (Okay, technically, are what I’m thinking about now.)

Don’t have time for a fully explanatory post right now; I just wanted to get something on here so that the new blog doesn’t stagnate before it’s even started. So here’s a bullet-point-form introduction:

  • Zendo is a game where players try to guess the Master’s secret rule by probing it with examples.
  • Inductive logic is… the same thing, really, except generalised to not necessarily include players, a Master, or… plastic pyramids.
  • Doing either of these things algorithmically is, in general, hard. But in an interesting way.

Also: colours!

Leave a Comment