setT (EMPTYCELL); _king (xi-1, yi-1); true; p>
}
} ((x + i +1) <8 && (yi-1) <8)
{(points [x + i] [yi]. getT () == RED)
&& points [x + i +1] [yi-1]. getT () == EMPTYCELL)
{(x, y, x + i +1, yi-1); [x + i] [yi]. setT (EMPTYCELL); _king (x + i +1, yi-1 ); true;
}
} ((xi-1) <8 && (y + i +1) <8)
{(points [xi] [y + i]. getT () == RED)
&& points [xi-1] [y + i +1]. getT () == EMPTYCELL)
{(x, y, xi-1, y + i +1); [xi] [y + i]. setT (EMPTYCELL); _king (xi-1, y + i +1 ); true;
}
}
} false;
} Life :: refresh ()
{(size_t i = 0; i
} Life :: move_ai_king (size_t x, size_t y)
{(points [x] [y]. getT () == REDKING)
{(x, y, x-1, y-1); true;
{(x, y, x-1, y +1); true;
}
} false;
} Life :: move (size_t x, size_t y, size_t new_x, size_t new_y)
{buf; = points [new_x] [new_y]; [new_x] [new_y] = points [x] [y]; [x] [y] = buf; true;
} Life :: setCell (const QPoint & pos, bool value)
{(gridSize (). width ()> pos.x () && (). height ()> pos.y ())
{[pos.x ()] [pos.y ()] = value;
}
} Life :: cell (const QPoint & pos) const
{(gridSize (). width ()> pos.x () && (). height ()> pos.y ())
{cells [pos.x ()] [pos.y ()];
} false;
} Life :: Cell_King (size_t x, size_t y)
{(points [x] [y]. getT () == RED && x == 7)
{[x] [y]. setT (REDKING); true;
} if (points [x] [y]. getT () == BLUE && x == 0)
{[x] [y]. setT (BLUEKING); true;
} false;
} Life :: deleteCells ()
{(size_t i = 0; i
{[] cells [i]; [] points [i];
} [] cells; [] points; = 0; = 0;
}
LifeWidget.cpp
# include
# include "life.h"
# include "lifewidget.h"
# include "ai_tree.h"
# include "point.h"
# include
# include "mainwindo...