done enough! flaked
This commit is contained in:
parent
68d2060e3e
commit
557eb3316e
2 changed files with 26 additions and 5 deletions
|
@ -13,6 +13,14 @@
|
|||
in {
|
||||
schemas = flake-schemas.schemas;
|
||||
|
||||
packages = forEachSupportedSystem ({ pkgs }: {
|
||||
default = pkgs.writeShellScriptBin "mineschemer" ''
|
||||
${pkgs.chez}/bin/scheme --script ${
|
||||
pkgs.writeText "main.scm" (builtins.readFile ./main.scm)
|
||||
} $@
|
||||
'';
|
||||
});
|
||||
|
||||
devShells = forEachSupportedSystem ({ pkgs }: {
|
||||
default = pkgs.mkShell {
|
||||
|
||||
|
|
19
main.scm
19
main.scm
|
@ -690,13 +690,14 @@
|
|||
; draw-game-over as a separate thing would be nice
|
||||
|
||||
; the game shows -99 when (- num-mines num-flagged) is less than -99
|
||||
(define (run-game mines width height)
|
||||
(define (run-game mines width height seed)
|
||||
(init-window (* width square-width) (* height square-width) "mineschemer")
|
||||
(set-target-fps 60)
|
||||
(let ([seed (time-nanosecond (current-time))])
|
||||
|
||||
(display "seed: ") (display seed)
|
||||
(newline)
|
||||
(random-seed seed))
|
||||
(random-seed seed)
|
||||
|
||||
(let ([skin (load-skin "xp-flowers.bmp")]
|
||||
[game (new-game mines width height)])
|
||||
;; (display skin)
|
||||
|
@ -728,3 +729,15 @@
|
|||
; let's save playing with shaders for later
|
||||
|
||||
; seems like minesweeper.online doesn't need middle-clicking to be separate (left-clicking performs the same function)
|
||||
|
||||
(define (get-nano-seed)
|
||||
(time-nanosecond (current-time)))
|
||||
|
||||
(unless (and
|
||||
(>= 4 (length (command-line-arguments)) 3)
|
||||
(for-all number? (map string->number (command-line-arguments))))
|
||||
(display "i need 3-4 numbers (MINES WIDTH HEIGHT SEED)")
|
||||
(exit 1))
|
||||
|
||||
(apply run-game (append (map string->number (command-line-arguments))
|
||||
(list (get-nano-seed))))
|
||||
|
|
Loading…
Reference in a new issue