📜 ⬆️ ⬇️

Dagaz: Kicks to common sense (part 5)

image On both sides of our flat being
infinitely deep and far
life itself extends.

Charles Howard Hinton Episode from the Life of Flatland


- We had to walk a pawn to e-one-delta-ash ...
- Then the fourth horse flies.
- Let be. Pawns go into the space of elephants ...
- What is the space of elephants? Where did you get the space of elephants ?! You wrote the ninth move wrong!

Many will surely remember this passage from the unforgettable “ Half Day ” by Arkady and Boris Strugatsky. People "Half day" is almost the same as we, but smarter and better than us. They conquer space and play four-dimensional chess. The authors of Star Trek also did not bypass the theme of board games, but, in their case, Spock plays chess in three dimensions:
')


Going beyond the usual limits of a two-dimensional chessboard symbolizes the intellectual power of the people of the future and, according to the authors, makes the game more interesting. Is it so? What, in fact, can give board games the third and subsequent measurements?

6. The third dimension


Three -, four -, five- and even six- dimensional boards are not exotic in Zillions of Games . There are options with hexagonal boards. Fans of StarTrek are also not ignored (I especially like the three-dimensional Klin Zha ). The point is not limited to chess. There are four-dimensional tic-tac-toe , Reversi and even something remotely resembling Go .

ZoG supports boards up to five dimensions ( Axiom supports only two-dimensional grids ), but no one bothers to set up a board with an arbitrary topology, defining all its positions and the connections between them manually. The problem is not in the implementation of such games, but to understand what is happening on the board:



Looking at this video, I envy the people of the future. My intellect is clearly not enough to play even on such a “microscopic” 2x2x2x2x2x2 board. The other extreme is more understandable. Unlike games based on classical chess, variants of Shogi on boards of limited size (and dimensions ) turn out to be unexpectedly interesting. The point here is not in the blackboard. Almost all the options of Shogi are interesting, thanks to the reset rule:



If it were only about boards with a dimension other than two, this article could have been completed, but there is another way to use the third dimension in games! The well-known " Tic-Tac-Toe " is not a very intellectual game, but how will it change if you put the board vertically? In addition to two players, the "third force" interferes with the game - the force of gravity. Chips are still required to be placed "in one line" (4 in a row), but this is much more difficult to achieve:



The game takes on a new dimension. Chips can no longer be placed anywhere on the board, they must rely on other chips added earlier. “The Captain's Little Woman ” is still played on a two-dimensional board, but no one bothers to apply the same principle to other games, such as checkers or chess. Here there is a great selection, consisting of 92 such "tower" games.

In " Abstract Chess ", all the pieces are stacks consisting of identical pieces (except for the royal piece, which is a special piece). A single chip moves like a pawn, a stack of two chips like a chess knight, of three like an bishop, etc. In addition to the usual chess moves, the player is allowed to take the top chip from any of his stack and transfer it (by the king) to his other stack (standing side by side). The properties of the shapes change depending on the current number of chips in the stack.



Do not think that this principle is used only in synthetic games, invented recently. The " Northern checkers " mentioned by me in the previous article can be considered as an option of the " High-rise checkers " described as far back as 1961. Even more honorable history have " pillars ."



In this game, the "tower" can capture the opponent's pieces, "jumping over" them, according to the rules of the Russian Checkers . When performing a jump, the uppermost chip from the attacked tower is taken at the bottom of the pile. Thus, performing a capture, you can release your chips captured by the "tower" of the enemy earlier. As in Russian Checkers, passing through the last horizontal line turns the top piece of the stack into a long-range lady. Ladies are captured and released on a par with ordinary figures, without losing their qualities.



There is also a variant of "stolbovy" chess. Just like in “Postcards”, the figures in Tavreli can be stacked on top of each other (it is prohibited to place other pieces on the king). The affiliation and permissible moves of such a “tower” are determined by the figure on top. The transformed pawn, captured by the "tower", loses its status and again becomes normal. Allowed to build "towers" and the figures of their color. Unlike the “Postcards”, the division of the “tower” occurs at the player’s will. The player can even release the opponent's figure captured by him earlier (such a move may be useful in the event of a pat threat).

