# HG changeset patch # User Steve Losh # Date 1483879900 0 # Node ID 9c7178abf7db7f16e920f17adcbb033b976047f1 # Parent 948b58e1569af8b3b0c71e011e19dd3d845f84f6 Jank together some noise diff -r 948b58e1569a -r 9c7178abf7db src/main.lisp --- a/src/main.lisp Sun Jan 08 12:34:16 2017 +0000 +++ b/src/main.lisp Sun Jan 08 12:51:40 2017 +0000 @@ -319,13 +319,24 @@ ;;;; World Map ---------------------------------------------------------------- +(defun terrain-rand-p (height) + (evenp (truncate (* 100 (mod height 0.1))))) + (defun terrain-char (height) (cond ((< height -0.20) (values #\~ +blue-black+)) ; deep water ((< height -0.05) (values #\~ +cyan-black+)) ; shallow water - ((< height 0.05) (values #\` +yellow-black+)) ; sand - ((< height 0.40) (values #\. +white-black+)) ; dirt + ((< height 0.02) (values #\` +yellow-black+)) ; sand + ((< height 0.06) (if (terrain-rand-p height) ; sand/dirt border + (values #\. +white-black+) + (values #\` +yellow-black+))) + ((< height 0.40) (if (terrain-rand-p height) ; dirt + (values #\, +white-black+) + (values #\. +white-black+))) + ((< height 0.46) (if (terrain-rand-p height) ; hills/dirt border + (values #\^ +white-black+) + (values #\. +white-black+))) ((< height 0.55) (values #\^ +white-black+)) ; hills - (t (values #\* +white-black+)))) + (t (values #\* +white-black+)))) ; peak (defun structure-char (contents) (case contents