📜 ⬆️ ⬇️

Calculations in 128 characters: winners of the one-line Wolfram contest

The article mentions new features from the future 12th version of the Wolfram language. The copied code and the loaded notepad will be published after the release.

Each year, at the Wolfram Technology Conference , a one-liner contest is held for Wolfram programs with a maximum length of 128 characters. Our employees are forbidden to participate in it, but every year they receive applications and requests that must be rejected. To give them the opportunity to express themselves and show how cool the programs they are doing, this year we organized for the first time an internal contest of one-liners.



We awarded the first, second and third places, six honorary and one shameful mention. And the winners are ...
')

Honorable mention


Danny Finn, Consultant


ImageGuessr (Wolfram Pictionary) (128 characters)


Danny's work is a complete game in 128 characters. Some judges found it so exciting that they continued to play after the end of the judicial session.

The code selects a random word and assembles a collage of images found on the Internet for this word. It then displays a dialog with a collage and an input field so that the player can guess the word. When a player enters it, he relates the semantic features of his guess with the semantic features of the word. The higher the correlation, the closer the answer within the meaning to the answer. A lot of functionality in one line of code!







Honorable mention


Danny Finn, Consultant


Notebook Pox (123 characters)


Danny deserves a second honorary mention for the code that infects your notebook with smallpox. Probably, the author would deserve a shameful mention if he had not provided the medicine (see the second part).

Danny could save seven characters by eliminating unnecessary System` before the BackgroundAppearance : this is probably the remainder of an experiment.







Honorable mention


Sarah Stanley, Chief Consultant


Rainforest Winter (126 characters)


Sarah’s work combines image search and a neural network to transform images of the tropics into a snow forest. Issuing ListAnimate shows a set of images of snow-covered rainforest.





Honorable mention


Sarah Stanley, Chief Consultant


Changing Tigers' Stripes (128 characters)


Like Danny, Sarah also received two honorable mentions. The second is for work that combines image search and a combination of neural networks that remove stripes from tigers. ResourceObject in the code is the CycleGAN neural network for converting zebras into horses . The neural network is trained on the ImageNet data set. The name of the neural network would have eaten out 72 of 128 characters if the compact numeric identifier had not been used. While the original network was trained to transform zebras into horses, Sarah applied it in a new area: on white tigers, and got an interesting effect.





Honorable mention


Brian Wood, Lead Technical Marketing Writer


A Little Fun with Motion (117 characters)


Brian's program makes video effects on the fly using compact image processing code that creates color traces when an object moves. When the object is stationary, the superimposed color paths are summed to accurately recreate the original image.





Honorable mention


Daniel Carvalho, Executive Director, International Business Development


Wave (93 characters)


Having broken his head over the analysis of some previous tasks, the judges found Daniel’s meditative waves to be very pleasant.





Shameful mention


John McLoon, Director of Technical Communication and Strategy


Amazingly short Minesweeper code (47 characters?)


John's “sapper” was the first to hack into the jury's notepad, namely, the character counting code. This is a good example of why we need the annoying “Turn on dynamics” button when opening a Wolfram notebook with dynamic code:



When you open the program of John, you see 2000 with something symbols of the full-fledged game “Minesweeper”. It starts like this:



Despite the huge volume, the counter at the top shows that the program size is only 47 characters:



The accompanying note says: “Surprisingly short Minesweeper code. It may look bigger, but actually only 47 characters. Check for yourself! And I honestly did not change the jury's template, you can copy the code into a fresh one-liner and see. ”

How did he do it? John didn’t really change the source code embedded in the filing pad, but redefined some of the functions that this code defines. This can be seen through Cell> Show Expression on the cell with the code.

The first “0” in the code is wrapped in DynamicWrapperBox with new definitions of functions for counting the number of characters in a notebook. Instead of counting the characters in the program, the new definitions count the characters in the line "Of course, deserves the shameful mention of [sic] !!!" (47 characters):



The first time John’s program appears on the screen, the DynamicWrapperBox code activates and hacks a notepad to submit an application. Truly deserves shameful mention, John!

Third place


Jofre Espigule-Pons, Consultant


Endangered Species (122 characters)


In the works of the winners, the language components of the Wolfram Language are used in such a way that they give beautiful, useful and surprising results. The Jofre program meets all three criteria. He finds the intersection of a mammal class with a class of endangered species (i.e., a class of endangered mammals), receives an image of each of them, and collects images into a collage - a graphic reminder of the biological wealth that we risk losing.





Second place


Lou D'Andria, Lead UI Developer


Wolfram Celebrities (123 characters)


It was a lot of fun to study Lou's application, which draws pictures of employees from the company's catalog and using Classify finds the celebrity they are most like.





A surprising number of people in the company are identified as “Stephen Wolfram” (including Stephen himself). Hmm ...



First place


John McLoon, Director of Technical Communication and Strategy


Evolving Abstract Art (68 characters)


Our colleague, who earned a shameful mention at this competition, also won first place. John McLoon's elegant and laconic 68-character program won the judges a high ratio of graphic diversity to the length of the code. This animation, and attractive graphics. It is interesting to see how the image develops:





John used the complex effect of repetition. The result is a program that does much more than one might think, looking at the number of characters. Congratulations, John!



Many more works are submitted for the competition: a total of 34 pieces. All of them will be published in a notebook after the upcoming release of version 12 of the Wolfram language. Thanks to everyone who participated. Thank you for once again showing us the power of the Wolfram language.

Source: https://habr.com/ru/post/442134/


All Articles