WriteLine( "HANGMAN")Įlse let guess = getGuess used let used = guess :: used if word |> String. This makes it easy to swap out the ASCII-art noose graphics with the ASCII-art guillotine graphics without having to change the main logic that the program follows. And instead store your random choice as word.You also dont need to use str, as a file is read as a string by default.Likewise you dont need to specify r for open, as its the default there too. You should keep the whole list, in case you want to do another choice. WriteLine( "CORRECT")Įlif tally = hangman. Hangman and Guillotine share the same game mechanics but have different presentations. password 'python'.upper() is redundant, you can just type in 'PYTHON'. Let word' = toPartialWord word used Console. Guess let rec play word used tally = Console. ToUpper if isGuessValid used guess then guess else readGuess used let getGuess used = Console. Let rec readGuess used = let guess = Console. Let isGuessValid ( used : char seq) ( guess : char) = Seq. Let toPartialWord ( word : string) ( used : char seq) = word |> String. """ _ |/ | | (_) | \|/ | | | / \ | |_ """ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |