/* * Copyright (C) 2007 Michael Lewis * Author: Mike Lewis * * This work is provide AS IS, and has no warranty. * The author is NOT responsible for anything that happens * due to use of this code, either using it or running it on * your system */ #include #include #include #include #include "types.h" #include "helpers.h" #include "block.h" int main( int argc, char** argv) { int i; int width = 10, height = 10; int iterations = 10000; int temp_dim; for( i = 0; i < argc; i++ ) { if( !strcmp( "-h", argv[i] ) && i + 1 < argc ){ temp_dim = atoi( argv[i+1] ); i++; if( temp_dim ) { height = temp_dim; } } else if( !strcmp( "-w", argv[i] ) && i + 1 < argc ){ temp_dim = atoi( argv[i+1] ); i++; if( temp_dim ) { width = temp_dim; } } else if( !strcmp( "-i", argv[i] ) && i + 1 < argc ){ temp_dim = atoi( argv[i+1] ); i++; if( temp_dim ) { iterations = temp_dim; } } } llife_world my_world = allocate_world( width, height ); *(my_world->blocks) = allocate_block(); printf( "%x\n", *my_world->blocks ); set_bit_in_world( my_world, 100-50, 100-50 ); set_bit_in_world( my_world, 100-51, 100-50 ); set_bit_in_world( my_world, 100-52, 100-50 ); set_bit_in_world( my_world, 100-54, 100-50 ); set_bit_in_world( my_world, 100-50, 100-51 ); set_bit_in_world( my_world, 100-53, 100-52 ); set_bit_in_world( my_world, 100-54, 100-52 ); set_bit_in_world( my_world, 100-51, 100-53 ); set_bit_in_world( my_world, 100-52, 100-53 ); set_bit_in_world( my_world, 100-54, 100-53 ); set_bit_in_world( my_world, 100-50, 100-54 ); set_bit_in_world( my_world, 100-52, 100-54 ); set_bit_in_world( my_world, 100-54, 100-54 ); int k; for( k = 0; k < iterations; k++ ) { worldCycle( my_world); } return 0; }