In Ritmomachia, the composition of the “tower” determines the list of moves available to it, and this is the only game I know where the piece can be “killed in pieces”. Even more difficult, in this respect, the game is described here . Building chips "on each other" is not the prerogative of checkers and chess. This feature is also in demand in other games, for example, in various types of “ combat races ”. In the “ Ursky game ” (in its version from Dmitry Skiryuk ), a chip placed on top blocks the movement of all the chips caught under it. There are also games in which, "saddling" the opponent's chip, you can "ride" on it at someone else's expense.

The implementation of "tower" games in ZoG has never been and will not be easy. The main problem is connected with the fact that each cell of the board, in this “game designer” cannot contain more than one piece. Such an approach is convenient in “chess” games, since the transition to the field, occupied by another figure, means automatic taking of the latter (which saves one team in the course description), but as soon as the towers begin to appear in the game, its description turns into a nightmare. However, sometimes it is possible to get out.


In Ritmomachia, each player has only one composite figure. This allows you to keep on the field a kind of "fictitious" figure depicting a pyramid, and somewhere to the side of the board to display its "decoding". Of course, this approach does not completely eliminate headaches. There is a mass of "interesting" moments. For example, when the last figure in the pyramid is “eaten”, it is very important to remove its “marker” from the board. Otherwise, there will be an “empty” figure on the board, unable to “walk” and be “taken”, but interfering with the movement of other figures. Given the complexity of the rules of Ritmomachia itself, the implementation of such a game can not be called simple.

A similar trick was applied in Ur . To build up chips "in piles", in this game, it is possible only on certain fields and the height of the "stack" cannot exceed four chips. For these special fields, a kind of "pockets" were created, into which blocked chips were folded, when they were captured. When the top chip left the "pile", the last of the captured chips should be shifted from the "pocket" to the board. The description of the playing field turned into a real maze:

Field '' Ursky games ''
(define board-defs (image "images/Ur/ur.bmp") (grid (start-rectangle -483 27 -422 99) (dimensions ("i/j/k/l/m/n/o/z/a/b/c/d/e/f/g/h/y/x" (67 0)) ; files ("4/3/2/1/0" (0 68)) ; ranks ) ) (dummy offboard) (links afree (z2 a4) (a4 b4) (b4 c4) (c4 d4) (d4 e4) (e4 f4) (f4 g4) (g4 offboard) ) (links bfree (z2 a0) (a0 b0) (b0 c0) (c0 d0) (d0 e0) (e0 f0) (f0 g0) (g0 offboard) ) (links anext (a0 d1) (b0 d1) (c0 d1) (d0 d1) (e0 d1) (f0 d1) (g0 d1) (d1 c1) (c1 b1) (b1 a1) (a1 a2) (a2 b2) (b2 c2) (c2 d2) (d2 e2) (e2 f2) (f2 g2) (g2 g1) (g1 h1) (h1 h2) (h2 h3) (h3 g3) (g3 g2) ) (links cnext (h2 h3) (h3 g3) (g3 g2) (g2 f2) (f2 e2) (e2 d2) (d2 c2) (c2 b2) (b2 a2) (a2 z2) ) (links bnext (a4 d3) (b4 d3) (c4 d3) (d4 d3) (e4 d3) (f4 d3) (g4 d3) (d3 c3) (c3 b3) (b3 a3) (a3 a2) (a2 b2) (b2 c2) (c2 d2) (d2 e2) (e2 f2) (f2 g2) (g2 g3) (g3 h3) (h3 h2) (h2 h1) (h1 g1) (g1 g2) ) (links dnext (h2 h1) (h1 g1) (g1 g2) (g2 f2) (f2 e2) (e2 d2) (d2 c2) (c2 b2) (b2 a2) (a2 z2) ) (links next (x1 x2) (x2 x3) (x3 offboard) ) (links up (b1 i1) (i1 i2) (i2 i3) (i3 offboard) (d1 j1) (j1 j2) (j2 j3) (j3 offboard) (b3 k1) (k1 k2) (k2 k3) (k3 offboard) (d3 l1) (l1 l2) (l2 l3) (l3 offboard) (g2 m1) (m1 m2) (m2 m3) (m3 offboard) (c2 n1) (n1 n2) (n2 n3) (n3 offboard) (f2 o1) (o1 o2) (o2 o3) (o3 offboard) ) (symmetry Up (anext bnext) (cnext dnext) (afree bfree)) (symmetry ?Up (anext bnext) (cnext dnext) (afree bfree)) (zone (name dices) (players ?Dice) (positions x1 x2 x3) ) (zone (name dices-lock) (players ?Dice) (positions x0) ) (zone (name promotion) (players Down) (positions h1) ) (zone (name promotion) (players ?Up Up) (positions h3) ) (zone (name rosette) (players ?Up Up Down) (positions a1 a3 d2 g1 g3) ) (zone (name end) (players ?Up Up Down) (positions z2) ) ) 


