Chess ice and flame

              This game is called kaivassa. She was brought to the Boardwalk in the Volantine shopping gallery, and orphans carried her up and down the Green Blood. At the Dornish court, everyone was crazy about her ...
              Ten pieces, each of which walks differently, and the board changes with each game, watching how the players mix their squares. 

                                                       George Martin "Vulture Feast" 

    Cyvasse- Another game born in a work of art. And as it usually happens, the case again could not do without the participation of an army of fans. Although the author pays great attention to the game (in “Dance with the Dragons,” Tirion Lanister only does what he plays), a detailed description of the rules is still not the work of the author of the work of art. However, the fans "did not rust." There are dozens of different implementations of Kaivassa. Square and hexoganal - there are for every taste! I want to talk about the one that I liked the most.

    Most versions of Kaivassa (I won’t say anything, I could have missed something) are the same chess that we have been used to since childhood., only with catapults and dragons. Yes, the pieces move unusually, and you can scatter mountains and ponds along the board with a generous hand, but the principles of the game itself do not change - chess capture and the king to be eaten. Zane Fisher approached the issue more creatively. In my opinion, his version of the game is much deeper in tactical terms. Due to what? Let’s take a look together.


    B of lshaya "naturalness" and reasoning - that first caught my eye. See how the "cavalry" bypasses the "mountains". Each figure, in this game, can move no more than a predetermined number of steps and, performing a “silent move”, it can “rotate” as you like, the main thing is not to return to the previously passed cells and not enter the territory occupied by the enemy or “mountains” ". You can go through the cells occupied by your pieces (the exception is the “Elephant”, which cannot go “through” the other pieces), you can’t just complete the move on them.

    It was a challenge!
    It just so happened that in purely technical terms, implementing such walks on the ZRF is not easy. The course of the figure consists of several steps in an arbitrary direction, as a rule, with the additional condition of not visiting already completed fields. I made a game with similar mechanics, but at that time I used the partial moves mechanism (and even then it was not very successful, in rare cases the figure could drive itself into a dead end). When I really thought that Axiom could not be done here, the solution itself, suddenly, suddenly occurred to me:

    A lot of code
    (define check-target
      (if (position-flag? is-target?)
          (set-flag is-succeed? true)
      )
    )
    (define check-target-dir
      (if (and (on-board? $1)(position-flag? is-target? $1))
          (set-flag is-succeed? true)
      )
    )
    (define check-dir-3
      (if (on-board? $1)
         $1 
         (if (not (or enemy? (piece? Mount)))
             (check-target)
             (if (not-speared?)
                 (check-target-dir $2)
                 (check-target-dir $3)
                 (check-target-dir $4)
             )
         )
         (opposite $1)
      )
    )
    (define check-branch-3
      mark
      (if (on-board? $1)
         $1 
         (if (not (or enemy? (piece? Mount)))
             (check-target)
             (if (not-speared?)
                 (check-dir-3 $1 $1 $2 $3)
                 (check-dir-3 $2 $1 $2 $4)
                 (check-dir-3 $3 $1 $2 $5)
             )
         )
      )
      back
    )
    (define move-3 (
      (check-pass)
      (set-position-flag is-target? true)
      START
      (while (on-board? next)
         next
         (set-flag is-succeed? false)
         (if (or empty? (piece? Point))
             (check-branch-3 w sw nw se ne)
             (check-branch-3 nw w ne se e)
             (check-branch-3 ne nw e w se)
             (check-branch-3 e ne se nw sw)
             (check-branch-3 se e sw ne w)
             (check-branch-3 sw se w e nw)
             (if (flag? is-succeed?) add)
         )
      )
    ))
    (piece
       (name LightHorse)
       ...
       (moves
          (move-3)
          ...
       )
    )
    


    In fact, everything is simple. Instead of trying to pave the way from the current field (with this approach it would be difficult to deal with duplicates of the generated moves), you can mark it with a positional flag, and then, after sorting through all the board fields (fortunately, there are few of them, the board is small), try to get to the marked fields, for a given number of steps. That doesn't sound very impressive, but for me that was a turning point. From that moment I believed that the game can be implemented on pure ZRF.

    The capture is carried out only “in a straight line” and, in most cases, according to the “chess principle” - the piece performing the capture takes the place of the taken piece (here again there is an exception - “Catapult”, which I will discuss below). At the same time, you can take far from any figure! Zane introduces the concept of "engagement» ( Engagement ). As well as capture, “engagement” extends in a straight line, to the number of steps individual for each type of figure.

    Closely related to the concept of “engagement” is the “armament” of a figure. All figures are divided into light, heavy and not armed. “Militia” ( Rabble ) - a light figure, can’t just attack a heavy one, for example, “Elephant” ( Elephant) In order to attack, he needs to “engage” the target with another light (or heavy) figure. On the other hand, the “Elephant” can easily attack the “Militia” (with the exception of the case when it is in the water). As he alone can "hook" any heavy enemy piece, even the "Dragon" ( Dragon ). Not armed ( unarmored ) figures ( "Crossbowman" and "Catapult") may be taken without the "engagement".

    It was not easy either
    Mainly due to the amount of scribble. Different figures have different engagement distances, and indeed, they are different. “Dragon” - can fly through the mountains, “Spearmen” cling to only two fields in front of them, it is necessary to take into account the effect of “water”, and checking for the presence of friendly / enemy “Fortresses” nearby is generally darkness. In general, everything is complicated (and it is possible that there are errors in the code), but everything seems to work as intended:

    Another code
    (define set-engaged
       (if (flag? is-light-engaged?)
           (set-flag is-heavy-engaged? true)
        else
           (set-flag is-light-engaged? true)
       )
    )
    (define check-escape
       (if (or enemy? (piece? Mount))
           (set-flag is-escaped? true)
       )
    )
    (define check-other
       mark
       (set-flag is-escaped? false)
       (if (on-board? $1)
           $1 (check-escape)
           (if (and friend? (not-in-zone? water) 
                (or (piece? Rabble) (piece? LightHorse) (piece? HeavyHorse) (piece? Elephant) (piece? Crossbow) 
                     (piece? Dragon) (piece? Tower) (piece? King)))
               (set-engaged)
               (if (or (piece? HeavyHorse) (piece? Elephant) (piece? Dragon) (piece? Tower))
                   (set-flag is-heavy-engaged? true)
               )
               (if (piece? Tower)
                   (set-flag is-enemy-tower? true)
               )
           )
       )
       (if (and (on-board? $1) (not-flag? is-escaped?))
           $1 (check-escape)
           (if (and friend? (not-in-zone? water) (or (piece? Elephant) (piece? Crossbow) (piece? Trebuchet) (piece? Dragon)))
               (set-engaged)
               (if (or (piece? Elephant) (piece? Dragon))
                   (set-flag is-heavy-engaged? true)
               )
           )
       )
       (if (and (on-board? $1) (not-flag? is-escaped?))
           $1 (check-escape)
           (if (and friend? (not-in-zone? water) (or (piece? Crossbow) (piece? Trebuchet)))
               (set-engaged)
           )
       )
       (if (and (on-board? $1) (not-flag? is-escaped?))
           $1 (check-escape)
           (if (and friend? (not-in-zone? water) (piece? Trebuchet))
               (set-engaged)
           )
       )
       back
    )
    (define check-spears
       (if (on-board? $1)
           (if (and (friend? $1) (not-in-zone? water $1) (piece? Spears $1))
               (set-engaged)
           )
       )
    )
    (define check-friend-tower
       (if (on-board? $1)
           (if (and (enemy? $1) (piece? Tower $1))
               (set-flag is-light-engaged? false)
           )
       )
    )
    (define check-engaged
       (verify (not-piece? Mount))
       (set-flag is-enemy-tower? false)
       (set-flag is-light-engaged? false)
       (set-flag is-heavy-engaged? true)
       (if (or (piece? Crossbow) (piece? Trebuchet))
           (set-flag is-light-engaged? true)
       )
       (if (or (piece? HeavyHorse) (piece? Elephant) (piece? Dragon) (piece? Tower))
           (set-flag is-heavy-engaged? false)
       )
       (check-spears sw) (check-spears se)
       (check-other w) (check-other e) (check-other nw) (check-other ne) (check-other sw) (check-other se)
       (if (and (not-piece? Tower) (not-piece? Crossbow) (not-piece? Trebuchet) (not-flag? is-enemy-tower?))
           (check-friend-tower w) (check-friend-tower e) 
           (check-friend-tower nw) (check-friend-tower ne) 
           (check-friend-tower sw) (check-friend-tower se)
       )
       (verify (and (flag? is-light-engaged?) (flag? is-heavy-engaged?)))
    )
    (define common-1 (
      $1 (verify enemy?)
      (check-engaged)
      add
    ))
    (piece
       (name King)
       ...
       (moves
          (common-1 w) (common-1 e) (common-1 nw) (common-1 ne) (common-1 sw) (common-1 se)
          ...
       )
    )
    


    As I said, there is a lot of scribble, but from now on, game development has become, for the most part, mechanical work. True, there was still a moment with Rabble , but more on that below.

    The distance of “engagement” coincides with the maximum distance of the course of the figure only in the simplest cases ( Rabble , Spears and King ). A usual situation is when the distance at which the “engagement” is possible is less than the maximum stroke of the figure ( Light Horse , Heavy Horse , Dragon ). However, there is an exception. Elephant ( Elephant) - a heavy figure moving only one cell per turn, but he can “hook” an enemy figure at a distance of two cells! Moreover, he can eat it by moving on two cells, but only on condition that no obstacles block the path (unlike other figures, the “Elephant” cannot pass through the cells occupied by other figures. All these features make the game even more interesting, in tactical terms. See, for example, the solution to one of the tasks of the textbook :



    The distance of the "engagement", for the cavalry - one. In order to take an enemy piece (in the absence of other figures that carry out the “engagement”), you have to come close, but during the battle, there is freedom of choice - stop on the field of the taken piece or move on (like a lady in checkers ). The maximum distance is three steps for Light Horse and two for Heavy Horse . Detailed parameters of all figures can be found in the game manual :

    • Rabble (x6) - light armor, movement allowance 1, engagement range 1
    • Spears (x3) - light Armor, Movement Allowance 1, Engagement Range 1
    • Light Horse (x3) - light Armor, Movement Allowance 3, Engagement Range 1
    • Heavy Horse (x2) - heavy armor, Movement Allowance 2, Engagement Range 1
    • Elephant (x2) - heavy armor, Movement Allowance 1, Engagement Range 2
    • Crossbows (x2) - unarmored, Movement Allowance 2, Engagement Range 3
    • Trebuchet (x1) - unarmored, Movement Allowance 1, Engagement Range 4 (min. 2)
    • Dragon (x1) - heavy armor, Movement Allowance 4, Engagement Range 2
    • Tower (x2) - heavy armor, Movement Allowance 0, Engagement Range 1
    • King (x1) - light armor, Movement Allowance 1, Engagement Range 1

    There you can find information about the features of each of the figures. Some of these notes are embarrassing. For example, for "crossbowman» ( CROSSBOWS ) reads as follows: " CROSSBOWS CAN not capture ". Why might a figure incapable of taking enemy pieces be needed? Again, the whole thing is “gearing”! Crossbows is an unprotected figure, incapable of close combat, but it can “capture” enemy figures at a great distance. The next task from the tutorial illustrates this. If the “Crossbowman” moves so as to “capture” all targets, the “Horseman” will be able to beat them in three moves:


    Unfortunately, the puzzle has an annoying flaw

    The distance of the “quiet course” of Light Horse is enough to move to a position from which he can kill all three enemy figures without assistance. In my implementation, I fixed this by moving the “Horseman” figure below.

    Another weakly protected ( unarmored ) figure is the Catapult ( Trebuchet ). Everything is in order here with the capture! The figure hits from a distance, from a distance of two to four steps (the Catapult can’t beat the enemy who is located right next to it). The uniqueness of this figure is that after the capture, the “Catapult” continues to remain in the rear. To take the opponent’s piece, it moves one step in the opposite direction (of course, if there is free space there)! This is an important strategic weapon, "Catapult" must be protected in every way!

    There would be no happiness, but misfortune helped
    In the process of preparing the game for publication, I needed examples of the initial arrangement of figures. This is not a simple matter, and I tried to approach it with all care. At first glance, there is almost no space left for the figures. Something is occupied by mountains, something is water (I don’t want to poke into it either). Fortunately, everything is not as bad as it seems, since most of the figures can freely pass through the territory occupied by other friendly figures. Cavalry can be placed in the second row, behind the "Spearmen" and "Militias". The dragon can be placed anywhere, at all - it flies over the mountains. After a few minutes of torment, I got something like this:



    I sent the distribution to publication and only then noticed that the "Catapults" were located extremely poorly. Yes, I left a place for them, but in the original version of the game, they can’t shoot through the mountains! Perhaps this screenshot would have remained a funny incident, but an interesting idea occurred to me: “why not catapults shoot through the mountains, because they shoot with a canopy”? So the following addition was born : if a mountain suddenly appeared on the path of the shot, the Katapult couldn’t “hook”, but as soon as a “gunner” was found that had already hooked the target, it was quite capable of pulling a pebble at it over the Katapult mountains! In my opinion, this is a good idea, adding even more tactical capabilities to the game.

    The “Fortress” ( Tower ) is another very strange figure. She does not move! Absolutely. In general, this is even logical. Where (except for Japanese cartoons ) have you seen moving fortresses? The task of the fortress is protection (and it copes with this task perfectly). A figure located near a friendly fortress cannot be “hooked”. To kill her, you first have to destroy the fortress, and this is not easy. In addition, the "King" ( King ) is able to "jump" through friendly "Fortress", they find themselves on the other side of it in a single turn.

    It is believed that the fortress does its job too well

    This is the last task from the textbook , which, in theory, should be solved in seven moves. Do not misunderstand me. The king, in this position, can be eaten by the "Horseman" in just three moves! Provided that he will not react to anything when the "Horseman" jumps close to him. In real life, this does not happen. It is obvious to me that by moving the “Catapult” to the right and taking the “Militia” interfering with it using the “Elephant”, the task could be solved in the allotted number of moves. But they interfere with the fortress! While the "Spearmen" are next to them, they cannot be "taken into account", but they are closing the "King"! The original rules say the following:
    A piece that is adjacent to one or more opposing Towers cannot engage any pieces except the adjacent Tower (s)
    Perhaps this meant a situation where a figure could “hook” both the “Fortress” and the figure guarded by it (that is, it stands close to both of them). I do not know. This is a good topic to think about. In the meantime, I let the "Dragon" ( Dragon ) to take shape under the protection of the fortress, from a distance of two steps (in range of his "engagement", but not too close). In my opinion, this brings the game to life a bit.

    It is worth telling about the two weakest figures, to which the expression “small, but not deleted” is equally suitable. "Spear» ( Spears ) - is, in a sense, an analog chess pawns . It can only go forward and attacks only two fields in front of itself (though at the same time it doesn’t turn into anything). How can such a figure be useful? Of course, she has a secret. Controlled by her two fields (only two), none of the enemy figures can "slip" in one turn. For example, this means that the cavalry cannot attack the “Spearman” from the front, even if he is “hooked” by another figure. First she must come close. Spears is an excellent defensive unit reminiscent of the “Bodyguard” ( Hia ) from the Mongolian game Hiashatar.

    With the "Militia" ( Rabble ), things are a little simpler. They can walk (and “beat”) one step, in any direction, like the “King”. The trick is that the player has the right to make two “silent” moves by “Militias” in a row. This is an attacking unit. Having made two “silent” moves, you can create two threats, at different ends of the board. One "Militia" is likely to be eaten, but another can be a breakthrough. I also like this solution madly.

    Although it gave me a number of problems, in terms of implementation
    Here's the thing, the order of moves in ZRF (and in ZoG in general) is rigidly defined. If each player always had to make two moves (as in Marseille Chess ), that would be simple. Something like that:
    (turn-order White White Black Black)
    
    But we need that the right of a second move be granted only after the “silent” move of Rabble and that the second move is also a “silent” move, but of another Rabble . And no other way! And by the way, a right , not an obligation . Here, I had to compromise. It was clear that no progress (skip mechanism pass ) can not do, but the author on this subject expressed very clearly: " of He a must the move a piece, or the forfeit a game ". Fortunately, ZoG provides a mode in which a skipping move is performed (automatically) only in the absence of any allowed moves (this, of course, is also not entirely correct, because, when using this option, the playerdefeat will not be counted, in the absence of the possibility of a move).

    Actually, the code
    (define rabble-1 (
      (set-position-flag from-pos? true)
      (verify (not-enemy? a8))
      (verify (not is-moved?))
      $1 (verify (or empty? (piece? Point)))
      (set-flag other-rabble? false)
      mark START
      (while (on-board? next)
         next
         (if (not-position-flag? from-pos?)
             (if (and friend? (piece? Rabble))
                 (set-flag other-rabble? true)
             )
         )
      )
      back
      (if (flag? other-rabble?)
          (if (empty? a8)
              (create Point a8)
              (set-attribute is-moved? true)
          )
      )
      (if (not-empty? a8)
          (capture a8)
          mark START
          (while (on-board? next)
              next
              (if is-moved?
                  (set-attribute is-moved? false)
              )
          )
          back
      )
      add
    ))
    (piece
       (name Rabble)
       ...
          (attribute is-moved? false)
          (moves
             (rabble-1 nw) (rabble-1 ne) (rabble-1 sw) (rabble-1 se) (rabble-1 w) (rabble-1 e)
          )
       )
    )
    


    The solution is not perfect. Moving the first Rabble, we mark it with an attribute, after which the player is already obliged to find and move some other Rabble (his opponent simply skips one turn). During the second move, by the way, the set attribute is removed and if this does not happen, the game will most likely just stop. Therefore, it is very important, on the first move, to find at least one other Rabble and, if there is none, not to include all this magic! As usual, the thought came backward that it would be nice to also check the possibility of moving this very different Rabble . Fortunately, it was very simple. So the patch was born .

    It remains to talk about the terrain. In addition to the figures, “mountains” and “reservoirs” can be located on the board. Everything is clear with the “mountains” - not a single figure can be located “on the mountain” and only the “Dragon” can fly over the mountains. Of course, the "mountains" block the "overview", preventing the "engagement" of enemy figures (I already spoke about the nuance with the "Catapult"). With "reservoirs" everything is more complicated. It is possible to place figures in them, but with the loss of the possibility of “engaging” them with enemy figures. It also adds tactical diversity to the game.

    In this place, ZoG also has its own characteristics
    If with the “mountains” everything was simple (well, figures and figures), then the “water” was a hassle. No, in principle, I could also make it figures. Once I did it once and that's what it all led to . This was not a lag, but such a design feature! However, at that time there was no choice. Drawing green squares on a black background would take a lot of time and twice or twice inflate an already one and a half megabyte distribution, 90% full of radically black “backs”.

    In general, this time, I drew water directly on the board, simultaneously marking it as a game zone in the description of the game. Unfortunately, in this way, you can draw at least anybut only a fixed card. About any author's "Nine Tile" is no longer a question. A pity ... but there's nothing you can do about it.

    Well, that's all. The game is published , with the kind permission of the author . The interface came out worse than in the original version (for example, “hooks” are not highlighted), but AI works. In any case, the tasks of the textbook are solved "with a bang."



    It plays, in principle, also quite sane (especially if the computer is more powerful, but the time for "thinking" is set more.



    I really liked the game . In tactical terms, it seemed to me no less complicated than Ko Shogi , comparing favorably with the latter in greater “conciseness” and thoughtfulness. All figures work! And a relatively small board is enough for the game. And I’ll think about how to weaken the "Fortress".

    PS
    In general, everything just turned out to be “Fortresses” (I was thinking of difficulties for myself from scratch). In the rules of the game it is written very clearly:
    A piece that is adjacent to one or more opposing Towers cannot engage any pieces except the adjacent Tower (s).
    That is, if the figure is located close to the enemy "Fortress", it can "hook" only the "Fortress" and no other figure! As a result , the ninth task of the " textbook " is solved exactly as it was planned by the author, and an updated version of the game is available on Zillions of Games .
    PPS
    As it usually happens, in the process of writing the first postscript for this article, I suddenly realized that I did not take into account all possible situations. The picture below illustrates the problem:


    In this position, the “Dragon” should “hook” only the nearest “Fortress”, and not both at once. When removing the nearest "Fortress", the remaining "Fortress" and "King" should fall under the battle. Here is the corresponding fix. It should be noted that the situations analyzed in postscripts in the game, although possible, are unlikely. Thanks to this, all the games I saved earlier remained correct after the implementation of the described changes to the game implementation.


    Also popular now: