Update of /cvsroot/ordweb/uop/pos407/team/week5/cards/cards/src
In directory sc8-pr-cvs1:/tmp/cvs-serv19279
Added Files:
ace.pnm back.pnm black-2.pnm black-3.pnm black-4.pnm
black-5.pnm black-6.pnm black-7.pnm black-8.pnm black-9.pnm
black-a.pnm black-j.pnm black-k.pnm black-q.pnm black-t.pnm
border.pnm box.pnm face-jc.pnm face-jd.pnm face-jh.pnm
face-js.pnm face-kc.pnm face-kd.pnm face-kh.pnm face-ks.pnm
face-qc.pnm face-qd.pnm face-qh.pnm face-qs.pnm joker.pnm
large-c.pnm large-d.pnm large-h.pnm large-s.pnm make-cards
make-run red-2.pnm red-3.pnm red-4.pnm red-5.pnm red-6.pnm
red-7.pnm red-8.pnm red-9.pnm red-a.pnm red-j.pnm red-k.pnm
red-q.pnm red-t.pnm small-c.pnm small-d.pnm small-h.pnm
small-s.pnm
Log Message:
init
--- NEW FILE: ace.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: back.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-2.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-3.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-4.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-5.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-6.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-7.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-8.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-9.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-a.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-j.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-k.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-q.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: black-t.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: border.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: box.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-jc.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-jd.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-jh.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-js.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-kc.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-kd.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-kh.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-ks.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-qc.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-qd.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-qh.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: face-qs.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: joker.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: large-c.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: large-d.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: large-h.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: large-s.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: make-cards ---
#!/usr/bin/perl
$workfile="work.tmp";
$tmp=".";
start("border");
insert("4 4","back");
finish("b");
makecard("J"," ","j");
foreach $suit (qw/c d h s/)
{
foreach $number (qw/2 3 4 5 6 7 8 9 t j q k a/)
{
makecard($number,$suit,"$number$suit");
}
}
sub makecard
{
my($number,$suit,$save)=@_;
my($nfile);
my($s);
$s="large-$suit";
print "Making $save\n";
# print "Making card for $number/$suit\n";
$nfile="red-$number" if $suit=~/h|d/;
$nfile="black-$number" if $suit=~/c|s/;
start("border");
if($number eq "J")
{
insert("5 11","joker");
symrotinsert("2 3","black-j");
}
else
{
symrotinsert("2 3",$nfile);
symrotinsert("2 18","small-$suit");
if($number=~/[qjk]/)
{
insert("13 11","box");
symrotinsert("14 12","face-$number$suit");
}
elsif($number eq "a" && $suit eq "s")
{
insert("16 18","ace");
}
else
{
insert("29 41",$s) if($number=~/[a359]/);
insert("29 25",$s) if($number=~/[7]/);
symrotinsert("29 20",$s) if($number=~/[2t]/);
symrotinsert("29 9",$s) if($number=~/[3]/);
symrotinsert("29 25",$s) if($number=~/[8]/);
flipxinsert("13 41",$s) if($number=~/[678]/);
quadinsert("13 30",$s) if($number=~/[9t]/);
quadinsert("13 9",$s) if($number=~/[456789t]/);
}
}
finish($save);
}
sub getsize
{
my($file)=@_;
my($out);
$out=`pnmfile $file`;
$out=~/(\d+) by (\d+)/;
# print "Size of $file is $1 by $2\n";
return "$1 $2";
}
sub getx
{
@_[0]=~/(\d+) (\d+)/;
return $1;
}
sub gety
{
@_[0]=~/(\d+) (\d+)/;
return $2;
}
sub start
{
my($startfile)=@_;
$startfile.=".pnm";
$worksize=getsize($startfile);
system("cp $startfile $workfile");
}
sub finish
{
my($save)=@_;
$save.=".gif";
system("ppmtogif -interlace -sort -transparent yellow < $workfile > $save 2>/dev/null");
system("rm $workfile");
}
sub insert
{
my($pos,$ovly)=@_;
# print "Inserting $ovly at ($pos)\n";
system("pnmpaste $ovly.pnm $pos $workfile > $tmp/1.tmp");
system("mv $tmp/1.tmp $workfile");
}
sub rotinsert
{
my($pos,$ovly)=@_;
# print "Flipping and inserting $ovly at ($pos)\n";
system("pnmflip -r180 $ovly.pnm > $tmp/f.tmp");
system("pnmpaste $tmp/f.tmp $pos $workfile > $tmp/1.tmp");
system("mv $tmp/1.tmp $workfile");
system("rm $tmp/f.tmp");
}
sub symrotinsert
{
my($pos,$ovly)=@_;
my($size,$sympos);
# print "Sym rot insert $ovly at ($pos):\n";
$size=getsize("$ovly.pnm");
$sympos=(getx($worksize)-getx($pos)-getx($size)).
" ".(gety($worksize)-gety($pos)-gety($size));
rotinsert($sympos,$ovly);
insert($pos,$ovly);
}
sub flipxinsert
{
my($pos,$ovly)=@_;
my($size,$sympos);
# print "Flip x insert $ovly at ($pos):\n";
$size=getsize("$ovly.pnm");
$sympos=(getx($worksize)-getx($pos)-getx($size)).
" ".(gety($pos));
insert($sympos,$ovly);
insert($pos,$ovly);
}
sub quadinsert
{
my($pos,$ovly)=@_;
my($size,$sympos);
# print "Quad insert $ovly at ($pos):\n";
$size=getsize("$ovly.pnm");
$sympos=(getx($worksize)-getx($pos)-getx($size)).
" ".(gety($pos));
symrotinsert($sympos,$ovly);
symrotinsert($pos,$ovly);
}
--- NEW FILE: make-run ---
#!/usr/bin/perl
$width=shift(@ARGV);
$last=pop(@ARGV);
foreach $card (@ARGV)
{
system("giftopnm $card.gif | pnmcut 0 0 $width 97 > $card.tmp");
push(@link,"$card.tmp");
}
system("giftopnm $last.gif > last.tmp");
system("pnmcat -lr @link last.tmp | ppmtogif -interlace -sort -transparent yellow");
system("rm @link last.tmp");
--- NEW FILE: red-2.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-3.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-4.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-5.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-6.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-7.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-8.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-9.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-a.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-j.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-k.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-q.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: red-t.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: small-c.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: small-d.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: small-h.pnm ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: small-s.pnm ---
(This appears to be a binary file; contents omitted.)
|