diff --git a/golangr/file-reader/main.go b/golangr/file-reader/main.go index fd6c27d..1ca5f9c 100644 --- a/golangr/file-reader/main.go +++ b/golangr/file-reader/main.go @@ -14,7 +14,7 @@ import ( type PlayerStats struct { name string - lives uint8 + lives int8 } func clear() { @@ -54,7 +54,7 @@ func main() { //TODO: fix this garbage intLives, err := strconv.Atoi(stringLives) catchErr(err) - player.lives = uint8(intLives) + player.lives = int8(intLives) clear() fmt.Printf("Name: %v\n", player.name) @@ -87,7 +87,7 @@ func game() { randWord := getWord(filePath) for { gameStatus() - if player.lives == 0 { + if player.lives < 0 { fmt.Println("You lose!") os.Exit(0) } @@ -97,9 +97,9 @@ func game() { fmt.Println("You win!") os.Exit(0) } else { - fmt.Println("Wrong!") + fmt.Printf("Wrong!") player.lives-- - time.Sleep(2 * time.Second) + time.Sleep(1 * time.Second) clear() } }