Hi,
i have a little problem that i'm having trouble doing well, and with Perl i know that shouldn't be the case.
I have 6 arrays with 6 entries in each. Each array entry is either a 1 or a 0. A single array can be made up of any combination of 1's and 0's. For example
@b = (0,1,1,0,1,1);
@c = (1,0,0,0,0,1);
@d = (1,1,1,1,1,1);
@e = (0,0,0,1,0,0);
@f = (0,1,0,1,0,1);
Each array represents a school course, and each value in the array the blocks, 0-5, the course runs in. What i need to do is find out if there are any clashes between the courses. In other words can the student who has chosen this set of courses actually sit them all with out being double booked.
My way of doing it so far is to work down the arrays (@a - @f) and assign the blocks on a first come first served basis. Then where there are clashes, reassign the 2 clashing courses again to different available places, as allowed by the array pattern for that course, until they all fit. Any that really will not go will be flagged up for the user so they can try something different.
Normally the student will only actually choose 4, possibly 5, courses. Which will make assignment slightly more successful.
This seems like a long winded way of doing this, and i was wondering if anyone out there had a better solution to this problem. I've reached a plateau in my Perl and need a little helping hand into some new ways of thinking.
Thanks in advance to anyone who can help.
Fafu
http://www.fafu.co.uk
i have a little problem that i'm having trouble doing well, and with Perl i know that shouldn't be the case.

I have 6 arrays with 6 entries in each. Each array entry is either a 1 or a 0. A single array can be made up of any combination of 1's and 0's. For example
Code:
@a = (1,0,0,1,0,1); @b = (0,1,1,0,1,1);
@c = (1,0,0,0,0,1);
@d = (1,1,1,1,1,1);
@e = (0,0,0,1,0,0);
@f = (0,1,0,1,0,1);
Each array represents a school course, and each value in the array the blocks, 0-5, the course runs in. What i need to do is find out if there are any clashes between the courses. In other words can the student who has chosen this set of courses actually sit them all with out being double booked.
My way of doing it so far is to work down the arrays (@a - @f) and assign the blocks on a first come first served basis. Then where there are clashes, reassign the 2 clashing courses again to different available places, as allowed by the array pattern for that course, until they all fit. Any that really will not go will be flagged up for the user so they can try something different.
Normally the student will only actually choose 4, possibly 5, courses. Which will make assignment slightly more successful.
This seems like a long winded way of doing this, and i was wondering if anyone out there had a better solution to this problem. I've reached a plateau in my Perl and need a little helping hand into some new ways of thinking.
Thanks in advance to anyone who can help.
Fafu
http://www.fafu.co.uk