Microcodes
by Pall Thayer
Microcodes are very small code-based artworks. Each one is a fully contained work of art. On this page you can see contributed modifications of the original Microcodes that can be seen here.

Original code:

Enter your name (will be displayed):

Here you can enter extra info, such as warnings if the code can cause damage:

Enter code (must be complete and runnable):

Moodstream
Accepts a command line argument [-m] describing one's mood: i.e. 'perl moodstream.pl -m happy'.
Made for 256 color terminal emulators.

05. April 2010
#!/usr/bin/perl
$width = `tput cols`;
$mood = @ARGV[1] if @ARGV[0] eq '-m';
@mood = split('', $mood ? $mood : 'indifferent');
while(1){
    foreach(@mood){
        $color = ord($_).'m';
        print "\x1b[48;5;$color";
        print " " x int($width/scalar @mood);
        print "\x1b[0m";
    }
    print "\n";
    select(undef, undef, undef, 0.1);
}
Dynamic Moodstream
This version asks for input allowing periodic updates to one's mood.
#!/usr/bin/perl
while(1){
    $width = `tput cols`;$height = `tput lines`;
    print "mood? "; $mood = <>; chomp($mood);
    @mood = split('', $mood);
    foreach(0..$height){
        foreach(@mood){
            $color = ord($_).'m';
            print "\x1b[48;5;$color";
            print " " x int($width/scalar @mood);
            print "\x1b[0m";
        }
        print "\n";
        select(undef, undef, undef, 0.1);
    }
}

back to Microcodes