Skip to content

16 bugs found and fixed#251

Open
nishakrips wants to merge 1 commit intoCode-the-Dream-School:mainfrom
nishakrips:debugging
Open

16 bugs found and fixed#251
nishakrips wants to merge 1 commit intoCode-the-Dream-School:mainfrom
nishakrips:debugging

Conversation

@nishakrips
Copy link
Copy Markdown

Here are the list of bugs found and fixed :-

  1. When the game starts all messages are displayed.
  2. The submit guess button does not do anything
  3. The Reset button is not displaying as button but text.
  4. There seem to be syntax errors in the code with function keyword and the comparison operator.
  5. The setup function is not getting called when the application starts which is why all message are displaying.
  6. Setup method is assigning a value to constant maxNumberOfAttempts = 0. we cannot reset max number of constants as it is a const and also as per the functionality we want to limit to 5 attempts.
  7. hideAllMessages throws an error Uncaught TypeError: Cannot read properties of undefined (reading 'style’). It’s because the array index since starting with 0 has to be less than the length of array 5 as 5 elements will be at indexes 0-4. <= makes the for loop access the element at index 5 which does not exist and hence undefined.
  8. The number of times remaining for guessing is not correct
  9. maxNumberOfAttempts is getting reset to 0 instead of 5
  10. It is allowing to guess more than 5 times
  11. We are displaying the attempts made and not how many are remaining
  12. Also remainingAttempts needs to be calculated before displaying them in checkGuess.
  13. If the guessed number is greater than the target number the message is incorrect still showing too low
  14. When you guess correctly, the program enables Reset button to allow playing again. But the reset functionality does not allow submission as Submit Guess button is disabled.
  15. On Reset, attempts count has to be reset back to 0
  16. In setup function submit button is still disabled even after reset as there is a spelling mistake in disabled submitButton.disabeld

Copy link
Copy Markdown

@gacurl gacurl left a comment

Choose a reason for hiding this comment

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

Overall Feedback

Game logic works and core debugging tasks appear implemented. The guessing flow, attempt tracking, and reset behavior are mostly correct. One rubric gap: the max guesses message is never displayed, even though the element exists in the HTML.

Summary

The debugging assignment largely works and the game flow behaves correctly. Final improvement is to display the max guesses message when attempts run out and correct the guess count displayed after a win.

Comment thread index.css
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

index.css

Works

  • Simple layout using flexbox
  • Input and reset button styled appropriately

Improve

  • CSS is minimal but sufficient for the assignment.

Comment thread index.html
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

index.html

Works

  • Correct input field and buttons
  • Message elements present for game feedback
  • Reset button exists and is hidden at start

Improve

  • HTML comment before the script tag is malformed:
    <!- should be <!--
  • max-guesses message exists but is never triggered by the JS.

Comment thread index.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

index.js

Works

  • Random number generation implemented
  • Attempts tracked correctly
  • Messages hidden and displayed properly
  • Input validation for <1 and >99 implemented
  • Submit and reset event listeners working
  • Game state resets correctly with setup()

Improve

  • max-guesses message is never shown when attempts reach 5.
  • Correct guess message reports number of guesses incorrectly:
    it displays maxNumberOfAttempts - attempts instead of the actual guesses made.

Suggested fix

  • When attempts === maxNumberOfAttempts and guess is incorrect, display maxGuessesMessage.

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