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:
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.
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.
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
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.
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: