#!/usr/bin/perl

#
# usage: worldBuilder <outfile> <x> <y> <z>
#

########################
# Parse the command line

my $outfile = "$ARGV[0]";
chomp ( $outfile );
my $x = "$ARGV[1]";
chomp( $x );
my $y = "$ARGV[2]";
chomp( $y );
my $z = "$ARGV[3]";
chomp( $z );

my $xx = 0;
my $yy = 0;
my $zz = 0;
my $count = 0;

print("RUNNING worldBuilder $outfile $x $y $z...\n\n");

system("echo '~startCatoms' >> $outfile");
for($xx = 1; $xx<$x; $xx++)
{
    for($yy = 1; $yy<$y; $yy++)
    {
	for($zz = 1; $zz<$z; $zz++)
	{
	    $count++;
	    my $xxx = $xx * 2;
	    my $yyy = $yy * 2;
	    my $zzz = $zz * 2;
	    $line = "$count,$xxx.00,$yyy.00,$zzz.00,1,1,3";
	    system("echo '$line' >> $outfile");
	    
	}
    }
}
