Blog
March 14, 2019
Ciklum News
R&D

No More Trivial E-Cards: How Ciklum R&D Team Created a Snowflake-Generating App

No More Trivial E-Cards: How Ciklum R&D Team Created a Snowflake-Generating App

As part of last winter’s holiday greetings, Ciklum wanted to come up with something creative for Ciklum’s clients and employees. With help from the Ciklum R&D team, we created an app that generates uniques snowflakes based on users’ names. Unlike the apps with a similar idea, our engineers took it to another level and made it educational by explaining the algorithms behind the beautiful snowflakes.

The team was composed of 3 members: 2 were busy constructing an algorithm and one was responsible for the web server. The whole app launch process took only a week.

From the very start, the R&D team was looking for the appropriate algorithms and turned to the research archives and articles of the world-known researchers. With algorithms proposed by Janko Gravner and David Griffeath and another by Clifford A. Reiter the snowflakes appeared like this:

client greetings - snowflake app

Even though these techniques satisfied the paramount requirement of looking realistic, there was a major pitfall. It was extremely time consuming and took at least half an hour to create one snowflake.

The most rational solution was to generate a set of points with uniform distribution on a square and draw a line through them to generate an element like this, which the team called an elementary patch.

client gifts- snowflake app

At this point comes the main part – how to make a snowflake bespoke for anyone based on their name. The app calculates the hash value of the user’s name and uses it as a random seed to generate a set of points with uniform distribution.

Kseniia Demska
After repeatedly testing this approach, it was observed that some snowflakes happened to have holes in the centre, making them look strange. The simplest solution to this was to add the coordinates of the centre to the list of points but they lacked symmetry.
Kseniia Demska, Research Engineer

original gift - snowflake app

The elementary patch was mirrored before rotating and the number of coordinates was doubled. It was symmetrical but it was too clunky. Generating points from the sector of the circle instead of the square refined it further. While changing the shape of the snowflakes, colour was altered for convenience so that results of different stages of experiments were easy to track and distinguish. The final version of the algorithm was defined and to make the snowflakes even more beautiful two separate elements with different rules were combined, generating a vast variety of designs.

Christmas gift

unique Christmas gift

We received a lot of positive feedback and learned an important lesson after the campaign was launched. Due to the influx of users trying the application out at the same time (around 900 concurrent users), the system overloaded. Fortunately, Ciklum engineers managed to fix this rapidly and let everyone get their unique winter greetings.

If you want to see how your snowflake looks even though it’s spring, check it out here:

snowflake

Read also: 
  • Ciklum R&D Launches JobBot to Simplify Recruitment Process
  • How Ciklum R&D Team Built the Image Classification Algorithm to Identify Threatening Icebergs