Created
July 25, 2024 11:37
-
-
Save skikozou/415ca1517e9835a744fd8ad12287e1af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strconv" | |
) | |
func main() { | |
fmt.Println("guessのgoバージョン") | |
var i string | |
var in string | |
var wallet int | |
wallet = 50000 | |
for { | |
fmt.Printf("how stakes (コイン)\n>") | |
fmt.Scan(&in) | |
stakes, _ := strconv.Atoi(in) | |
mon, _ := strconv.Atoi(fmt.Sprintf("%.0f", float64(stakes)*0.15)) | |
mon = mon * 10 | |
fmt.Printf("guess number!\n>") | |
fmt.Scan(&i) | |
n := strconv.Itoa(rand.Intn(3) + 1) | |
if n == i { | |
fmt.Println(mon, "コイン儲かった!") | |
wallet += mon | |
} else { | |
fmt.Println(mon, "コイン損した...") | |
wallet -= mon | |
} | |
fmt.Println(wallet, "コイン") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment