Okay, if a 2-D chart of games to players will work, see what you think of this. The subroutine will handle any number of players, games, and players/game, as long as there are always the same number of players like you mentioned, and it displays a simple ASCII chart of a window between two numbered games. There's no error checking, and the formatting could get messed up with long names, but I think it does the basics.

#!/usr/bin/env perl use 5.010; use warnings; use strict; use List::Util qw(max first); my @players = qw( Adam Bob Clay Dan Ed Frank George ); my @games = ( [1,2,3,4], [2,3,4,5], [2,4,5,6], [2,4,6,7], [2,4,6,7], [3,4,6,7], [1,3,4,7] ); chart( \@players, \@games, 2, 4 ); # print a chart from game 2 to 4 chart( \@players, \@games, 1, 7 ); # print a chart of all 7 games sub chart { my $players = shift; # players array my $games = shift; # games array my $start = shift; # start game my $end = shift; # end game my $pl = max map { length $_ } @$players; say '-' x 40; for my $p ( 1..@$players ){ printf "%-${pl}s | ", $players->[$p-1]; for( $start..$end ){ print is_in($p,$games->[$_-1]) ? 'X ' : ' '; } say ''; } say '-' x 40; printf "%-${pl}s | ", ' '; print "$_ " for $start..$end; say ''; } sub is_in { return first { $_ == $_[0] } @{$_[1]}; }

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.


In reply to Re^5: Team Player Timeline by aaron_baugher
in thread Team Player Timeline by aartist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.