Usage: change plotsToShow and maxPlotCount as needed
Code: Select all
Inputs:
plotsToShow(7),
maxPlotCount(3);
Variables:
j(0),
plotDivisor(0),
plotsDesired(0),
plotsRemaining(0),
plotVisible(0);
plotsDesired = plotsToShow;
plotsRemaining = plotsDesired;
for j = maxPlotCount downTo 1
begin
// This works on powers of two.
//
// plot 1 --> 2^1 = 1
// plot 2 --> 2^2 = 2
// plot 3 --> 2^3 = 4
// plot 4 --> 2^4 = 8
//
// To display plots, add up the power values
//
// | plots shown | total |
// |-------------+-------|
// | 1 | 1 |
// | 2 | 2 |
// | 3 | 4 |
// | 4 | 8 |
// | 1, 2 | 3 |
// | 1, 3 | 5 |
// | 1, 2, 3 | 7 |
// | 1, 2, 3, 4 | 15 |
//
plotDivisor = (power(2, (j - 1)));
plotVisible = (plotsRemaining / plotDivisor);
if (plotVisible >= 1) then
begin
plotsRemaining = plotsRemaining - plotDivisor;
end
else
begin
noPlot(j);
end;
end;