I wrote an algorithm that *should* do it (may be bugs) but it timesout, and i would like a quicker way of doing it:
Code: Select all
for ($x = 1; $x < 8; $x=$x+2)
{
for ($y = 1; $y < 8; $y=$y+2)
{
if ($boardї$x]ї$y])
{
while ($boardї$x1]ї$y1])
{
$x1++;
if ($x1 > 7)
{
$y1++;
$x1=1;
}
}
$boardї$x1]ї$y1] = $boardї$x]ї$y];
$boardї$x]ї$y] = 0;
}
}
}[edit] I know I can start the array on 0, but this makes it easier to read, as I write it to a database, starting with row 1.