summaryrefslogtreecommitdiff
path: root/nl
diff options
context:
space:
mode:
Diffstat (limited to 'nl')
-rw-r--r--nl/mandel.nl7
1 files changed, 6 insertions, 1 deletions
diff --git a/nl/mandel.nl b/nl/mandel.nl
index cef9eb2..2bdc25b 100644
--- a/nl/mandel.nl
+++ b/nl/mandel.nl
@@ -3,6 +3,7 @@ type char = i8;
type string = ptr(char);
extern func void(int) putchar;
+extern func u64(string) strlen;
void printnum(int n) {
if (n < 0) {
@@ -53,12 +54,16 @@ int main() {
hincr = 0.0625;
vincr = 0.0625;
+ string shade = " .,-:!%@#";
+ int shadelen = cast(int)(strlen(shade));
+
double y = tbound;
while (y >= bbound) {
double x = lbound;
while (x <= rbound) {
int niter = mandeliter(x, y);
- printnum(niter);
+ putchar(*(shade + niter*(shadelen-1)/maxiter));
+ // printnum(niter);
putchar(' ');
x = x + hincr;
}