Exemplo n.º 1
0
BOOL CSolverDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
	std::ofstream file(lpszPathName);

	// numbers
	saveBlocks(file, m_cols_blocks);
	saveBlocks(file, m_rows_blocks);

	// board
	file << "// board" << std::endl;
	file << m_field << std::endl;

	// solution
	file << "// solution" << std::endl;
	file << m_nonogram.getRealField() << std::endl;

	return TRUE;
}
Exemplo n.º 2
0
int main() {
	int restoreState = 1;
	
	if (restoreState == 0) {
		generateVertical("");
		
		printf("LeftBlock count: %d\n",leftBlock.size());
		printf("RightBlock count: %d\n",rightBlock.size());
		printf("MidBlock count: %d\n",midBlock.size());
		
		for (int i=0; i<2; i++) {
			printf("Running iteration %d...\n",i);
			combiner(LEFT);
			combiner(RIGHT);
			combiner(MIDDLE);
		}
		
		printf("sorting...\n");
		std::sort(leftBlock.begin(), leftBlock.end());
		std::sort(rightBlock.begin(), rightBlock.end());
		std::sort(midBlock.begin(), midBlock.end());
		
		// Output blocks to file to speed up startup
		saveBlocks();
	} else {
		// Load blocks from last run
		loadBlocks();
		// Load last iteration
		loadRootIt();
	}
	
	printf("\nLeftBlock count: %d\n",leftBlock.size());
	printf("RightBlock count: %d\n",rightBlock.size());
	printf("MidBlock count: %d\n",midBlock.size());
	printf("L: %d  M: %d  R: %d\n",leftWidth,midWidth,rightWidth);
	
	maxLevel = (puzzleWidth-leftWidth-rightWidth)/midWidth + 2;
	printf("Max Level: %d\n",maxLevel);
	solver("",0);
	
	// Close solutions file
	outFile.close();
	return 0;
}
Exemplo n.º 3
0
void DBManager::save() {
	char command[MAX_STR_LENGTH];
	sprintf(command, "mkdir .\\%s", DATA_PATH);
	if (system(NULL))
		system(command);

	savePlayers();
	saveEnemies();
	saveNPCs();
	saveTools();
	saveItems();
	savePowUps();
	saveBosses();
	saveBlocks();
	savePigeon();
	saveKeyObj();
	saveFinalElem(),
	savePuzzleElems();

	// Creamos el archivo de Log
	char file_path[MAX_STR_LENGTH];
	sprintf(file_path, ".\\%sLog", DATA_PATH);
	FILE* file =fopen(file_path, "wb");
	fclose(file);

	// Estos métodos además se encargan de copiar los respectivos archivos a la carpeta del juego
	saveGfx();
	saveEssentialElems();
	saveTileSets();
	saveSfx();
	saveDoors();

	sprintf(command, "del \".\\%sLog\"", DATA_PATH);
	if (system(NULL))
		system(command);
}