This solution can hardly be considered ideal. Players have to memorize all the chips locked in their “pockets”, because they are not displayed on the field! In addition, a person not familiar with the game, it can be difficult to understand what is happening on the board - the chips disappear and appear without any obvious system. In some cases, it is more convenient to use a different approach. If the board field can contain only one figure - let the "piles" themselves be the figures, and not the constituent chips! This approach works ideally for the games of the Mancala family, but if the order in the chip set is important and different shapes can be contained in the stack, combinatorics begins.

Combinatorics, as was said
 (define merge-w (if (piece? w) (add $1w) else (if (piece? b) (add $1b) else (if (piece? ww) (add $1ww) else (if (piece? wb) (add $1wb) else (if (piece? bw) (add $1bw) else (if (piece? bb) (add $1bb) else (if (piece? www) (add $1www) else (if (piece? wwb) (add $1wwb) else (if (piece? wbw) (add $1wbw) else (if (piece? wbb) (add $1wbb) else (if (piece? bww) (add $1bww) else (if (piece? bwb) (add $1bwb) else (if (piece? bbw) (add $1bbw) else (if (piece? bbb) (add $1bbb) else (if (piece? wwww) (add $1wwww) else (if (piece? wwwb) (add $1wwwb) else (if (piece? wwbw) (add $1wwbw) else (if (piece? wwbb) (add $1wwbb) else (if (piece? wbww) (add $1wbww) else (if (piece? wbwb) (add $1wbwb) else (if (piece? wbbw) (add $1wbbw) else (if (piece? wbbb) (add $1wbbb) else (if (piece? bwww) (add $1bwww) else (if (piece? bwwb) (add $1bwwb) else (if (piece? bwbw) (add $1bwbw) else (if (piece? bwbb) (add $1bwbb) else (if (piece? bbww) (add $1bbww) else (if (piece? bbwb) (add $1bbwb) else (if (piece? bbbw) (add $1bbbw) else (if (piece? bbbb) (add $1bbbb) else (if (piece? wwwww) (rw) (add $1wwww) else (if (piece? wwwwb) (add $1wwww) else (if (piece? wwwbw) (rw) (add $1wwwb) else (if (piece? wwwbb) (add $1wwwb) else (if (piece? wwbww) (rw) (add $1wwbw) else (if (piece? wwbwb) (add $1wwbw) else (if (piece? wwbbw) (rw) (add $1wwbb) else (if (piece? wwbbb) (add $1wwbb) else (if (piece? wbwww) (rw) (add $1wbww) else (if (piece? wbwwb) (add $1wbww) else (if (piece? wbwbw) (rw) (add $1wbwb) else (if (piece? wbwbb) (add $1wbwb) else (if (piece? wbbww) (rw) (add $1wbbw) else (if (piece? wbbwb) (add $1wbbw) else (if (piece? wbbbw) (rw) (add $1wbbb) else (if (piece? wbbbb) (add $1wbbb) else (if (piece? bwwww) (rw) (add $1bwww) else (if (piece? bwwwb) (add $1bwww) else (if (piece? bwwbw) (rw) (add $1bwwb) else (if (piece? bwwbb) (add $1bwwb) else (if (piece? bwbww) (rw) (add $1bwbw) else (if (piece? bwbwb) (add $1bwbw) else (if (piece? bwbbw) (rw) (add $1bwbb) else (if (piece? bwbbb) (add $1bwbb) else (if (piece? bbwww) (rw) (add $1bbww) else (if (piece? bbwwb) (add $1bbww) else (if (piece? bbwbw) (rw) (add $1bbwb) else (if (piece? bbwbb) (add $1bbwb) else (if (piece? bbbww) (rw) (add $1bbbw) else (if (piece? bbbwb) (add $1bbbw) else (if (piece? bbbbw) (rw) (add $1bbbb) else (if (piece? bbbbb) (add $1bbbb) )))))))))))))))) )))))))))))))))) )))))))))))))))) )))))))) )))) )) ) 


This nightmare macro is just a small fragment of my implementation of the Focus game, described by Martin Gardner in his Mathematical Leisure (the full version of the nightmare can be viewed here ). The hardest thing was to find and fix all the errors. Of course, it would be possible to automate code generation with prezrf , but, in fact, it is not yet known which of these “two evils” is more evil. However, the program works great:



