"Seminkove" vyplnovani
{enqueue the die pixel; if it is a point, turn it into die and increment the parameter} Procedure DieEnqueue (X, Y: Integer; Var Cnt: Integer); Begin If (Field[X,Y] = chPts) then Begin PtsFill (X, Y); Inc (Cnt); End; If (Field[X,Y] = chDie) then Begin DieX[DieE] := X; DieY[DieE] := Y; Field[X,Y] := chBkg; Inc (DieE); End; End; { DieEnqueue } {erase one die and count its points during that} Function DieFill (X, Y: Integer) : Integer; Var Cnt: Integer; Begin Cnt := 0; DieB := 1; DieE := 1; DieEnqueue (X, Y, Cnt); While (DieB < DieE) do Begin X := DieX[DieB]; Y := DieY[DieB]; Inc (DieB); If (X > 1) then DieEnqueue (X-1, Y, Cnt); If (X < SizeX) then DieEnqueue (X+1, Y, Cnt); If (Y > 1) then DieEnqueue (X, Y-1, Cnt); If (Y < SizeY) then DieEnqueue (X, Y+1, Cnt); End; DieFill := Cnt; End; { DieFill }