Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document functions, add features: 'return to menu', 'remove tiles' #145

Closed
wants to merge 6 commits into from

Conversation

BurhanHTW
Copy link
Contributor

  • Implemented 'Return to Menu' functionality.
  • Added 'Remove Tiles' feature.
  • Unified saving game state and statistics into a single file.
  • Enabled selection of saved game states for continuation.

- Implemented 'Return to Menu' functionality.
- Added 'Remove Tiles' feature.
- Unified saving game state and statistics into a single file.
- Enabled selection of saved game states for continuation.
@BurhanHTW
Copy link
Contributor Author

We have submitted the pull request, and it has been a pleasure to contribute to this project.

Copy link
Owner

@plibither8 plibither8 left a comment

Choose a reason for hiding this comment

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

Code looks good, thank you very much! :)

I can see that a CI workflow is failing. Could you check the error behind it? Ideally, we want these checks to be successful before trusting it to be merged.

Additionally, a couple of changes I'd love to see before merging it:

  • Let's remove the .vscode directory. More details in the review comments.
  • Let's be uniform with how we do in-line comments. Gives much better readability.
  • The added code would benefit from being run against a formater/linter. This will format the code to make it uniform. We've got a .clang-format file that specifies the formatting conventions used in this project.

Nevertheless, I'm approving this PR on the basis of the solid feature code additions -- they look great!

@@ -0,0 +1,18 @@
{
Copy link
Owner

Choose a reason for hiding this comment

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

Let's remove the .vscode files. They're meant for developer-specific configs on local machines, so shouldn't be part of the repository.

Bonus: Add the .vscode folder to the .gitignore file. This should prevent it from being staged and committed in the future as well! :)

@@ -0,0 +1,24 @@
{
Copy link
Owner

Choose a reason for hiding this comment

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

Same with this file... let's remove it.

@@ -0,0 +1,114 @@
{
Copy link
Owner

Choose a reason for hiding this comment

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

...and this one too

* @note The new addition includes 'M' for returning to the menu.
*
* @return std::string A formatted string containing the list of input commands.
*/
Copy link
Owner

Choose a reason for hiding this comment

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

Comments look great, thank you!

* The commands include movements (Up, Left, Down, Right), saving the game, and returning to the menu.
* The prompt is formatted with indentation for readability.
*
* @note The new addition includes 'M' for returning to the menu.
Copy link
Owner

Choose a reason for hiding this comment

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

We can remove this note, since it will get outdated pretty quickly.

@@ -135,7 +149,7 @@ bool canMoveOnGameboardDataArray(gameboard_data_array_t gbda) {
const auto offset_check = {
current_point + offset, // Positive adjacent check
current_point - offset}; // Negative adjacent Check
for (const auto current_offset : offset_check) {
for (const auto &current_offset : offset_check) { //auto REFERENCE current_offset
Copy link
Owner

Choose a reason for hiding this comment

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

commented out code 👀


while (std::getline(stateFile, tempLine)) {
if (tempLine.find('[') != std::string::npos) {
break; // Exit loop if '[' is found
Copy link
Owner

Choose a reason for hiding this comment

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

Great idea here, as well as the -1 to return an error!

@@ -81,7 +128,7 @@ get_and_process_game_stats_string_data(std::istream &stats_file) {
if (stats_file) {
unsigned long long score;
long long moveCount;
for (std::string tempLine; std::getline(stats_file, tempLine);) {
for (std::string tempLine; std::getline(stats_file, tempLine, '.');) {
Copy link
Owner

Choose a reason for hiding this comment

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

Why was the '.' required?

src/menu.cpp Outdated
mainmenustatus[FLAG_START_MENU] = true; // Initial state is Menu
if (mainmenustatus[FLAG_START_MENU] == true) // If the menu flag is set, we enter...
{
soloLoop(); // ... the soloLoop() function, where we navigate the menu
Copy link
Owner

Choose a reason for hiding this comment

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

Let's move these comments to the line above.

@@ -56,7 +56,7 @@ std::string ScoreboardOverlay(scoreboard_display_data_list_t sbddl) {
<< "\n";
};

for (const auto s : sbddl) {
for (const auto& s : sbddl) { // auto REFERENCE s
Copy link
Owner

Choose a reason for hiding this comment

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

commented out code 👀

@plibither8 plibither8 changed the title Documented all functions and added new features: Document functions, add features: 'return to menu', 'remove tiles' Jun 22, 2024
@BurhanHTW
Copy link
Contributor Author

We‘ll try to fix the CI. Hopefully this solved asap :)

@BurhanHTW
Copy link
Contributor Author

I have to switch from C++14 to C++17 in CMakeLists.txt #include in menu.cpp is only supported from C++17 onwards. https://en.cppreference.com/w/cpp/filesystem

@plibither8
Copy link
Owner

I have to switch from C++14 to C++17 in CMakeLists.txt #include in menu.cpp is only supported from C++17 onwards. https://en.cppreference.com/w/cpp/filesystem

Have you tried fixing the issue using the suggestion in the error message? std::_fs::filesystem

@BurhanHTW
Copy link
Contributor Author

BurhanHTW commented Jun 22, 2024

I have to switch from C++14 to C++17 in CMakeLists.txt #include in menu.cpp is only supported from C++17 onwards. https://en.cppreference.com/w/cpp/filesystem

Have you tried fixing the issue using the suggestion in the error message? std::_fs::filesystem

Not yet. But it should fixed by changing C14 to C17.

@plibither8
Copy link
Owner

@BurhanHTW could you push the changes to your branch to re-trigger the CI?

@BurhanHTW
Copy link
Contributor Author

@BurhanHTW could you push the changes to your branch to re-trigger the CI?

I will Push it later when i am at home. We have changed everything what you wanted :)

@BurhanHTW
Copy link
Contributor Author

I cant push anything because the access is denied

@BurhanHTW
Copy link
Contributor Author

BurhanHTW commented Jun 22, 2024

I had to generate a new Token to push. Now we are waiting for the workflow approval. You can see our next commit as i can see

@plibither8
Copy link
Owner

@BurhanHTW your latest commit has many merge conflicts present. Example

Remove all merge markers - they're causing the builds to fail.

@BurhanHTW
Copy link
Contributor Author

@BurhanHTW your latest commit has many merge conflicts present. Example

Remove all merge markers - they're causing the builds to fail.

hopefully done :D

@BurhanHTW
Copy link
Contributor Author

I don’t know what i have Done actually i have to Check the Problems …

@BurhanHTW
Copy link
Contributor Author

BurhanHTW commented Jun 22, 2024

I have to many Problems Right now i try to solve them.

@BurhanHTW
Copy link
Contributor Author

If i have to many Problems. Is it possible to make a new pull Request? I guess i had to many Problems because i commited to many files

@BurhanHTW
Copy link
Contributor Author

If the workflow fails again i‘ll create a new Pull Request and Push the latest Code again. I am sorry to have those issues. :/

@BurhanHTW
Copy link
Contributor Author

So the workflow failed again. I will create a new pull Request.

@plibither8
Copy link
Owner

plibither8 commented Jun 24, 2024 via email

@BurhanHTW BurhanHTW closed this Jun 24, 2024
@BurhanHTW
Copy link
Contributor Author

I have closed this pull request. I will create a new one now.

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