Skip to content

MathGame implementation - #796

Closed
lisaaksionova wants to merge 4 commits into
the-csharp-academy:mainfrom
lisaaksionova:main
Closed

lisaaksionova wants to merge 4 commits into
the-csharp-academy:mainfrom
lisaaksionova:main

Conversation

@lisaaksionova

Copy link
Copy Markdown

Implemented Math Game with chellenges:

  • Levels of difficulty
  • Timer
  • DRY

@github-actions

Copy link
Copy Markdown

🚀 Project Submitted!

Thanks for submitting your project! I will review it soon.

📋 Please check the dashboard to make sure the project is marked as Pending.

⚠️ If it's not marked as pending, submit it manually using the URL for this PR.

@TheCSharpAcademy

Copy link
Copy Markdown
Collaborator

@lisaaksionova Project approved! 😄✅ And well done for completing the challenges! I recommend you always do that, as it pushes you and makes you learn faster. Your project is clean, tidy, concise and to the point. And you're using only one method for all operations, great work!

🥋And congratulations! You got your green belt!! 🟩🟩

Feedback
🔍️ In GenerateNumbers(), you have this condition:

if (operation == Operation.Division &&
    (num2 == 0 || num1 % num2 != 0 || num1 > num2))
    return GenerateNumbers(operation);

The num1 > num2 condition means you're excluding many perfectly valid division questions, such as 8 / 2. You can remove that condition to allow more variety.

🔍️Methods like GetAnswer() and ChooseOperation() call themselves when input is invalid. Although this works, using a while loop would be preferable. It avoids unnecessary recursive calls and makes the validation logic easier to follow.

🔍You could also use named tuples or custom classes or records for game history. Example:

private static readonly List<(int Score, TimeSpan Duration)>
    gameHistory = [];

This allows you to access game.Score and game.Duration instead of Item1 and Item2.

🔍Your game history currently displays only the score and time spent on each round. Consider also recording which mathematical operations were played and the difficulty level selected.

☕If you like our roadmap, please consider buying us a coffee. We appreciate your help 🙂

👪Oh and if possible join our Discord Community and add your username to your profile so you can be part of the community as well. 😁

Overall great work!✋🏻Looking forward to seeing your next projects!

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