By the way
In the process of this “holiday coding”, it turned out that the ZoG macros are extremely far from the highest order functions . The first version did not work due to the implementation of this macro:

 (define add-piece (if empty? add else (merge-$1 $2) ) ) 

The substitution of the $ 1 parameter worked fine, but ZoG refused to find the macro by the resulting name (for example, merge-w ), although it was, of course, in the source code! I had to work a little more with my hands.

Of course, this approach does not work in more complex cases. In the "Focus" the size of the "stack" is limited to five chips. Anything that does not fall into this “Procrustean bed” is either transferred to the player’s reserve, or is completely removed from the board (depending on whether the player belongs to the player who performs the move). In “Postcards” the figures never leave the board! During the game, all 24 chips can be lined up in one "tower". At the same time, some of the figures can be ladies! Those interested can count the number of possible options and compare this number with the 62 figures used to implement the Focus. In “Postcards” you need to create a real three-dimensional board:

Description of the board in “Post Bars”
 (define Bdef (image "images\Bashne\bd8x8x2.bmp") (grid (start-rectangle 5 45 53 93) (dimensions ("a/b/c/d/e/f/g/h" (49 0)) ; files ("8/7/6/5/4/3/2/1" (0 49)) ; ranks ) (directions (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1) ) ) (grid (start-rectangle 407 89 455 93) (dimensions ("A/B/C/D/E/F/G/H" (49 0)) ; files ("8/7/6/5/4/3/2/1" (0 49)) ; ranks ("-1/-2/-3/-4/-5/-6/-7/-8/-9/-10/-11/-12/-13/-14/-15/-16" (0 -3)) ; ranks ) (directions (u 0 0 1)(u5 0 0 5) (r 1 0 0) ;scan ) ) ) 


You can see that Karl Scherer was too optimistic about the maximum height of the “towers”. The board, in its implementation, consists of two grids . The left one is a usual two-dimensional board on which players move figures, but all the moves performed on this board are duplicated in the right grid , which contains a detailed description of the figures.

This is the most correct approach to the implementation of such games, but even with it, it will be difficult to implement Tavreli . Taking into account the fact that the installation of other figures on a royal figure is prohibited, the “tower” of maximum height in this game can consist of 31 figures (counting the number of possible options for building towers is an interesting combinatorial problem).

From all the above, it should be clear that the development of effective and concise description of "tower" games is a serious challenge for the developer of a universal game "engine". Unfortunately, I can not say that I solved this problem. It would be tempting to allow more than one piece to be placed on the board, but this decision immediately raises a number of sensitive issues. Is the set of shapes placed on the field ordered? How to determine the owner of the set? What parts of a set can perform a move as a “whole” and according to which rules? I see no rational decisions along the way.

More promising is the possibility of combining figures into sets, in the process of generating a move. You can combine the figures located one above the other (even before the execution of the main phase of stroke generation), and move this set as a whole. The stacked figures are independent and we can always determine the identity of a single piece and the ability to make a move. Most importantly, this approach is universal. In addition to the "tower" games, it allows you to describe all those games in which you are allowed to move groups of pieces in one move (such as Ordo or the Red Donkey puzzle, described by M. Gardner in the same "Mathematical Leisure").

Unfortunately, questions still remain. Figures combined into a set must move “parallel” in one direction, but the chosen direction may not be determined for one of the initial positions of the set! Also, the movement may include performing checks when passing intermediate fields with all the pieces of the set (as in the game " Ordo "). It is completely incomprehensible how to formulate such checks in a concise and understandable way for a person. It is unclear how to implement group movements other than “parallel transfer”, such as turning a part of the board in “ Turn the Tables Checkers ”. In general, there are enough questions. I hope I can solve them.



In conclusion of the article, I will quote from the wonderful blog Gregory (gest), dedicated to another multi-dimensional game :
... Each player has four pieces. Behind each figure there is a trace marking its movements. You can kill the enemy in the past, cutting his temporal line. You can kill an enemy figure in the past and thus resurrect your own figure, at the point where the enemy would have killed her, if he had not been killed before. In a situation where the enemy can cut the temporal line of your figure and thereby resurrect the figure that you previously killed, you can use your other figure to kill an already killed enemy figure even earlier.
People have come up with many games over which you can break your head ...

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


All Articles