You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`fun playGame(secret: String, maxAttemptsCount: Int): Unit {
var currentUserWord = getHiddenSecret(wordLength)
var complete = false
var guess: Char
var attempts = 0
while (true) {
if (isLost(complete, attempts, maxAttemptsCount)) {
println("Sorry, you lost! My word is $secret")
break
}
if (isWon(complete, attempts, maxAttemptsCount)) {
println("Congratulations! You guessed it!")
break
}
guess = safeUserInput()
currentUserWord = getRoundResults(secret, guess, currentUserWord)
complete = isComplete(secret, currentUserWord)
attempts++
}
}`
When I run my program, it exits correctly after 9 failed guesses or solving the puzzle. However, when running the tests (that appear to test it with random inputs?) it gives me this error
Try to run the main function with the user input: V A W G T C U R D J L P Z Q F O K I X B Y H N M E S , the function must process the input and exit, but the current version of the function waits more user inputs, it must be fixed.
Now from what I gather, the program should be terminating after 8 inputs not 9, so if i change the initialization from var attempts = 0 to var attempts = 1, and run the program, it terminates after not getting the word in 8 tries, but now gives me an additional failed test ("You are asking the user to enter data fewer times than required in the task!") and still gives me failure of the not terminating test?
Not understanding why when I run the program in the terminal it successfully terminates but doesn't in the course's test, is this an error in the program or the test?, and also not understanding why if max attempts is supposed to be 8, the other test passes on 9 tries but fails on 8?
The text was updated successfully, but these errors were encountered:
When I run my program, it exits correctly after 9 failed guesses or solving the puzzle. However, when running the tests (that appear to test it with random inputs?) it gives me this error
Try to run the main function with the user input: V A W G T C U R D J L P Z Q F O K I X B Y H N M E S , the function must process the input and exit, but the current version of the function waits more user inputs, it must be fixed.
Now from what I gather, the program should be terminating after 8 inputs not 9, so if i change the initialization from var attempts = 0 to var attempts = 1, and run the program, it terminates after not getting the word in 8 tries, but now gives me an additional failed test ("You are asking the user to enter data fewer times than required in the task!") and still gives me failure of the not terminating test?
Not understanding why when I run the program in the terminal it successfully terminates but doesn't in the course's test, is this an error in the program or the test?, and also not understanding why if max attempts is supposed to be 8, the other test passes on 9 tries but fails on 8?
The text was updated successfully, but these errors were encountered: