Esempio n. 1
0
uint SimonEngine::loadTextFile_gme(const char *filename, byte *dst) {
	uint res;
	uint32 offs;
	uint32 size;

	res = atoi(filename + 4) + _textIndexBase - 1;
	offs = _gameOffsetsPtr[res];
	size = _gameOffsetsPtr[res + 1] - offs;

	readGameFile(dst, offs, size);

	return size;
}
Esempio n. 2
0
int main(int argc, char *argv[]) {
	int k=0, gg=0;
	Game *g;
	nGames = 0;

	init_args(argc, argv);

	srand(time(NULL));

	readGameFile(_file);
	for (gg = 0; gg < 13; gg++) {
		printf("Entropy of Game %u Size %u : Entropy %u\n", gg+1, games[gg]->size, calcEntropy2(games[gg]));
		//printGame(games[gg]);
		g = games[gg];

		g = initialize_search(g, &k);
		if (check(g)) {
			printf("%s0 (%u)\n", g->moves, k);
		} else {
			printf("%s", g->moves);
        }
        g->moves[0] = '\0';

		if(g != games[gg]) {
			free(g->pancakes);
			free(g->moves);
			free(g);
		}
		k=0;
	}
	//Trivial Solution
	/*printf("Games : %u\n", nGames);

	for(i=0; i<nGames; i++) {
		printf("Game %u - Size %u\n", i+1, games[i]->size);
		g = games[i];
		for(j=0; j<g->size; j++) {
			printf("%u ", g->pancakes[j]);
		}
		printf("\n");
		pancakeFlipSort(g);
		printf("0 (%u)\n", g->flips);
		//for (j = 0; j < g->size; j++) {
		//	printf("%u ", g->pancakes[j]);
		//}
		printf("\n");
	}*/

	return 0;
}