[ create a new paste ] login | about

Link: http://codepad.org/Gsx9seGq    [ raw code | output | fork ]

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:
1
2
3
4
5
6
7
8
9
10
11
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} 



Create a new paste based on this one


Comments: