-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feedback #1
base: feedback
Are you sure you want to change the base?
Feedback #1
Conversation
let color3; | ||
let color4; | ||
|
||
function startGame() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L'idée d'avoir une fonction pour lancer le jeu est bonne. Tu pourrais factorise la recuperation des 4 couleurs avec une boucle
let color4; | ||
|
||
function startGame() { | ||
color1 = prompt( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca pourrait etre interessant de valider que le joueur a bien donné une des couleurs disponible
} | ||
|
||
function validateGuess() { | ||
if (secretColors.length == currentResult.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici, tu verifie que la réponse a le même nombre de caractere que le resultat caché. Du coup, si le resultat caché etait : "toto" et que ta réponse était "tata", ca considererait que tu a gagné.
Tu peux essayer de verifier couleur apres couleur avec une boucle et des tableaux.
console.log("You lost the game! 😥"); | ||
} | ||
} | ||
validateGuess(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ici, tu n'execute validateGuess que deux fois.
Il faudrait faire en sorte de l'executer tant que la condition de fin de partie n'est pas resolue.
validateGuess(); | ||
|
||
function resetGame() { | ||
if (allRounds == allTries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sauf erreur, allTries n'est pas utilisé, mais c'est une bonne idée pour definir la fin de la partie. Tu pourrai l'incrementer a chaque fois que tu execute validateGuess par exemple.
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to the default branch since the assignment started. Your teacher can see this too.
Notes for teachers
Use this PR to leave feedback. Here are some tips:
For more information about this pull request, read “Leaving assignment feedback in GitHub”.
Subscribed: @neel915