Ask coding questions

← Back to all posts
Hangman challenge
Christopher_XX (0)

Hello coding fam... I am a little lost with the guess(char)Boolean aka hangman game... I can’t get it to build in Gradle file and I’m fairly new to Kotlin ... can someone please give me some knowledge...πŸ‘¨πŸΎβ€πŸ’»πŸ—£πŸ€˜πŸ½

TheImagin33r (25)

hang man is a game about guessing words or the stick man commits die

Christopher_XX (0)

@TheImagin33r ok how do u put that into build on android studio

TheImagin33r (25)

@Christopher_XX stickman commits suicide over you not guessing a word correclty

PDanielY (731)

May I view your code please?

PDanielY (731)

@Christopher_XX All I see is a black screen!

Christopher_XX (0)

@AppliDev sorry don't know why its not displaying.,but its theold guess(makeChar) print display > Boolean hangman challenge im going to try and upload again

Christopher_XX (0)

@AppliDev Note: The project will not build or run until you complete the following steps

First, you'll need to write is the makeGuess(c: Char) : Pair<String, Boolean> method. This method will allow the user to make a guess with a single Character, and will return two values (a Pair) that represent the masked or incomplete word (ie: lmbd) and a Boolean (true/false) for whether or not they have won. Some of the code for this method has been written for you -- you'll learn more about the Kotlin-specific data types like Pair and Triple later in the course.
Complete the method that returns the list of guessed letters - getUsedLetters() : HashSet<Char>
Write the method that returns the word to be guessed - getWordToGuess() : String
Write the method that determines if the game is over or not - isGameOver() : Boolean
Complete the private method for determining if a guess is correct, and returns either the correct guessed letter, or an underscore - isCorrectGuess(c: Char): Char
Once steps 1-5 are complete, run and test your game. If everything works correctly, you're done! Otherwise, debug and fix any issues you encounter.