📜 ⬆️ ⬇️

Let's play debug this Sunday night?

Have you ever thought that there are games that are themselves a programming language? Not necessarily Turing-complete, but still language. I have a great example. The gameplay of Neuroshimy-6 is monstrously similar to debug. Outside, of course, it looks like a strategy, but inside - it is, debugging, dear.

Look here at this picture from the life of the Wasteland fighters.


')
Chips from 20/20 are command centers, the remaining two are chips of fighters with melee attacks in the direction of triangles along the edges. For now, everything is simple - a blue robot with knives hits a yellow cowboy, and a cowboy hits on a blue commander. Let's complicate the stack and run the compilation.

Suppose the situation is this:



Now priorities are important to us - these are the numbers on the chips. This is the stack instruction level. If you start the execution of the battle in the picture above, you get the following:

== Layer 3
The yellow punk with priority 3 hits the mutant and destroys it (if this were not done, the mutant would break the yellow center in step 2). No one else with that priority. Go below.

== Layer 2
The yellow runner and the “cowboy” simultaneously beat the blue commander, and the “cowboy” beat the robot with knives. The center loses 2 armor units, the “cowboy” is destroyed.

== Layer 1
With priority 1 there is nobody. This part of the stack is simply skipped.

== Layer 0
The centers operate with priority 0 and hit all the enemies nearby. Blue Komtsentr shoots and destroys the runner and friend with a serrated knife. He would have destroyed the "cowboy," but that's bad luck - it’s already two bars as it is.

The end of the stack . Enter new data.

Try it yourself to make out the situation with such data at the entrance?




Here, the module with a plus takes over the attack of one of the fighters to which it is connected. That is, roughly speaking, the mutant near the yellow center received a second life. The blast chip is the yellow ones from the current state that started the execution of the stack. The grid of a yellow guy with a gun is a blockage: the enemy piece, on which the grid is directed, does not fall on the stack.

Lost the situation in your head? How many hits have a comcenter left? What chips are still on the field after complete stack parsing?

This is what should happen:


The essence of the game is to lay out 2 of 3 chips each turn in an optimal way. Each of the players in the head loses the possible options for parsing the stack and locates its operator troops as it is most advantageous to it. In the mess of real combat, even a simple move becomes a real debugging:


Pay attention to the red shooters - they hit the nearest alien chip in the direction of the attack, but do not hit their troops.

Now you yourself




You play for the red raiders - Hegemony. Your command center has 2 hits, the opponent has 6. It is necessary to pick up and put on the field 3 chips out of five available. After that, a compilation will start, and at the end of the execution the opponent should have fewer hits than you. Chips can be rotated.

Let's see what we have: a guy with melee and ranged combat can drive two damage at once, and he is fast. A strong guy with a double melee attack in three directions, armor and protection (he has 2 hits, unlike all other single-hit units) is also good, but damn slow. Another fighter with a double melee attack on the upper sector is a compromise between speed and power. And the two raiders are very fast, not so strong.

The answer is simple:



Another entity - orders


Moving (curve arrow) allows you to move any of your chips to the next free one and rotate if you want. You can only move, you can only rotate, you can and that, and then. With the help of a push (up arrow) before compiling, you can move another chip. Yours pushes her away from the cell. If there is a free cell near the pushed chip, and in that cell the pushed chip will be farther from your pusher than before, you can use this order. Sniper shot removes one hit from any enemy unit, that is, destroys everything that is not armored.


You have a hit, the green enemy has two. Yes, one more. The comcenters can give bonuses to their neighboring chips: a triangle means an increased attack (here, a guy with a crooked knife gets a second melee attack), the stars in greens can go onto the stack twice (on their own initiative and below, that is, the shooter above the green comcenter will attack twice on 3 and 2).

Here is the solution:


And the last language construct is modules.


These are units that change the properties of the neighbors to which they are connected with rods. The triangle and plus is an enhancement of the corresponding attack. +1 is an increase in speed, that is, the priority of processing in the stack. Plus - this is protection against a single attack (instead of the attacked troops, the module accepts an attack on itself with a plus). Task:


You have a hit, while yellow and blue enemies have three hits each. You can use any three modules out of five, we have a democracy. The enemy comcenter gives a plus to the initiative (the shooter behind the blue commander shoots at phase 4 at the very top of the stack), yours - reinforces by 1 ranged battle.

Here is the solution, try to figure it out. Slowly but surely, we come to cycles and recursion, feel?



One of the armies has the opportunity to build an infinite loop, inflicting endless damage until the end of the stack analysis.

More difficult


Here's a sketch, you can quickly push the enemies? You play as red, you have 1 hit. Yellow has 6 hits, green has 3, and blue has 2.



Choose any three chips out of five.

Here is the answer:


See how cool? Now imagine that in a real game such debugging is every turn. That's why I'm talking about the tactical debug simulator, yes, yes, yes.

Here is the original board game , on the page of which there are detailed rules.

Prize Etude



You are the Outpost.

If you solve this problem
It is necessary to attach a picture of the situation in the comments before the “compilation”, which will lead to your victory - at least with photos from the choices, even on a napkin, at least in words, but definitely. The first to decide the box Neyroshima with delivery in the Russian Federation. If you enjoy this Sunday game, I will continue with the tasks.


This problem is solved.
Hidden text
In the comments one solution, here is the classic one:



Actually, why am I doing this. If you are a developer, you will definitely like the game. We found another use for it - we advised parents as a teacher of logic-programming.

PS The second prize task, the etude “blocking on mutexes”:


Here it will be necessary to get into the rules for the exact formulation of the action of networks and network paradox. The first to decide other than winKING will also receive a box.

Decision:

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


All Articles