diff --git a/golangr/file-reader/go.mod b/golangr/file-reader/go.mod index 5b20b70..7713c7f 100644 --- a/golangr/file-reader/go.mod +++ b/golangr/file-reader/go.mod @@ -1,3 +1,3 @@ module file-reader -go 1.21.6 +go 1.22 diff --git a/golangr/file-reader/main.go b/golangr/file-reader/main.go index 1ca5f9c..1e00400 100644 --- a/golangr/file-reader/main.go +++ b/golangr/file-reader/main.go @@ -26,6 +26,9 @@ var names = []string{} var err error var guess string var guessLetter rune +var filePath string = os.Args[1] +var randWord string = getWord(filePath) +var hiddenChars []string func scanLine() (line string) { in := bufio.NewReader(os.Stdin) @@ -41,6 +44,10 @@ func main() { os.Exit(1) } + for range randWord { + hiddenChars = append(hiddenChars, "_") + } + for { clear() @@ -79,12 +86,13 @@ func gameStatus() { clear() fmt.Println("Player:", player.name) fmt.Println("Lives:", player.lives) + fmt.Println("Word:", hiddenChars) } func game() { clear() - filePath := os.Args[1] - randWord := getWord(filePath) + //filePath := os.Args[1] + //randWord := getWord(filePath) for { gameStatus() if player.lives < 0 {