diff --git a/main.go b/main.go index 863a9d0..42e14ab 100644 --- a/main.go +++ b/main.go @@ -185,9 +185,10 @@ func game() { checkEmpty: for { fmt.Printf("Guess: ") - fmt.Scanln(&guess) + //fmt.Scanln(&guess) + guess = scanLine() - if isEmpty(guess) == false { + if isEmpty(guess) == false && len([]rune(guess)) == 1 { break checkEmpty } else { gameStatus() @@ -195,8 +196,6 @@ func game() { } - // TODO: prevent players from inputting multiple characters, UTF-8 is gonna be a pain - if getLetter(guess) == true { if alreadyCorrect(guess) == true { fmt.Printf("[-] You've already guessed this correct letter") @@ -250,24 +249,6 @@ func getWord(path string) (word string) { return randName } -// func setClear() { -// switch runtime.GOOS { -// case "linux": -// fmt.Println("You're using linux") -// time.Sleep(1 * time.Second) -// clearCommand = exec.Command("clear") -// clearCommand.Stdout = os.Stdout -// case "windows": -// fmt.Println("You're using windows") -// time.Sleep(1 * time.Second) -// clearCommand = exec.Command("cmd", "/c", "cls") -// clearCommand.Stdout = os.Stdout -// default: -// fmt.Println("Huh?") -// os.Exit(1) -// } -// } - func clear() { screen.Clear() screen.MoveTopLeft()