40 lines
707 B
Go
40 lines
707 B
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"log"
|
|
"math/rand"
|
|
"os"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
success := false
|
|
seconds := time.Now().Unix
|
|
rand.Seed(seconds())
|
|
target := rand.Intn(100)
|
|
fmt.Println(target)
|
|
for i := 0; i < 3; i++ {
|
|
fmt.Print("Enter: ")
|
|
reader := bufio.NewReader(os.Stdin)
|
|
input,_ := reader.ReadString('\n')
|
|
input = strings.TrimSpace(input)
|
|
guess,err := strconv.Atoi(input)
|
|
if err != nil {
|
|
log.Fatal("lolkek")
|
|
}
|
|
if guess != target {
|
|
fmt.Println("ИДИ НАХУЙ")
|
|
continue
|
|
}
|
|
fmt.Println("УГАДАЛ, ПЕТУШОК!")
|
|
success = true
|
|
break
|
|
}
|
|
if !success {
|
|
fmt.Printf("Ебать ты лошара! Число - %d \n",target)
|
|
}
|
|
} |