my $y = 0; my @list; print "\n"; print "\n"; print "\n"; print " \n"; print " \n"; print "\n"; #### my $y = 0; my @list; print "\n"; print "\n"; print "\n"; print " ",hline(0,80,0); print " \n"; print " \n"; print "\n"; sub hline { my $x1 = shift; my $x2 = shift; my $y1 = shift; my $y2 = $y1; print " \n"; } #### my $y = 0; my @list; print "\n"; print "\n"; print "\n"; foreach (-15..15) { print hline(0,80,$_); } foreach (0..80) { print vline(-15,15,$_); } print " \n"; print "\n"; sub hline { my $x1 = shift; my $x2 = shift; my $y1 = shift; my $y2 = $y1; return " \n"; } sub vline { my $y1 = shift; my $y2 = shift; my $x1 = shift; my $x2 = $x1; return " \n"; } #### my $y = 0; my @list; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach (-15..15) { print hline(0,80,$_); } foreach (0..80) { print vline(-15,15,$_); } print hline(0,80,0,'red'); print " \n"; print "\n"; print "\n"; print "\n"; sub hline { my ($x1,$x2,$y1,$color) = @_; if ($color) { return " \n"; } else { return " \n"; } } sub vline { my ($y1,$y2,$x1,$color) = @_; if ($color) { return " \n"; } else { return " \n"; } } #### my $y = 0; my @list; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach (-15..15) { print hline(0,80,$_); } foreach (0..80) { print vline(-15,15,$_); } print " \n"; polyline('black',0.1,@scores); polyline('green',0.1,@bestblack); polyline('red',0.1,@bestwhite); print "\n"; print "\n"; print "\n"; sub hline { my ($x1,$x2,$y1,$color) = @_; if ($color) { return " \n"; } else { return " \n"; } } sub vline { my ($y1,$y2,$x1,$color) = @_; if ($color) { return " \n"; } else { return " \n"; } } sub polyline { my $color = shift; my $width = shift; my @values = @_; my @list; my $y = 0; print " \n"; } #### openSVG( 450, 450 ); openG( transform => 'translate(10,85) scale(1,-1)' ); openG( transform => 'scale(5)' ); openG( style => "font-size: .75pt", transform => "scale(1,-1)"); my $n = 1; foreach ( 0 .. 79 ) { openTAG( 'text', x => $_ + .25, y => 16, style => "font-weight: bold;", ); print ">",$_ % 10; closeTAG('text'); if ($_ and ($_ % 10 == 0)) { openTAG( 'text', x => $_ + .25, y => 17, style => "font-weight: bold;", ); print ">",$n++; closeTAG('text'); } } closeG(); foreach ( -15 .. 15 ) { hline( 0, 80, $_ ); } foreach ( 0 .. 80 ) { vline( -15, 15, $_ ); } path( d => 'M -1 0 H 81', style => 'stroke: red; stroke-opacity: .25; stroke-width: .1' ); graphline( 'black', 0.1, @scores ); graphline( 'green', 0.1, @bestblack ); graphline( 'red', 0.1, @bestwhite ); closeG(); closeG(); closeSVG(); sub path { openTAG( 'path', @_ ); closeTAG(); } sub openTAG { my $tag = shift; my %attributes = @_; print "<$tag"; foreach ( keys %attributes ) { print " $_=\"$attributes{$_}\""; } } sub closeTAG { my $s = shift; if ($s) { print "\n"; } else { print "/>\n"; } } sub openG { openTAG( 'g', @_ ); print ">\n"; } sub closeG { closeTAG('g'); } sub openSVG { my $height = shift; my $width = shift; print "\n"; print "\n"; print "\n"; } sub closeSVG { closeTAG('svg'); } sub hline { my ( $x1, $x2, $y1, $color ) = @_; if ($color) { path( d => "M $x1,$y1 H $x2", style => "stroke: $color;" ); } else { path( d => "M $x1,$y1 H $x2" ); } } sub vline { my ( $y1, $y2, $x1, $color ) = @_; if ($color) { path( d => "M $x1,$y1 V $y2", style => "stroke: $color;" ); } else { path( d => "M $x1,$y1 V $y2" ); } } sub graphline { my $color = shift; my $width = shift; my @values = @_; my @list; my $y = 0; foreach (@values) { if ($_) { push ( @list, $y ); push ( @list, $_ ); } $y++; } openTAG( 'polyline', points => join ( ',', @list ), style => "stroke: $color; stroke-width: $width; fill: none;", ); closeTAG(); }