Archive for March, 2009

Toy Ideas: Blocky Talkies

After hearing so many interesting ideas from my classmates—adult furniture with kid-friendly undersides and crannies, action figure/toy car point-of-view filmmaking for kids—I have an idea which I’ve started to mock up in Flash. I can’t seem to get the idea of glowing blocks out of my head. I know, I know, it’s about as hackneyed an ITPism as there is, but maybe I’ll do it differently!

I sketched up a quick prototype (ok, not that quick) that demonstrates the behaviors of my glowing blocks, namely, that they glow a different color depending on which face is up and that when their color changes, nearby blocks respond by averaging colors with them.

PRESS THE DOWN ARROW KEY TO SPAWN BLOCKS
CLICK ON THEM TO ROTATE THEM
DRAG THEM TO MOVE THEM
PRESS THE UP ARROW KEY TO START OVER

Unplayable Games

Tetris HD

There’s been much hubbub of late around Tetris HD, a Flash version of Tetris in which the screen is so large and the pieces so small that it takes around fifteen minutes of concerted play to make a single line. Are we witnessing the birth of ludic irony, or is an unplayable game just clever satire in game’s clothing?

Anyone who’s played a game released in tandem with a major Hollywood movie knows that unplayable games are released all the time. These games, however, don’t aim to be unplayable; it’s bad design that makes them so. They’re normally unplayable because they’re either way too easy or way too hard, the controls are poorly laid out, the gameplay is perfunctory, or, in the case of many, because there is no gameplay—the “games” are actually user-navigable movie previews, narrative in a game vacuum. But Tetris HD is different. It was designed to be unplayable. You can certainly play it, but the experience is neither enjoyable nor gamish.

I’ve seen similar unplayability in games before. Eddo Stern and Mark Allen’s Tekken Torture Tournament uses a modified console to deliver “bracing but non-lethal” shocks to players of Tekken when their characters sustain damage. Both electrified Tekken and Tetris HD riff on existing games. Their principal meaning derives from this association. While you could technically play them, their practical unplayability is the point, they are ideas, a commentary on games and our impulse to play them. You’re not really supposed to play Tetris HD. You’re supposed to try for a second and shake your head in amusement. It is, at the risk of sounding graduate student-y, a meta-game.

Which is not the case with New York Defender, a Flash game in which the player mans an anti-aircraft gun and is quickly overwhelmed by increasingly large numbers of airplanes bent on crashing into famous New York City landmarks. New York Defender is designed to be playable, fun even, but only very briefly—it quickly becomes impossible and there is no win condition. Plenty of games (pinball for instance) are extremely difficult to beat but because New York Defender is impossible, the outcome is predetermined, and the game is in that sense un-“playable.” Much of New York Defender‘s irony rests on the player’s perseverance in the face of certain destruction. Though it too derives its meaning from outside itself, New York Defender doesn’t sacrifice its gamishness to communicate it. It’s eminently playable, and it’s the polyvalence and simultaneity of the desire to play and the disgust that play produces—the uneasy union of gamishness and idea—that really exploits the full potential of ludic irony.

Hearing in Tongues

After creating a Spanish agglomerative insult generator last week and having recently read Neal Stephenson’s Snow Crash, I had language and Babel on the brain.

The other day I was looking at some Chinese money I found in a pocket of an old pair of pants, marveling at the weirdness of the Manchu script that appears beneath all the other supposed indigenous Chinese languages in several places. It’s relatively easy to identify a language with a peculiar script, but how do you distinguish between superficially similar languages, say Italian and Spanish or Dutch and German?

Well, for starters you could use my Bayesian filter Java application. It accepts any number of example language files (in the case below, selected texts from Project Gutenberg) and the text to be identified either on the command line or in a file. In a matter of seconds determines to the best of its ability the linguistic provenance of said text. Though it overconfidently and erroneously identifies languages it hasn’t been “trained” in, it has yet to misidentify a language it has been given as an argument:

Terminal Window Showing Java App

To create the script, I modified Adam Parrish’s example code so that it identifies one language rather than listing each and assigning it a score and then displays the word that proved the most relevant in the program’s assessment. If you feed the script a language it doesn’t know and it confidently classifies the text as, say Danish, usually the word it found was most relevant is unusual in Danish and much more common in a language that a quick google will reveal.

The code is here and here.

Double hinges are endlessly fascinating

Jacob's LadderWhen thinking about the categories I laid out in my previous toy post, the toy that immediately suggested itself to me was what I knew as “click-clack blocks,” though a bit of judicious Googling revealed that it’s more commonly known as a Jacob’s Ladder.

The principle behind it is the same principle responsible for the Magic Wallet‘s popularity some years back and, in a much more complicated form, for the workings of the Rubik’s Magic. Note the “magic” in both titles. In Yardsticks, a book about childhood development we read for class, Chip Wood writes that younger children are “pre-logical”—they grasp the world intuitively—so when presented with a toy that defies even adult intuition, they’re hooked.

For my first toy, I wanted to defy intuition. I built a Jacob’s Ladder-style toy out of duct tape that works in two dimensions rather than one and combined it with the magic wallet concept to give it a graphical element after watching this:


The funny thing, though, is that even in its conception the toy defies intuition. After painstakingly cutting out and gluing together 16 two-colored craft paper cards and securing them to the toy, they didn’t behave at all as I expected. They neither reversed nor moved between segments. Instead, it was the hinges themselves that changed their configuration so that a given segment might have two parallel strips running along its length in one state and two crisscrossing strips in another!

To take advantage of this in an entirely hypothetical second iteration of the toy, I would probably play with the strips size and ability to hide and reveal portions of images beneath them. I also got some great feedback from my classmates, who suggested:

  • increasing the scale so that the toy becomes more architectural/furniture-like
  • using the toy as an interactive picture frame for portraits of individual family members to help a child envision and reconfigure relationships among people by reconfiguring the frame
  • giving it some puzzle dimension, though I worry that puts it in competition with the nearly untouchable and aforementioned Rubik’s Magic

In the course of my research, I also stumbled upon kaleidocycles, a book of which I had as a kid though I’d forgotten all about them. They’re also counterintuitive and magical, so I made a series of them as well.


I want the toy that I eventually develop to tap into the fascination that both the paper toys and the double hinges elicit. I also really like this idea of envisioning relationships that came up in the discussion of the duct tape toy. Hmmm.

Thinking About Toys

I’ve been thinking more about games than I have about toys recently, which I intend to remedy right now. Every Tuesday for the last seven weeks, I’ve sat in a room with twelve or so other people talking very seriously about what makes a good toy. I thought I remembered all my toys and knew for sure which were my favorites, but the conversation dredged up fond memories of toys I’d all but forgotten. My blue plastic Cinexin projector, for instance:

My other favorite toys included Magia Borrás, my Exin castle, my venerable STX 4X4 Scalextric, Lego Technic, Star Wars figures and vehicles, Transformers (especially Optimus Prime and a tank/plane triple changer whose name eludes me), and the contents of my toy bucket taken as a whole. I’m sure I’m forgetting something, but those are the ones I remember playing with the most.

And they all share at least one of the following characteristics that set them apart from sucky toys:

  • They put you in control
  • They gave you a grown-up ability
  • They allowed you to hide or disguise yourself
  • They lent themselves to the invention of stories
  • They caused something to happen or move
  • They impressed or surprised your friends, mom, or other adults

Which is why, I think, there aren’t that many new toys. Sure, Toys R Us in Times Square is brimming with an amazing assortment of toys, but most of them are just repackaged, rebranded, carefully gendered versions of a dozen or so archetypal toys: the doll, the science/discovery toy, the vehicle, the teddy bear, the puzzle, the art/creative material, the noisemaker, the building block, the board game, the bicycle, the costume, the ball, the tent, the weapon, the “learning” toy, the miniature [insert adult locale or situation], and the videogame.

Which is also why I stuck close to a traditional toy when I started designing.

Many splendored receptacles of poop

Anglo-Saxons must have been a fiercely efficient race. I suspect that the Protestant work ethic and eating in cars during a commute are vestiges of that efficiency, the same efficiency that has left its mark on the English language—the language of getting things done.

Mediterranean cultures, on the other hand, like a three-hour lunch. Much to the horror of Strunk and White, they’ll not only use two words when one will do, they’ll probably use ten. It’s hardly surprising that Romance languages lend themselves to meandering and entirely uneconomic profanity. A hasty “fuck you!” would never do, oh no.

Much was made of the agglomerative nature of French profanity by the Merovingian in the second Matrix movie:

I have sampled every language, French is my favorite. Fantastic language, especially to curse with. Nom de dieu de putain de bordel de merde de saloperie de connard d’enculé de ta mère. Like wiping your ass with silk.

Well. That is a long string of nested prepositional phrases that doesn’t make all that much grammatical sense. That may be enough for Gallic cyber-demons, but in Spain, we take pride in the grammatical correctness of our impossibly long invective.

Case in point: the Me cago en… (literally, I shit on…) construction. Common toilet substitutes include the sea, everything that flies, your mother/father, and all manner of blasphemous locales too sacrilegious to transcribe in English.

But the mark of a wordsmith, of a cultured man or woman of letters, is the ability to generate, on the fly, original, long, and grammatically correct receptacles in which to void. Though non-native speakers can never hope to attain a true mastery of this particular cultural form, using my handy Java-powered insult generator can at least open their eyes to its endless possibilities.

Here are some particularly juicy examples, in the original and translated:

Me cago en un pasaporte. (I shit on a passport.)

Me cago en todo lo que mira a tu supervisor que aparece a tu padre que come el oceano a mi hermano que navega de tu Dios a esas uvas. (I shit on everything that watches your supervisor who appears before your father who eats the ocean of my brother who sails from your God to those grapes.)

Me cago en las jorobadas hormigas de mi abuela. (I shit on my grandmother’s hunchbacked ants.)

Me cago en los olvidados franceses. (I shit on the forgotten French.)

Never better said.

The insult strings are generated recursively using the code described here and the following grammar:

# clauses
S -> Me cago en NP
NP -> todo lo que VP
NP -> NNP PP
NP -> NNP
PP -> P NP
PP -> P Pos Per
PP -> P Pos Per QP
QP -> que VP PP
VP -> V
VP -> V NP
VP -> V PP
NAF -> AdjF NF
NAM -> AdjM NM
NAM -> NM
NAF -> NF
NPAF -> AdjFP NFP
NPAM -> AdjMP NMP
NPAM -> NMP
NPAF -> NFP
NNP -> DetF NAF
NNP -> DetM NAM
NNP -> Pos Per
NNP -> DetFP NPAF
NNP -> DetMP NPAM

# terminals
DetF -> la | una | esta | esa
DetM -> el | un | este | ese
DetFP -> las | estas | esas
DetMP -> los | estos | esos
NM -> mar | sol | coche | oceano | pais | gobierno | presidente | sueño | pastel de cumpleaños | perro | gato | sombrero | plato | futuro | chorizo | pasaporte | coño
NF -> mar | sombra | cama | hostia | leche | lluvia | verdad | tortilla | mierda | cumbre | polla | leche
NMP -> americanos | franceses | pantalones | zapatitos | cojones | primos | antepasados | albondigas
NFP -> embarcaciones | hipotecas | gafas | uvas | sillas | hormigas | ruedas
P -> a | de
Pos -> tu | mi
V -> come | ve | mira | vuela | salta | conduce | escribe | navega | fomenta | aparece | apesta | huele
AdjM -> puto | asqueroso | maloliente | podrido
AdjF -> pegajosa | sucia | mísera | pobre | desesperada
AdjMP -> olividados | sucios | malditos | putos | poderosos
AdjFP -> putas | malditas | jorobadas | odiosas
Per -> padre | abuela | prima-hermana | bisabuelo | madre | Dios | supervisor | jefe | hermano

Grammatical gender presents certain problems, as do different prepositions. A truly robust generator would separate nouns into different types (locations, people, activities, organizations, etc.) and pair them with appropriate verbs and prepositional phrases. But I can do this without a computer. It’s more interesting to see how a computer squeeze together phrases that, while grammatically correct, I would never say in tandem.

I shit on your birthday cake.

I know why the compiler sings: A Homework Generator

In GEB, Douglas Hofstadter argued that recursion and self-referentiality are the precursors of consciousness. I’m nodding my head in vigorous assent, but I’m still not sure I really understand what that means. If I’ve learned anything at ITP, it’s that the best way to understand something is to build it yourself, so for my A to Z midterm I constructed a homework generator—a Java program that outputs working Java programs for munging text along with a short description of what they do—and in the process came a little closer to understanding what Hofstadter was getting at.

Writing code that randomly generates working semantic code using n-gram analysis or generative grammars seemed like too formidable a task so I borrowed my approach from Raymond Queneau’s “One Hundred Thousand Billion Poems,” fourteen sets of ten lines each from which the reader is supposed to select and assemble a sonnet. The reader must select one and only one line from each set and do so in the order they’re presented. It is a constrained system that mimics the constraints of the sonnet form itself, and despite these constraints, still produces an astounding number of outputs.

My Homework Generator works in a similar way. When the code is run, it chooses one “line” from each of four sets and assembles it into semantically correct Java that can be compiled and run to munge any text that’s fed into it. Unlike the reader of Queneau’s sonnet, the Homework Generator doesn’t have to proceed in any particular order through the sets, nor does necessarily have to pick a line; it can simply skip a set if it chooses. Both the decision to select from a set and the order in which it is selected affect the final result. My combinatory math is a little rusty, but if there are three groups of three and one group of one and at least one must always be chosen and order matters, I believe there are, I believe the technical term is, a shitload of combinations. This is how it works:

Flowchart

Because instead of text output, the program generates code that when run will generate text ouput, debugging was tricky. After I compiled the Homework Generator, it produced code that in turn needed compiling. Because of the large number of back slashes and quotes in the code, I found myself thinking like a compiler, going through the code and adding escape characters to make sure that the twice compiled code would still produce the results I wanted. It took some doing, but it works!

The final code is here. Below are examples of the descriptions the code generates followed by actual generated code followed by the results of using it to munge Robert Frost’s “Stopping By Woods On A Snowy Evening.”

EXAMPLE DESCRIPTIONS
Note: Adam Parrish is my instructor for the course.

The text filter I created for this week’s class will whisper the text you give it by decapitalizing one line before searching the internet for all my correspondence with Adam Parrish. The resulting text is a post-modern limerick about words better left unsaid.

The text filter I created for this week’s class will destroy the text you give it by erasing every four-letter word before removing every fourth character from the contents of Adam Parrish’s desk drawer in the Residents’ office. The resulting text is an Oulipo poem about algorithms.

The text filter I created for this week’s class will repurpose the text you give it by truncating each line that contains the word ‘the’ before searching the internet for Adam Parrish’s phone number. The resulting text is a reasonable substitute for grammar.



EXAMPLE GENERATED CODE

import com.decontextualize.a2z.TextFilter;
import java.util.ArrayList;

public class myHomework extends TextFilter {
    private ArrayList mF= new ArrayList();
    public static void main (String args[]) {
        new myHomework().run();
    }

    public void eachLine(String line) {
        String[] word = line.split("W+");
        line="";
        for (String w: word) {
            if (w.length() > ((int)(Math.random()*8))) {
                w = w.toUpperCase();
            }
            line+=w+" ";
        }
        metaFilter.add(line);
    }

    public void end() {
        for (int i = 0; i<mF.size(); i++) {
            println(mF.get(i));
        }
    }
}
import com.decontextualize.a2z.TextFilter;
import java.util.ArrayList;

public class myHomework extends TextFilter {
  private ArrayList<String> mF= new ArrayList<String>();
  public static void main (String args[]) {
    new myHomework().run();
  }

  public void eachLine(String line) {
    line = line.replaceAll("[,;:]", "!");
    line = line.replaceAll(".", "?");
    line+=" and like";

    line = line.toLowerCase();

    String[] words = line.split("W+");
    line="";
    for (String w: words) {
      if (w.length() != 4) line+=w+" ";
    }
    mF.add(line);
  }

  public void end() {
    while (mF.size()>0) {
    int randomIndex = (int)(Math.random() * mF.size());
    println(mF.get(randomIndex));
    mF.remove(randomIndex);
    }
  }
}



SOME RESULTING TEXTS
Try to figure out what code produced them.

STOPPING

WHOSE
VILLAGE
STOPPING
WATCH
LITTLE
FARMHOUSE
BETWEEN
DARKEST
harness
MISTAKE
OTHER
downy
LOVELY
PROMISES
before
BEFORE

4nd 70 90 1
70 45k 1F 15
My mu57 7H1NK 17
0f w1nd 4ND D0WNY
W00D5 1 7h1nk 1 kn0w
H15 4
70 W47CH H15 W00D5 F1LL UP W17H 5n0w

0F
6u7 1 70
W00D5 d4rk 4ND
70 570p W17H0U7 4
4nd 70 90 1
0nly 50UND 5
w1ll n07 570PP1N9
H15 15 1n 7h0u9h
570PP1N9 6y W00D5 0n 4 5n0wy
w00d5 4ND

WHOSE WOODS THESE AREN’T I THINK I KNOW.
HIS HOUSE AIN’T IN THE VILLAGE THOUGH;
HE WON’T NOT SEE ME STOPPING HERE
TO WATCH HIS WOODS FILL UP WITH SNOW.
MY LITTLE HORSE MUSTN’T THINK IT QUEER
TO STOP WITHOUT A FARMHOUSE NEAR
BETWEEN THE WOODS AND FROZEN LAKE
THE DARKEST EVENING OF THE YEAR.
HE GIVES HIS HARNESS BELLS A SHAKE
TO ASK IF THERE AIN’T SOME MISTAKE.
THE ONLY OTHER SOUND’S THE SWEEP
OF EASY WIND AND DOWNY FLAKE.
THE WOODS AREN’T LOVELY, DARK AND DEEP.
BUT I HAVEN’T PROMISES TO KEEP,
AND MILES TO GO BEFORE I SLEEP,
AND MILES TO GO BEFORE I SLEEP.

To ask if there is some mistake? and like
The only other sound’s the sweep and like
Between the woods and frozen lake and like
And miles to go before I sleep! and like
My little horse must think it queer and like
and like
Whose woods these are I think I know? and like
Stopping By Woods On A Snowy Evening and like
But I have promises to keep! and like
His house is in the village though! and like
To stop without a farmhouse near and like
He will not see me stopping here and like
The woods are lovely! dark and deep? and like
The darkest evening of the year? and like
To watch his woods fill up with snow? and like
Of easy wind and downy flake? and like
He gives his harness bells a shake and like
And miles to go before I sleep? and like

The Mechanics of Constraint

Ratchet and Clank


I’ve played a lot of Ratchet and Clank over the last few days. Actually, I haven’t played as much as I wanted because I’ve been pacing myself so I don’t finish it too quickly. It’s a great game pretty much across the board. It has really funny (and entirely skippable!) cut scenes, a consistently well-rendered cartoony aesthetic, sound effects that make you feel Ratchet’s slamming ratchet in your bones, and a really intuitive 3D camera. But what makes the game such a standout are its carefully chosen constraints.

The game comprises an astounding variety of gameplay styles which it integrates seamlessly. For each type of play, the designers have given you control over just those degrees of freedom relevant to the task at hand, thus keeping the controls simple while making them feel extremely powerful, responsive, and distinct. In the main game, for instance, you can pan the camera left and right and walk or jump in any direction. This freedom of motion means that even though there’s really only one way to go, it never feels forced. Carefully designed constraints also keep the game challenging without making it feel arbitrary. Switching among Ratchet’s many weapons pauses the action; the focus is on picking the best tool for the job rather than remembering arbitrary key combinations in the heat of battle.

Whether you’re directing Ratchet as he clambers up a magnetic wall, aiming at distant bad guys through a sniper’s scope, or guiding a bunch of 2D Clanks to safety in an old-style arcade mini-game, you feel the controls are equally responsive even though your actual control is constrained in different ways. When Ratchet is standing on a platform, for instance, you have to be careful that he doesn’t fall off, but when he’s running away from a giant robot along a narrow winding gangway, he can’t fall off the edge; that would needlessly distract you from more pressing matters such as jumping over obstacles, avoiding falling lanterns, and dodging laser beams.

The game is not easy but its constraints are designed to keep you playing. There are lots of hard-to-kill bad guys and you die often, but continue spots are frequent and even if you have to repeat certain segments over and over, each time you amass more screws (the game’s currency). After three or four repeats you usually have enough screws to buy a new weapon that will help you get unstuck. Ratchet and Clank is both thoroughly enjoyable and challenging because the designers have made sure that as a player you’re so busy enjoying all the things you’re free to do that you don’t notice those things you aren’t. Sort of like the US government.