GNU/Linux ◆ xterm-256color ◆ bash 579 views

Mandelbrot on a Raspberry PI PICO!

It runs this code:

#include "pico/stdlib.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int n,char *argc[])
{
    stdio_init_all();
    int cnt = 10;
    while(cnt) {
        printf("Running Mandelbrot on the PICO! Here goes in %d...\n", cnt--);
        sleep_ms(1000);
    }
    float r,i,R,I,b;
    for(i=-1;i<1;i+=.06,puts(""))
        for(r=-2;I=i,(R=r)<1; r+=.03,putchar(n+31))
            for(n=0;b=I*I,26>n++&&R*R+b<4;I=2*R*I+i,R=R*R-b+r)
                ;
}

…the core loop of which I copied from the first “mandelbrot ASCII” result suggested by Google :-)