Kushal997-das / Project-Guidance

:octocat:🌟 The Ultimate resources for beginner to advanced level projects all in one place 💻 🎯🚀
https://shubhamkumaar.github.io/Temp/
MIT License
522 stars 398 forks source link

Randomize Letter Points and Optimize Scoring Function #1532

Open KashishJuneja101003 opened 2 days ago

KashishJuneja101003 commented 2 days ago

Initiative (Required)

GSSoC (Girl Script Summer of Code) 🌸

Is your feature request related to a problem? Please describe.

Current Code Issue: The compute_score() function contains an unnecessary nested loop, which makes it less efficient. The point system remains static, reducing the game's variability and excitement.

Describe the solution you'd like.

To improve the game's functionality, I propose the following changes:

Tasks:

  1. Randomize Points for Each Letter:

    • Replace the fixed point values for letters with a random point system where each letter has a different value on every game run.
    • Points should be randomized between 1 and 10 for every new game.
    • Use rand() to generate random values and srand(time(0)); to seed the random number generator.
  2. Optimize compute_score() Function:

    • Eliminate the nested loop that checks each letter of the alphabet for every character in the word.
    • Use direct indexing to access the points for each character based on its ASCII value (c - 'a').
  3. Remove Unused Variables:

    • Clean up any unused variables (such as t in the original code).
  4. Separate Score Calculation and Output:

    • The compute_score() function should return the score, while the main program should handle printing the score for better separation of concerns.
  5. Additional Features:

    • Optional: Add an option to display the randomized point values for testing purposes.

Expected Outcome:

Add any other context or screenshots about the feature request here.

No response

github-actions[bot] commented 2 days ago

@KashishJuneja101003

It's great having you contribute to this project

Thanks for opening this Issue 🙌 , Welcome to Project Guidance 💖 We will review everything and get back to you.
Make sure to give a star to this repo before making a fork! Thank you :)

KashishJuneja101003 commented 2 days ago

Kindly assign this issue to me under gssoc-ext and hactoberfest-accepted. Thank You!

SakiraAli1115 commented 4 hours ago

I am the mentor of this project. @KashishJuneja101003 Hello I appreciate your pull issue, can you give working video, screenshot after update the output!! Thank you!!