main.scm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. (import
  2. (except (rnrs base) let-values)
  3. (only (guile)
  4. lambda* λ
  5. error
  6. eof-object?
  7. simple-format
  8. current-output-port
  9. call-with-output-string
  10. )
  11. (prefix (logging) log:)
  12. (ice-9 binary-ports)
  13. (ice-9 textual-ports)
  14. (ice-9 peg)
  15. (ice-9 pretty-print)
  16. (print-utils)
  17. (peg-tree-utils)
  18. (file-reader)
  19. (random-utils)
  20. (prefix (lf2-data-crypt) lf2crypt:)
  21. (prefix (grammar) grammar:)
  22. (prefix (srfi srfi-1) srfi-1:))
  23. (define shuffle-phases
  24. (λ (stage-data)
  25. ""))
  26. (define main
  27. (λ ()
  28. (let* ([loc "data/stage.dat"]
  29. [stage-text
  30. (process-file loc lf2crypt:decrypt)]
  31. [stage-data
  32. (peg:tree (match-pattern grammar:STAGE-DAT stage-text))]
  33. [survival-data
  34. (find-in-peg-tree stage-data 'SURVIVAL-STAGE)]
  35. [phases
  36. (flatten-filter-peg-tree (find-all-in-peg-tree survival-data 'PHASE) 'PHASE)])
  37. (print-limited stage-text #:max 1024)
  38. ;; (print-limited stage-data #:max 1024)
  39. ;; (print-limited survival-data #:max 512)
  40. (print-limited (fisher-yates-shuffle phases)
  41. #:max 2048))))
  42. (main)