[PRL] How about Tues 200-300 for macro reading group?

Jeffrey D Palm jpalm at ccs.neu.edu
Mon Sep 13 11:20:29 EDT 2004


Mitchell Wand wrote:

> I have not heard any more constraints since Friday.  
> 
> Here's the deal:  I will see Will today at noon, and we will pick a
> schedule at that time.
> 
> If you want to have your constraints taken into account, please let us
> know by then.
> 
> Jeff-- it would be handy if you could set up your program so that we
> know whose constraints have been entered (probably some comments in
> the constructor for the constraints array would do nicely).
> 
> --Mitch 

I've added sam and some comments... I've also set up a calendar in case 
that's easier to see at http://calendar.yahoo.com/stringymacros -- if 
you'd like to add something you can log in with the password 'chunky'.

Jeff

#!/usr/bin/perl

@days = (mon, tue, wed, thu, fri);

# day -> constraints
# a constraints is a list of (start,stop) times
%constraints =
(
#        mitch           will
  mon => ['1200','1330' , '1330','1445' , ],
#        carl, et al.    will             sam            jeff
  tue => ['1145','1705' , '1600','2345' ,  '1100','0515', '0800','1130'],
#        pl              will
  wed => ['1145','1330' , '1145','1445' , ],
#        mitch           mitch           mitch           will 
will            sam
  thu => ['0900','1100' , '1200','1330' , '1330','1445' , '1445','1800', 
'1800','2100' , '1230','1330'],
#        mitch           will            sam
  fri => ['0800','2145' , '0800','2145' , '1300','1500'],
  );

$ok = 1;
$start_hour = 8;
$stop_hour = 21;
print "Day ";
for (my $h = $start_hour; $h <= $stop_hour; $h++) {
     my $hour = $h < 10 ? 0 . $h : $h;
     print "$hour" . "00 ";
}
print "\n";
for (my $i = 0; $i <= $#days; $i++) {
     my $stack = 0;
     my $day = $days[$i];
     my @cst = @{ $constraints{$day} };
     print $day;
     for (my $h = $start_hour; $h <= $stop_hour; $h++) {
	my $hour = $h < 10 ? 0 . $h : $h;
	print " ";
	for (my $m = 0; $m <= 45; $m += 15) {
	    for (my $j = 0; $j <= $#cst; $j += 2) {
		my $start = $cst[$j+0];
		my $stop  = $cst[$j+1];
		my $min = $m < 10 ? 0 . $m : $m;
		my $time = $hour . $min;
		if ($time eq $start) {$stack++}
		if ($time eq $stop)  {$stack--}
	    }
	    print $stack eq 0 ? ' ' : $stack;
	}
     }
     print "\n";
}



-- 
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm



More information about the PRL mailing list