aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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