% cd your-pc2-directory % /homes/cs390cp/pc2/bin/pc2team &
Log in using your individually assigned “teamX” account and password. You can work in the current window/directory, creating a subdirectory for each problem.
Remember: If you've already solved one or more of these problems, try (1) solving again without referring to your old solution, and/or (2) using a different language (Java or C++). If you want to work on an additional problem from the book, let me know.
Hints:
1..N
(or 0..N-1
); but prune out the ones that have already appeared in a
.a[i]
true means element i
is in the subset; false means not in the subset. What are the candidate values?a[i]
indicates the row in which the queen in column i
appears. Choose candidates by pruning all the rows that conflict with (i.e., are “attacked by”) queens already placed in the earlier columns.n*n
booleans indicating if a bishop is located in that space. Need functions that convert a square number (0..n*n-1
) to row and column numbers (integer division and mod are your friends). See Queens solution to determine if two bishops are in attack positions (i.e., the slope of the line between them is 45 degrees).p
locations from the left edge, or if closer than r
locations from the right edge). More efficient representations and pruning criteria are possible (and necessary to be accepted at the UVA or PC sites).