#!/dis/sh load expr std fn cd bind -a . /dis or {cd cards} {raise 'can''t cd'} suits:=suit^(0 1 2 3)^.bit nums:=num^${expr 0 12 seq}^.bit fn isred { ~ $1 suit1.bit suit2.bit } subfn inset { (inset minx miny maxx maxy) = $* result=${expr $minx $inset + $miny $inset + $maxx $inset - $maxy $inset -} } w:=19 h:=24 r:=0 0 $w $h bg:=white border:='#aaaaaa' pos0:=2 2 pos1:=10 2 pos2:=2 15 pos3:=10 15 mkimage '#aaaaaa' $w $h | draw 1 1 ${pipe from { mkimage white ${inset 1 $r} } } > madebase.bit # fake bitmaps {} { mkimage black 7 7 > suit0.bit mkimage red 7 7 > suit1.bit mkimage red 7 7 > suit2.bit mkimage black 7 7 > suit3.bit for i in $nums { mkimage red 6 8 > red^$i } for i in $nums { mkimage black 6 8 > black^$i } mkimage $border $r | draw 1 1 ${pipe from {mkimage $bg ${inset 1 $r}}} > base.bit } cardnum:=0 for num in $nums { for suit in $suits { n := black^$num if {isred $suit} { n = red^$num } < madebase.bit draw $pos0 $n $pos1 $suit $pos2 $suit $pos3 $n > c$cardnum.bit cardnum=${expr $cardnum 1 +} } } # make rears x := black white 0 orange white 1 yellow '#555555' 2 green '#555555' 3 while {! ~ $#x 0} { (fill border n x) = $x mkimage $border $r | draw 1 1 ${pipe from {mkimage $fill ${inset 1 $r}}} > rear$n.bit }