HOW IT WORKS - BRIEF GUIDE TO THIS ENGINE
obsah: forced moves: page 8/12

inputs and outputs
first moves
basic analysis
RCboard rules
first 2 layers
flag rules (1D)
flag combination (2D)
LM moves
three structure
delay rules
last analysis

summary

go to page:
pixoria main


Last moves:
During the course of the game a situation can occur when we would need to "take initiative". That is, attack after a series of defensive moves. It might be a last chance (desperate defense) to avert or delay an immediate threat of losing. In these cases we have a chance to succeed only if there is at least one of certain combinations of our symbol on the game board.
Have a look at the flagx rule sequences
5, 6, 7, 8 and 10 (10a, 10b) in image 003 from the previous page and imagine you're player one ( X ) and it's your move. If you now move to any free square marked with letter M, you're only one move away from victory. So let's do that. Now it's the opponent's move ( O ). If the they can't win in that move, they have to defend. That is, place their symbol in a remaining free square in you character sequence.
We've forced the opponent to move to a certain square in a way that gives us a better advantage. So it is a forced move.
If the first player needs to keep their initiative in this way (delay their defeat) for more subsequent moves, they must have more of these sequences at their disposal. But what if they have only one?

If there are none of the required sequences, we can find at least their precursors:
image 005:

If we fill in any (except #7) sequence in image 005 in the square marked by letter L with the X symbol, we'll get the required sequence. So the engine looks for these precursors and records the squares marked with letter L into arrays lastMx and lastMo.

How does a precursor help us, if we only have one move to avert defeat? The trick is that the engine will, in a situation where it needs to force a move and also finds at least two squares marked with M , it will pick the square which is also marked with L (LM). Thus it will force an opponent's move and at the same time create for itself another sequence with M.

The engine searches the game board first in opposite directions forward and back, and if it finds one of the sequences from Last Move rules, it will mark the corresponding free squares in helper array tempLx (tempLo) by number 1.

The searched precursors (Last Move sequences) and sequences with M according to Flag rules (with same orientation) can have common squares in one search line. So the engine will always find a free square that got an M valuation (over 999) in flag arrays and now also L (more than 0) in tempL arrays in one search line (there and back). This is in some cases and in some positions undesirable, and in some to the contrary. The engine will therefore remove the L marks in undesirable positions with the help of a special filter from tempL helper arrays.

click here to view image with LM filter

When a forward-and-back search in one of the four directions is dome, it will add values from the helper array to corresponding values in the work array:
lastMx[row][column] = lastMx[row][column] + tempLx[row][column];
tempLx[row][column] = 0;
//reset temporary

Delays :
Forced moved described in "Last Moves" can be used in another way:
Four differently oriented lines of search (horizontal, vertical, and two diagonals) intersect each other. Each line thus has common squares with the other three. While we're forcing the opponent to make moves in certain three lines, we are creating a winning sequence from our symbols in the remaining line.
The engine is again looking for specific character sequences. In these sequences, the
N characters have a special significance. Important squares are marked in image 003 (Flag Rules) by letters M and CI , take fmx, (fmo), xcx, (oco), xnx (ono). In other words, after a there-and-back search in a line and a correction (filtering) have a value in the helper array
flat a value of 1000, 101 or 102. For further analysis in "delays", it's also important in which of the four search lines the free square got this value.
The engine first has to record these squares along with the line direction into arrays
delayx (delayo):
if((delayx[row][column] == 0) && (flatx[row][column] > 999)) delayx[row][column] = 1;
if((delayx[row][column] == 0) && (flatx[row][column] > 100) && (flatx[row][column] < 103)) delayx[row][column] = 10;
Number 1 in array delayx means this: at the same position in flatx, there's a value of 1000 (M), got in horizontal direction (2: vertical, 3: first diagonal, 4: second diagonal). Similarly 10, 20, 30, 40 for 101 (CI) and 102 (CII).

In the delay arrays, the engine also records one more piece of information: in image 003, rule 10, sequence XXXNN, theres a free square marked M+ (X,X,X,M+,M). If this sequence is part of a longer sequence: NXXXNN, the engine will add number 4 to the square at position marked with M+ in the delay array. This way, the engine will mark the position where it should later look for a "three" structure.

continue on next page . . .




go top independent Machines develop lab (2013) page 8/12