Wolfram Computation Meets Knowledge

What Can You Say in One Line of the Wolfram Language? The 2017 One-Liner Competition

The One-Liner Competition is a tradition at our annual Wolfram Technology Conference, which took place at our headquarters in Champaign, Illinois, two weeks ago. We challenge attendees to show us the most impressive effects they can achieve with 128 characters or fewer of Wolfram Language code. We are never disappointed, and often surprised by what they show us can be done with the language we work so hard to develop—the language we think is the world’s most powerful and fun.

Melting flags

This year’s winning submissions included melting flags, computer vision and poetry. Read on to see how far you can go with just a few characters of Wolfram Language code…

Honorable Mention

Pedro Fonseca: Dynamically Restyled Wolf (128 characters)

Pedro’s One-Liner submission riffed on another conference competition: use the new ImageRestyle function to make an appealing restyling of the wolf icon.

e = WebImageSearch["wolf", "Thumbnails"]; b = a = Rasterize[Style[\[Wolf], 99]]; i = ImageRestyle; Dynamic[b = i[a, i[b, .8 -> RandomChoice[e]]]]

Output 1Wolfie restyle

To stay within the 128-character limit, Pedro used the \[Wolf] character Wolf character instead of the icon. Embedding the restyling in a Dynamic expression so that it displays endless variations and using random wolf images to restyle the wolf icon were nice touches that favorably impressed the judges.

Honorable Mention

Edmund Robinson: Deep File Explorer (120 characters)

Edmund’s submission actually does something useful! (But as one snarky One-Liner judge pointed out, no submission that does something useful has ever won the competition.) His file explorer uses Dataset to make a nicely formatted browser of file properties, a way to get a quick overview of what’s in a file. A lot of beautiful, useful functionality in 120 characters of code!

Robinson one-line graphicRobinson one-line part 2

Honorable Mention

Daniel Reynolds: Super Name (132 characters)

The judges had fun with Daniel’s name generator. Unfortunately, as submitted, it was four characters over the 128-character limit. Surely an oversight, as it could easily be shortened, but nevertheless the judges were obliged to disqualify the submission. We hope you’ll participate again next year, Daniel.

"CONGRATS! Your new name is " <>   ToString[Capitalize[RandomWord[]]] <> " the ruler of " <>   ToString[Capitalize[RandomWord[]]] <> "sylvania!"

Third Place

Amy Friedman: Autumn Wolframku (83 characters)

Amy’s “Wolframku” generator is itself, at a mere 83 characters, programming poetry. Using WikipediaData to gather autumn-themed words and the brand-new TakeList function to form them poetically, it generates haiku-like verses—often indecipherable, sometimes surprisingly profound.

StringRiffle[  TakeList[RandomChoice[TextWords[WikipediaData["Autumn"]], 11], {3, 5,     3}]]

Amy, a professor of English, has learned the Wolfram Language in part with the encouragement and help of her son Jesse, the youngest-ever prizewinner in our One-Liner Competition, who took second place in 2014 at the age of 13.

Second Place

Peter Roberge: Toy Self-Driving Car (119 characters)

Peter’s submission does an amazing amount of image processing in a few characters of code, adjusting, recognizing and highlighting frames to identify and track vehicles in a video. The smarts are contained in the new ImageContents function, which Peter must have done some sleuthing to discover, since it is included in 11.2 but not yet documented.

e = ExampleData; e@e[e[][[12]]][[4]] /.   x_Graphics :>    HighlightImage[x,     Normal@ImageContents[ImageAdjust[x, {0, 0, 4.7}]][All, 1]]

Output 5Car tracker

First Place

George Varnavides: Animating the Melting Pot (128 characters)

George’s mastery of the Wolfram Language enabled him to squeak in right at the 128-character limit with his submission that expresses the “melting pot” metaphor both graphically—as animations of melting flags—and conceptually, since the melting effect is achieved by melding multiple flag images. His use of Echo, Infix operators, memoization and FoldList shows a deep understanding of the Wolfram Language. Nicely done, George!

f := a = DeleteMissing[#@"Flag" & /@ RandomEntity["Country", 9]] Echo@ListAnimate@    FoldList[ImageRestyle, f[[1]], Thread[.01 -> Rest@a]]~Do~9

Output 6Melting flags

There’s more! We can’t mention every submission individually, but all merit a look. You might even pick up some interesting coding ideas from them. You can see all of the submissions in this downloadable notebook. Thanks to all who participated and impressed us with their ideas and coding prowess! See you again next year.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.