PHP,
pasted
on Sep 18:
|
<?php
$passes = 3;
foreach(range(1, $passes) as $pass)
{
$range = $pass-1;
printf("pass %d:", $pass);
foreach(range(0, $range) as $y)
foreach(range(0, $range) as $x)
scan($x, $y);
echo "\n\n";
}
// this is just a mock, replace with your data
function scan($x, $y)
{
static $yo = -1;
if ($yo != $y) echo "\n";
printf("{x%d,y%d} ", $x, $y);
$yo = $y;
}
|
Output:
|
pass 1:
{x0,y0}
pass 2:{x0,y0} {x1,y0}
{x0,y1} {x1,y1}
pass 3:
{x0,y0} {x1,y0} {x2,y0}
{x0,y1} {x1,y1} {x2,y1}
{x0,y2} {x1,y2} {x2,y2}
|
|