Exemple #1
0
nemo_main ()
{
    setparams();
    outstr = stropen(getparam("out"),"w");
    cube_create(outstr);
    strclose(outstr);
}
Exemple #2
0
void startup(void)
{
    last_time   = 0;

    zoom        = 0.5;                                                         \
    rotation_x  = 0.0;
    rotation_y  = 0.0;

    position_x  = 0.0;
    position_y  = 2.0;
    position_z  = 5.0;
    
    keyboard_dx = 0.0;
    keyboard_dy = 0.0;
    keyboard_dz = 0.0;
    
    C =  cube_create();
    P = plane_create(20);

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
}
Exemple #3
0
void startup(void)
{
    rotation_x =  0.0;
    rotation_y =  0.0;

    position_x =  0.0;
    position_y =  2.0;
    position_z =  5.0;

    C =  cube_create();
    P = plane_create(20);

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
}
Exemple #4
0
void main()
{
    cube_create();
	cube_show();
	
}
Exemple #5
0
int main(int argc, char **argv) {
	char* initial_cube = NULL;
	char* target_cube = NULL;
	char* sequence = NULL;
	
	int i;
	int output_limit = -1;
	
	if (argc) {
		if (argv[0][0] == '.' && argv[0][1] == '/') {
			PROGRAM_NAME = &argv[0][2];
		} else {
			PROGRAM_NAME = argv[0];
		}
	}
	
	while (argc-- > 1) {
		argv++;
		
		if (is_valid_sequence(*argv)) {
			if (sequence) {
				error("Invalid argument, already got a sequence");
			}
			sequence = *argv;
		} else if (is_valid_cube_data(*argv)) {
			if (!initial_cube) {
				initial_cube = *argv;
			} else if (!target_cube) {	
				target_cube = *argv;
			} else {
				error("Invalid argument, too many cube arguments");
			}
		} else if (is_option(*argv, 'h', "help")) {
			usage();
		} else if (is_option(*argv, 'l', "limit")) {
			if ((output_limit = atoi(*++argv)) <= 0) {
				output_limit = -1;
			}
			argc--;
		} else if (is_option(*argv, 'b', "best")) {
			output_limit = 1;
		} else if (is_option(*argv, 'a', "all")) {
			output_limit = -1;
		} else if (is_option(*argv, 's', "sequence")) {
			if ((MAX_SEQUENCE_SIZE = atoi(*++argv)) <= 0) {
				MAX_SEQUENCE_SIZE = DEFAULT_SEQUENCE_SIZE;
			}
			argc--;
		} else {
			error("Invalid argument");
		}
	}
	
	if (!sequence && initial_cube && !target_cube) {
		target_cube = initial_cube;
		initial_cube = DEFAULT_CUBE;
	} else if (sequence && !initial_cube) {
		initial_cube = DEFAULT_CUBE;
	}
	
	if (!sequence && !initial_cube && !target_cube) {
		error("No arguments given");
	}
	
	cube_t* cube = cube_create(initial_cube);
	
	if (sequence) {
		cube_transform(cube, sequence);
		printf("%s\n", cube->data);
	} else {
		
		solutions_t* solutions = brute_solutions_create(SOLUTION_LIMIT);
		
		brute_cube(solutions, cube, target_cube);
		
		brute_solutions_sort(solutions);
		
		if (output_limit < 0 || output_limit > solutions->size) {
			output_limit = solutions->size;
		}
		
		for(i = 0; i < output_limit; i++) {
			printf("%s\n", solutions->array[i]->sequence);
		}
		
		brute_solutions_free(solutions);
	}
	cube_free(cube);
	
	return 0;
}