📜 ⬆️ ⬇️

“Will you be the third ?!” (c) Afonya or chess for THREE

chess for three

The author of the lightcaster article habrahabr.ru/blogs/algorithm/105450 , which deals (it seems like an interesting hobby) with what interests my team in foxyevents.de project (do not consider it an advertisement) with the offer to join us developers. Because on Habré there is no way to write to this person "from the outside," you have to write your own interesting (hopefully) article.


Any rare outstanding student wants to program to write something special ...

Once (“in the past life, probably”), playing chess, my father joked that it would not be bad to play chess in three, not two, and with one board. In those days, there was still no Internet (remember these!?) And it was impossible to find something similar in a matter of a few seconds. I remembered this “joke” almost 15 years later when I had to look for a project for a university where I taught “multimedia programming” ...
The thought seemed far from bad to me and I enthusiastically messed up a few sheets before I drew something similar to


Of course, like any person illuminated by the idea, I did not use the search engine to find a miracle that had been invented for a long time ...

Shovels and rakes

Perhaps the programming step was the hardest in this story. Not only did I have to jump from BASIC (BK> RK> Corvette> ZX Spectum 48 (BASIC)> Intel Pentium 4) right to Java 1.4 (jump after 8 years of computer life), and even mathematically faced with an unsolvable task . The fact is that the “formula calculation” was not identical to what the monitor showed. If we take the formula for rotation, for example, we get fractional values, because the board is not rectangular cells. Obtaining a fractional value by the formula, it is not possible to understand whether, for example, the value of 0.33 is at 0 or 1 pixel. Just rounding out here does not solve the problem.

It turned out that by clicking on cage 3 very close to the border (or by clicking on the border), the not expected cell was highlighted, which, in turn, was not completely correct.

line trouble

As you can see in the figure, the lines do not coincide in several pixels, if you stretch the inclined lines of different lengths (the experiment can be carried out, for example, in MS Paint-e). At that time, I was doing a practical semester in Spain and in the evenings in the wilderness it was possible to do only a few things: watch TV, program, swim in the sea, fish or collect tangerines. Because I never caught a fish, but I hated TV far before this millennium, then I was engaged in “tasks”, programming for a company or solving this problem every evening, “spending at the computer” 15 hours a day. There were days, weeks ... two months passed ... the task was not solved, the time of delivery was approaching. Of course, I understood, "clumsily, but it works." However, it did not suit me, and even some kind of competition had already begun, who was who. I even gave up programming chess itself and thought about how to solve these “damn pixels” ...

[In this place, you can try to postpone the article and solve the puzzle yourself. The impatient can read on ...]


I was always interested in non-standard problem solving, and here, fortunately, it helped me out. Look at the next drawing carefully.

chess for three in 2D

What do you see? Board ... lines ... cells ... colors? Yeah. And how many flowers on the board? Calculate? Lines, cells of several colors ... 7 ... 8 ...? But you considered it very bad. There are 98 of them! Each cell is not a distinguishable color for the eye, but not for the computer! Presenting the project in the "school" hall zapladila. The wave in the hall exceeded my expectations. The reaction, however, was not only positive. My professor got me a score lower by 0.7 points, considering this decision to be “dirty in the programming world” and the rest of the professors could not convince him. The solution was very simple: I deleted almost all the math and replaced it with a simple picture, just reading the color under my arm ...

Happy end

I developed further chess for a long time further (tests showing the position on the board, playing over the network, showed at school on “multimedia parties”), I even wanted to patent it and talked to a lawyer. By the way, “taking this opportunity, I want to say hello to my brother” (stolen phrase from the radio), for drawing what you see in 3D. For those who are interested in the source code can write to me, perhaps I will dig it somewhere on the CD that has been lying for years and you may be able to do something more with this code than I have achieved. It would be nice to see "dusty chess" a few steps higher, compared to the "initial" steps, where they have been delayed for quite a long time ...

PS: layer to the third presentation of chess can be seen here: www.hdm-stuttgart.de/multimedial/medianight/archiv_ss_06/medianightprojekt20060421141924/projektview

Pps: Owners of stereo glasses can enjoy this miracle in 3D.

chess for three 3D stereo

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

All Articles