My dancing robots

ROBOT DANCE: Sean Joyce writes of his dancing robots.
ROBOT DANCE: Sean Joyce writes of his dancing robots.

I bought a robot and I called it Num.

To teach, or more correctly, to program, a robot, you write the instructions, or code, on your laptop computer then transfer it to the robot.

My first instruction was: When you hear the word "Num", switch on all your lights, stand up and say "Yes".

Later in the night, when I felt more in control, I changed this instruction to say, "Yes Master".

By the morning I had written 1227 lines of code. These were designed to cause Num to respond to the word "coffee", by going to the fridge, locating the milk bottle and placing it on the table.

After running my eyes over all the instructions and deciding they were perfect, I settled down for a sleep, saying, "Good night Num".

At the point where I said "Good night Num", Num sprang to his feet, lights flashing and shouted, "Yes Master", at about 777 decibels.

This required some more programming, first to bring Num's sound range down to an acceptable level, then to have him settle down and switch off in response to "Good night Num" or "Settle down Num".

Later when I woke, I sat up in bed and said pointedly, "Coffee". Num was instantly on his feet and with all his lights flashing he breathed a polite "Yes Master".

He then made his way to the fridge, opened the door, looked around inside, took the bottle of milk out and dropped it on the floor at about the place where the table had been when I had written that part of the program.

I cleaned up the mess and amended the program so that he would first ascertain exactly where the table was before doing a trial placement of the bottle, and only letting go when positive feedback was received from the bottle-to-table connection.

Later I extended the program to include Num filling the kettle with water, boiling it, putting coffee and sugar in a cup, making the coffee and delivering it to my waiting hand.

Everything was fine until one day, in the store, I saw a new model of Num. It was a T55 Mk3, and Num was a Mk1.

Clearly many improvements had been incorporated, the most obvious being that the Mk3 was lighter and faster, and its movements were more finely adjustable, particularly its hands and fingers. I had to have it.

I called it Val and at home I loaded Num's program into it. Num and Val sat where they were, completely unaware of each other while I answered some emails on behalf of the local Asperger support group. Then, about mid-morning, and without thinking, I called out, "Coffee Num".

At this, both Num and Val jumped up with lights flashing and made for the fridge. Num was closer but Val was faster and both were faster than my cat, which was asleep in front of the fridge.

Num couldn't open the door because Val was in the way. Val couldn't open the door because Num was too close. And my cat, which I call Box, couldn't get away because Val was standing on her tail.

This was my first experience of what we programmers call a "deadly embrace".

A deadly embrace is  where two processes block each other's ability to complete a function, then wait a pre-set time before trying again, with the same result as before. Val and Num heaved and waited, then heaved and waited, while Box screeched and her tail grew longer.

Strictly speaking, this was not a true deadly embrace because while Num and Val were running the same program, Val was faster and eventually its attempt to "try again" coincided with one of Num's wait periods and it pulled the door open.

The sudden movement was enough to free Box, who would have escaped if Num had not lost his balance and fallen on her, bringing an end to the noise and indeed to Box.

At this point, a very strange thing happened and Val did something that I hadn't put in its program. It may have been because they were both running the same program and Val felt personally involved in Num's plight, but Val leant down and helped Num to his feet.

The experience shook me. It bothered me that Val had offered a hand to Num and Num had accepted that hand while none of the instructions for this interaction were in the code I had written.

I decided to have a closer look at the programs, so I uploaded them to my laptop. The result was surprising, as the set of instructions required to cause the aberrant behaviour was now in both copies of the program and it was with reluctance I acknowledged that the programming standards used were as elegant and as efficient as any I had seen.

Before putting the programs back in their respective hosts I modified Val's to recognise and respond only to the name "Val" and I slowed its default speed to that of the T55 Mk 1 model.

I amended both programs to avoid deadly embrace situations by having them, before any movement, examine their environment and proceed only if the planned movement could be carried out safely.

And, naturally, I included a random modifier in their "wait periods".

Over the following weeks I did a lot of work on the programs so that Val and Num could live, or rather manage, in a multi-user environment where every aspect of a process has to be re-evaluated at every instant and the results used immediately to reprogram the operative.

This of course meant further trips to the store to buy extra memory to accommodate the growing programs, and with the growing programs came the increased likelihood of errors or bugs creeping in.

It was about this time I began to notice changes in my room that I couldn't account for. I would leave my medication on one shelf and in the morning it would be on another. Sometimes Num and Val seemed to have swapped places during the night, but I couldn't be sure.

I became so obsessed with this that before going to sleep I would take photographs of my room and the next day my camera would be missing and would turn up in the bathroom.

On the last night, I set my cellphone to vibrate and wake me up at 2.47am. At 2.47am I woke up. Num and Val were in the middle of the room and they were dancing. The were dancing a very slow waltz.

They were holding each other slightly apart but with such infinite tenderness that I was embarrassed to be looking.

To music I couldn't hear, they turned and stepped delicately around the room, sometimes with Num leading and other times with Val taking control.

When they saw me watching they almost stopped, but then, looking again at each other, they continued around the room dancing as if I wasn't there.

This is a short fiction from Sean Joyce, a Christchurch marriage celebrant and student at the Hagley Writers' Institute.

The Press