zsh-users
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: zsh-users@sunsite.dk
Subject: Re: do I win the "most pointless use of ZSH" award? ;)
Date: Mon, 30 Apr 2001 21:05:17 +0100	[thread overview]
Message-ID: <20010430210517.A4840@idiocy.org> (raw)
In-Reply-To: <20010430124125.A2527@pianosa.catch22.org>; from dbt@meat.net on Mon, Apr 30, 2001 at 12:41:25PM -0700

On Mon, Apr 30, 2001 at 12:41:25PM -0700, David Terrell wrote:
> www.meat.net/~dbt/zsh-overkill2.png
> 
> time says:
> ./bin/mandelbrot.zsh  65983.75s user 2255.87s system 31% cpu 59:51:22.92 total
> % echo $LINES $COLUMNS
> 360 1000

Hi, just for what it's worth, with the help of Bart Schaefer I've
managed to optimise the code a bit! It also looks a bit more
interesting whilst it's drawing than before... :)

#!/bin/zsh

((columns=COLUMNS-1, lines=LINES))
((colour=0))

for ((b=-1.5;b<=1.5;b+=3.0/lines));do
    for ((a=-2.0;a<=1;a+=3.0/columns));do

	for (( p=0.0, q=0.0, i=0 ; p*p+q*q < 4 && i < 32 ; i++));do
	    ((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
	done

	((colour=(i/4)%8))

	echo -n "\\e[4${colour}m "
    done
done

-- 
Alan Third


  reply	other threads:[~2001-04-30 20:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-27 20:31 Alan Third
2001-04-27 20:52 ` Clint Adams
2001-04-30 19:41 ` David Terrell
2001-04-30 20:05   ` Alan Third [this message]
2001-04-30 20:23     ` Geoff Raye
2001-04-30 20:38       ` Alan Third
2001-04-30 22:19       ` Bart Schaefer
2001-04-30 22:15     ` Bart Schaefer
2001-05-02 17:30       ` Alan Third
2001-05-02 22:26       ` Bruce Stephens
2001-05-02 22:56         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010430210517.A4840@idiocy.org \
    --to=alan@idiocy.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).