Skip to content

Add level infos on reset#15

Merged
taufeeque9 merged 8 commits intosokobanfrom
tf/add-level-infos
Jul 11, 2024
Merged

Add level infos on reset#15
taufeeque9 merged 8 commits intosokobanfrom
tf/add-level-infos

Conversation

@taufeeque9
Copy link
Collaborator

No description provided.

@taufeeque9 taufeeque9 requested a review from rhaps0dy July 2, 2024 09:45
Copy link

@rhaps0dy rhaps0dy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions for improvement. The truly required ones are the -> ones.

int verbose;

std::vector<SokobanLevel>::iterator GetLevel(std::mt19937& gen);
std::pair<std::vector<std::pair<int, SokobanLevel>>::iterator, int> GetLevel(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a relatively simple data structure ( tuple[list[tuple[int, Level]], int] ), but I think this would benefit a lot from having names. Probably what I'd do is:

struct TaggedSokobanLevel {
  int file_idx, level_idx;
  SokobanLevel data;
}

which would make it much easier to parse what's the output of this and what's going on in level_loader.cc.

Also minimizes refactoring. It would also be a possibility to name this struct SokobanLevel and make the original one SokobanLevelData. Idk.

@taufeeque9 taufeeque9 requested a review from rhaps0dy July 9, 2024 00:02
Copy link

@rhaps0dy rhaps0dy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- though see tips for avoiding copies

I think the other SokobanLevel level = ...GetLevel(). are not copies because of this https://stackoverflow.com/questions/14856344/when-should-stdmove-be-used-on-a-function-return-value

@taufeeque9 taufeeque9 merged commit aa270fc into sokoban Jul 11, 2024
@taufeeque9 taufeeque9 deleted the tf/add-level-infos branch July 11, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants