Flat Cubik (Flat Rubik's Cube)

The idea to write this puzzle game appeared around November 2016. I must say that I have never achieved much success in assembling a real cube. My personal record was never less than a minute. But the device itself in the early 80s made a strong impression on me.

The idea was not to repeat numerous simulations of a real cube in 3D, but to sweep it onto a plane so that all six faces were visible at once:

Screenshot
image

The proprietary Xcode was chosen as the development environment, and Swift as the language. By that time, I already had experience working with this environment and language, so the encoding itself should not have caused any particular difficulties. Although, some moments of an algorithmic nature required walking and reflection on them. Here is just one example: at each step (course) of the user, you need to check the cube assembly. If you solve the problem head on, you can simply run through the elements of arrays and compare them for the same.

The original array (the cube is assembled, as at the very beginning of the game) is presented in the form:

var Tnew = [
    [[1, 1, 1], [1, 1, 1], [1, 1, 1]], // синий
    [[2, 2, 2], [2, 2, 2], [2, 2, 2]], // белый
    [[3, 3, 3], [3, 3, 3], [3, 3, 3]], // зеленый
    [[4, 4, 4], [4, 4, 4], [4, 4, 4]], // желтый
    [[5, 5, 5], [5, 5, 5], [5, 5, 5]], // оранжевый
    [[6, 6, 6], [6, 6, 6], [6, 6, 6]]  // красный
]

After assembly, you can get permutations of the lines in any order, for example, like this:

var Tnew = [
    [[5, 5, 5], [5, 5, 5], [5, 5, 5]], // оранжевый
    [[3, 3, 3], [3, 3, 3], [3, 3, 3]], // зеленый
    [[1, 1, 1], [1, 1, 1], [1, 1, 1]], // синий
    [[4, 4, 4], [4, 4, 4], [4, 4, 4]], // желтый
    [[2, 2, 2], [2, 2, 2], [2, 2, 2]], // белый
    [[6, 6, 6], [6, 6, 6], [6, 6, 6]]  // красный
]

But with this arrangement, we must assume that the cube is also successfully assembled.

For a better immersion in the task on the market, a simple and cheap version of the cube was purchased. And creativity began ... with the study of a real cube. The faces are assigned numbers; the rows and columns on the faces are assigned coordinates.

In this case, the movement of a row or column should set in motion the “rows” or columns “associated” with it. Everything is like in an adult cube - move one - “neighbors” are involved in the movement.

But when using% device%, we, if we think about it, are very fleeting and not very deep. For us, this is as part of a picture of the world, which is not particularly surprising. Another thing is the software model! Here it is already necessary to create an artificial reality, and therefore it is necessary to understand fully the “real reality”.

Dozens of sheets were painted and scribbled. Sometimes notes or ideas had to be written down simply on what is at hand, so that later you would not lose them for good. And somewhere by the beginning of April, a working prototype of the program turned out. The cube could be collected. But the rule of 20 to 80 (or its version of 30 to 70) worked to its fullest. It was necessary to complete a lot of service trifles: build timer, move counter, some kind of alarm about the completion of the assembly, connect Game Center. And think about a possible monetization. That would be a very nice bonus.

As a result, somewhere by the middle of May, the program was ready for it to be able to start testing not only on the developer's device. The developer’s account was paid and several selected from different cities and villages of the planet got the opportunity to “twist” a flat cube on their devices (the program was distributed via Test Flight).

As for localization, I immediately decided not to make any inscriptions on the screen and thereby get away from this problem. So far, it succeeds.
The screen is very minimalistic. The user sees the classic scan of the cube to the plane in the form of a cross, four buttons: collect the cube, confuse the cube, change the background and show Game Center. Well, at the top there are two counters: moves and time. Time starts only after clicking the Confuse button. If the user confused the cube himself and then collected it, only moves are considered.

Impressions of the program in the "audience"


Naturally, I was always interested in the opinions of those who tested the program. Someone said that the cube should be done in 3D, to which I replied that such options for the cube in AppStore are already there and I have no interest in making them another clone. Apparently the magic word “3D” itself somehow attracted people and they thought it was a good idea. Someone immediately understood the idea of ​​a sweep. However, observations of testers showed that the transition "3D -> 2D" in most normal people causes not illusory difficulties. Even those who quite easily know how to assemble a real cube, could not immediately assemble correctly even one facet. Not to mention further assembly. However, everyone can try it for themselves.

It's funny to watch the Game Center. More precisely for the appearance of new users in it. This thing is just unrealistic cool! I made two tables in GC: build time and number of moves. Anyone who collects the cube completely gets into them. And if during further assemblies some result will improve, then it will remain in the corresponding table. For quite some time in the tables there were only my results recorded from devices of different testers under their names. And I slowly began to become disillusioned with humanity. And not so long ago, a character completely unknown to me got into the tables. At first he was in both tables in the bottom lines. Then he began to confidently move up. After about a couple of days, he took the top lines of both tables with pretty amazing results: 1 minute 40 seconds and 80 steps. However,

And more recently, a second (!) Assembled appeared, who assembled Flat Cubik in 25 minutes 01 second and 254 moves. And so far has taken the sixth place in the ranking. At the same time, he does not show persistence in improving his achievements. At least the best results from him do not appear.

What is now and further plans


The first version of the program hit the App Store in late June.
The first mistake was to put a price of $ 1 on the program. The first day brought 6 paid downloads, then the number of downloads dropped to 2.
Can this be considered a failure? Very similar to that ... Later, the game became free and currently has gained about 200 downloads.
There was no advertising anywhere. Except for a short message in the iXBT conference (inside one of the MacLife themes).

In the future we plan to add the AdMob banner. There was an idea to make undo for user moves. As well as certain options for prompting moves. So far, with tips, everything is at the same stage of walking and thinking. Those who know how to assemble the cube understand that from the current state you can come to the assembled in completely different ways.
Yes, here is at least a small example: rearrangement of 3 corner elements: I know the option of 22 moves and the option of 8 moves. I use 8 hodovka myself.

Or here’s the build strategy itself: the simplest is layered. Starting, for example, with a white cross, then corners, then a second layer, and then a third. But sooner or later, you can try the option: 6 crosses (all faces), and then 8 corners. In general, there are many ways.

A version for Android is currently in development. Well, now the program is completely free and available in AppStore for all devices with iOS 10 installed. I will be glad to see new people in the GC tables.

PS: iOS 10 was chosen after losing several days searching for a problem in Apple's internal libraries (maybe then I will write a separate note about it). It was found that the problem is absent in versions of iOS starting with 10. In order not to circumvent the problem in earlier versions of iOS, it was decided that Flat Cubik will work on devices with iOS10 +.

PS2: Cube Build Demo
video


Also popular now: