Wolfram Blog
Christopher Carlson

The Winners of the 2019 One-Liner Competition

December 5, 2019 — Christopher Carlson, Senior User Interface Developer, User Interfaces

This year’s Wolfram Technology Conference was host to the eighth annual One-Liner Competition, an event where attendees show us the most astounding things they can accomplish with 128 or fewer characters of Wolfram Language code. Submissions included games, card tricks and yoga exercises, all implemented with less than one tweet’s worth of the Wolfram Language.

The Winners of the 2019 One-Liner Competition

Honorable Mention

Marco Thiel: Word Relay (128 characters)

Marco took advantage of inaccuracies in SpeechSynthesize and SpeechRecognize to create a machine version of the telephone game (or “Chinese whispers”), where a phrase is whispered from person to person and morphs along the way, perhaps into something completely unrelated to what was first spoken. It’s a faithful reproduction of the game, starting with a phrase spoken by the user and producing a sequence of audio outputs along the way:

NestList
&#10005

NestList[SpeechSynthesize[SpeechRecognize[#],
   RandomChoice[
    "Name" /. GatherBy[VoiceStyleData[], #[[2]] &][[1]]]] &,
 AudioCapture[] , 10]

The first output is a recording of me saying “tomato,” and the subsequent ones this sequence of inaccurate repetitions: “tomato-eh,” “tomahto-wee,” “tomato-wee,” “tumito-wee,” “turn-to-wee,” “turn-to-wee,” “turn-to-wee,” “turn-to-wee,” “turn-to-me,” “to-to-me.”

The judges really loved the idea and the concise implementation, but it was somewhat finicky and not all of them could get a satisfactory result—which may be something for Wolfram developers to look into.

Honorable Mention

Stella Maymin: Magic Trick (127 characters)

This was the first-ever telepathic code entry in the One-Liner Competition. All you have to do is think of a card, and then when you press the “It is gone!” button, your card disappears! The code reads your mind!

g = ResourceFunction
&#10005

g = ResourceFunction[
  "PlayingCardGraphic"]; TabView[{"Just THINK of a card" ->
   g[{11, 25, 37, 51, 26}], "It is gone!" -> g[{24, 12, 50, 25}]}]

Unfortunately there appears to be a bug in the code. If you picked the queen of hearts, it would not have disappeared. Nevertheless, the judges thought this entry was a great idea, and nicely executed.

Honorable/Dishonorable Mention

George Varnavides: Oboe Dragon (Curve) (128 characters)

EmitSound
&#10005

EmitSound[
 SoundNote[#, 1, "Oboe"] & /@
  Accumulate[
   Last@SubstitutionSystem[{3 -> {3, 2, 1, 0, 2},
       1 -> {-2, 0, 3, -2, 1}}, {0, 3}, 9] /. 1 | 3 -> Nothing]]

This sonification of the dragon curve was the background music for the entire One-Liner judging session when the judges could not figure out how to turn it off and listened to its full 25 minutes. The judges loved the idea and the effect… for the first minute or two.

What the judges discovered too late was that playing any other sound would abort the one in the queue. For example:

EmitSound[SoundNote[]]
&#10005

EmitSound[SoundNote[]]

Third Place

Stella Maymin: Face Eraser (90 characters)

Stella’s third-place Face Eraser nicely uses a function that many Wolfram Language users may not know about: Inpaint. The combination of Inpaint with FindFaces to insert a blank where someone’s face ought to be yields creepy images appropriate to the Halloween timing of our technology conference:

c = CurrentImage
&#10005

c = CurrentImage[]; Inpaint[c,
 Binarize@HighlightImage[c, {{"Blur", 999}, FindFaces@c}, "Remove"]]

Face Eraser

Face Eraser

Second Place

Amina Matt: Morning Yoga Routine (128 characters)

You can’t get the full effect of Amina’s yoga routine without actually evaluating the code. The output not only shows you the lotus pose but also gives an audio description of how to execute it, accompanied by a calming birdsong background:

EmitSound
&#10005

EmitSound@ExampleData@{"Audio", "Bird"}~Do~11
Speak[n = "LotusPose"]
t = "YogaPose"~Entity~n
Speak@t@"Description"
Show@t@"Schematic"

What a great combination of elements! I challenge anyone to produce the equivalent in any other language with 10 times as many characters.

The judges said this would be a killer app had it produced random yoga poses, but recognized that Amina was right up against the 128-character limit, and that not all "YogaPose" entities have the required description.

First Place

Philip Maymin: Memory Game (127 characters)

Philip’s first-place entry is a clever adaptation of the conventional memory game to make it work as a One-Liner. Instead of matching pairs of like items, your task is to reveal the numbers 1 through 16 in sequential order:

k = l = 0;
&#10005

k = l = 0; s = Partition[RandomSample@Range@16, 4]; Dynamic@
 If[16 == l, k,
  Grid[Map[If[# <= l, #,
      Button[\[SixPointedStar], Speak@#; ++k; If[l + 1 == #, ++l]]] &,
     s, {2}]]]

When you click an asterisk, you hear the number it hides spoken, and must remember what was spoken where in order to complete the game, trying to use the smallest number of clicks to do so:

When you’ve revealed all the numbers, the game board is replaced by your score, which is the number of clicks you used:

Final score

With just 127 characters, Philip has created a polished, interactive and challenging game that’s actually fun to play. Nice work!

The judges commented that it would have been really nice to show the score as you are playing. You did have one character left, Philip ;)


I’d like to point out that fully half of this year’s honorable mentions and prizes went to the father–daughter pair of Philip and Stella Maymin, a first in the history of the One-Liner Competitions.

There were 22 entries to this year’s contest, and many beyond the ones I could present here that merit a look. You can see all of the submissions in this notebook. Hope to see you at the One-Liner Competition next year!

The latest Wolfram technology stack makes it possible for you to develop and deploy useful applications in minutes. Start coding today with a Wolfram|One trial.

Try now

Leave a Comment

One Comment


Philip Maymin

As requested, here it is with the live score! :-)

k = l = 0; s = Partition[RandomSample@Range@16, 4]; Dynamic[
Labeled[Grid[
Map[If[# <= l, #,
Button[\[SixPointedStar], Speak@#; ++k; If[l + 1 == #, ++l]]] &,
s, {2}]], k]]

Posted by Philip Maymin    December 5, 2019 at 10:51 am


Leave a comment in reply to Philip Maymin