コード例 #1
0
ファイル: cbsolve.c プロジェクト: jfriesse/jfpr
int
solve_rec(struct shape *board, const struct puzzle *p, int current_tile)
{
	int x, y;
	const struct shape *current_shape;

	if (current_tile == p->no_tiles) {
		/*
		 * Found solution
		 */
		printf("Solution:\n");
		dump_board(board, 0);
		dump_board_svg(board);
		printf("\n");

		return (0);
	}

	current_shape = &p->tiles[current_tile];

	for (y = 0; y < board->height - current_shape->height + 1; y++) {
		for (x = 0; x < board->width - current_shape->width + 1; x++) {
			if (can_insert_tile(board, &p->tiles[current_tile], x, y)) {
				insert_tile(board, current_tile + 1, &p->tiles[current_tile], x, y);

				solve_rec(board, p, current_tile + 1);

				remove_tile(board, current_tile + 1);
			}
		}
	}

	return (0);
}
コード例 #2
0
ファイル: editor_scene.cpp プロジェクト: mnewhouse/tselements
 void EditorScene::remove_last_tile(resources::TrackLayer* layer)
 {
   if (auto tiles = layer->tiles())
   {
     if (!tiles->empty())
     {
       remove_tile(layer, static_cast<std::uint32_t>(tiles->size()) - 1);
     }
   }
 }