diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-02-02 22:29:41 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-02-02 22:30:16 +0100 |
commit | 185623be46dfd9a60e5a021259a6c7778cfb07cd (patch) | |
tree | 8bbbe2edeec7fb7018a52f5cf52ed0a24ab48e59 /nl | |
parent | dd1a2323e743df5ca3109bae6e213cd7b02dddee (diff) |
Parse and typecheck casts
Diffstat (limited to 'nl')
-rw-r--r-- | nl/mandel.nl | 7 |
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; } |