Nice Idea, Source shall be posted on 2nd post from now on :)
{*******************************************************************************
Procedure DropPattern(which: integer);
By: Rasta Magician
Description: Drops all items in inventory according to pattern which.
*******************************************************************************}
Procedure DropPattern(which: integer);
var
Col, a, i: integer;
Arr: TIntegerArray;
Turn: boolean;
begin
SetLength(Arr, 28);
a := 0;
if which = 0 then
which := Random(2)+1; //ignores complete randomness, unless scripter chooses to use it
writeln('Dropping by pattern: '+IntToStr(which));
case which of
1:
//up to down
for Col := 1 to 4 do
if InIntArray([2, 4], Col) then
begin
for i := 6 Downto 0 do
begin
Arr[a] := Col + i*4;
Inc(a);
end;
end else
for i := 0 to 6 do
begin
Arr[a] := Col + i*4;
Inc(a);
end;
2:
//snake
repeat
if not Turn then
begin
for i:= 1 to 4 do
Arr[a+i-1] := a + i;
IncEx(a, 4);
Turn := true;
end else begin
for i:= 4 Downto 1 do
Arr[a-i+4] := a + i;
IncEx(a, 4);
Turn := false;
end;
until(a >= 28);
3: begin
DropArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]);
exit;
end;
end;
if Random(2) = 1 then
InvertTIA(Arr);
Gametab(tab_inv);
for i:= 0 to 27 do //27 = High(Arr)
DropItem(Arr[i]);
end;
~RM