update: lucky number game and its exercises
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
const (
|
||||
maxTurns = 5 // less is more difficult
|
||||
usage = `Welcome to the Lucky Number Game!
|
||||
usage = `Welcome to the Lucky Number Game! 🍀
|
||||
|
||||
The program will pick %d random numbers.
|
||||
Your mission is to guess one of those numbers.
|
||||
@@ -54,9 +54,8 @@ func main() {
|
||||
min = guess
|
||||
}
|
||||
|
||||
for turn := 1; turn <= maxTurns; turn++ {
|
||||
for turn := 0; turn < maxTurns; turn++ {
|
||||
n := rand.Intn(min + 1)
|
||||
fmt.Println(n)
|
||||
|
||||
if n == guess {
|
||||
fmt.Println("🎉 YOU WIN!")
|
||||
|
Reference in New Issue
Block a user