aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSan Jacobs2023-01-12 08:50:25 +0100
committerSan Jacobs2023-01-12 08:50:25 +0100
commit6d0197d73345aa300523f1b2a2683cd1080b4548 (patch)
tree0f26279e0c4d5c4ed82894b802e808aadd2b29b7
parentd0fe67269297c7d08ddcf7ef709aa0cf8d524ef0 (diff)
downloadodin-frogger-6d0197d73345aa300523f1b2a2683cd1080b4548.tar.gz
odin-frogger-6d0197d73345aa300523f1b2a2683cd1080b4548.tar.bz2
odin-frogger-6d0197d73345aa300523f1b2a2683cd1080b4548.zip
Difficulty and seed settings
-rw-r--r--main.odin25
-rw-r--r--main.pdbbin3862528 -> 3895296 bytes
2 files changed, 20 insertions, 5 deletions
diff --git a/main.odin b/main.odin
index 2f0152d..2871e9f 100644
--- a/main.odin
+++ b/main.odin
@@ -25,7 +25,7 @@ block::'O'
water::'~'
player::'@'
-difficulty::0.4
+difficulty:f32=0.4
log_length::0.6
main :: proc() {
@@ -33,14 +33,15 @@ main :: proc() {
//name: string = getln()
//defer delete(name)
//fmt.printf("Hello %v! Welcome to shitty frogger.\n\n", name)
+ fmt.println("Set difficulty [0.0 <-> 1.0]")
+ difficulty=getfloat()
+ fmt.println("Set seed")
+ rand_state=rand.create(u64(getint()))
win : bool = false
state : state_type
-
populate_board(&state)
-
- fmt.println(state)
draw_board(state)
for !win {
@@ -52,7 +53,8 @@ main :: proc() {
win = true
}
}
- fmt.println("You win, brotha.")
+ fmt.println("\n You win, brotha.")
+ getln()
}
getln :: proc() -> string {
@@ -76,6 +78,19 @@ getint :: proc() -> int {
}
}
+getfloat :: proc() -> f32 {
+ buf: [256]u8
+ for {
+ read_input := getln()
+ output, ok := strconv.parse_f32(read_input)
+ if ok {
+ return output
+ } else {
+ fmt.println("That's not a normal float, mate.")
+ }
+ }
+}
+
getrune :: proc() -> rune {
buf: [256]u8
bytes_read, ok := os.read(os.stdin, buf[:])
diff --git a/main.pdb b/main.pdb
index 98f8fb3..b9532a8 100644
--- a/main.pdb
+++ b/main.pdb
Binary files differ