% perl -MO=Deparse movies | sed s/see/se\;print/ | perl | sed s/\;/\;\\n/g ($w,$h)=split/x/,shift||"19x20"; $q=10+10*$w; $r=20+10*$h; @m=((31,(15)x($w-1))x$h,(31)x$w); $m[$c]|=16,!(@a=grep!($m[$c+$$_[0]]&16+$|*$$_[1]),[-1,8],[1,1],[$w,4],[-$w,2])?$c=pop@p:${($i,$j)=@{$a[rand@a]}; $m[$c]&=~8/$j; push@p,$c; $m[$c+=$i]&=~$j; ++$u-$h*$w+$h||map$_&=15,@m,splice(@p),$c=$|=1}until$|&$c+2>$w*$h; $C=$q-4*int$q/4; $A=($q+$C)*$r; $u=pack"x"x(($q+$C)*$r); sub d{my($f,$g,$h,$i,$e)=@_; @a=sort{"000$a"<=>"000$b"}$h,$i||$h; for($a[0]..$a[1]){$s=($r-$_)*($q+$C)+$f; vec($u,$_,8)=$e||2for$s..$s+$g-1}}; sub t{$a=shift; $x=10*($a%$w); $y=10*(2+int$a/$w)}; d 9,$q-20,10; d 9,$q-20,$r-10; d 9,1,10,$r-10; d $q-11,1,10,$r-10; map{t$_; if($_%$w){$m[$_]&2?d$x-1,11,$y:""; $m[$_]&8?d$x+9,1,$y-10,$y:""; }}0..-1+$w*$h; $F="LIST"; open(FH,">al.avi"); binmode FH; select FH; print pack"L*",/\d/?$_:unpack"L*",$_ for"RIFF",(1256+($A+24)*($B=3+scalar@p)),"AVI $F",1216,"hdrlavih",56,500000,32,0,2064,$B,0,1,$A,$q,$r,(0)x4,$F,1140,"strlstrh",56,"vids",(0)x4,1,10,0,$B,$A,-1,(0)x3,"strf",1064,40,$q,$r,pack("SS",1,8),0,$A,(0)x4,pack(("H"x1024),"f","f","f",0,"a"),$F,(4+($A+8)*$B),"movi"; map{print STDOUT ++$G,$/; t$z||1; $l=$x; $t=$y; t$_; $ri=$x; if($l>$x){$ri=$l; $l=$x}d$l+2,5+$ri-$l,($t<$y?$t:$y)-7,($t<$y?$y:$t)-3,1; $z=$_; print"00db".pack("L",$A).$u}@p,(-1+$w*$h)x3; print"idx1".pack"L",16*$B; $o=4; for(1..$B){print"00db".pack"LLL",16,$o,$A; $o+=$A+8}