#!/usr/local/bin/perl -w # # pepper.p writes an image which I claim lempel ziv would not be good # at compressing # # this does not work under perl 5 # $pbmplot = 1 ; $pbmfile = "figs/wallpaper.pbm" ; $pbmx = 400 ; $screen = 0 ; $bias = 0.4 ; # initial fraction that are 1 $flip = 0.05 ; # flipping rate $pbmy = 100 ; $barperiod = 50 ; # pbm figure has horizontal bars to mark time. # eval "\$$1=\$2" while $ARGV[0]=~ /^(\w+)=(.*)/ && shift; # $l=1 ; $r = $pbmx ; $T = $pbmy ; if ( $pbmplot ) { # note I actually write a pgm file . open (PBM,"> $pbmfile"); if ( $T < $pbmy ) {$pbmy = $T ; } print PBM "P1\n# CREATOR: pepper.p DJCM 97 02 15\n" ; print PBM "$pbmx $pbmy\n" ; # print PBM "$maxpbm\n" ; } for ( $i = $l ; $i <= $r ; $i ++ ) { $c[$i] = ( rand() > $bias ) ? 0 : 1 ; } for ( $t = 1 ; $t <= $T ; $t ++ ) { for ( $i = $l ; $i <= $r ; $i ++ ) { print PBM "$c[$i] " ; if ( rand() < $flip ) { $c[$i] = 1 - $c[$i] ; } } print PBM "\n" ; } if ( $pbmplot ) { # bottom line close ( PBM ) ; } print STDERR "\n# xv $pbmfile\n" ;