Hello,
im currently trying to Visualize a Linked List, but im stuck beacuse i don't
HOW to achiev what i want. Every time i think i have a decent Solution, I find a new problem.
i try to explain my problem using Code examples , i hope you understand and could give me some advice on how to move on.
the project is similar to this one:
https://forum.lazarus.freepascal.org/index.php/topic,38136.msg259652.html#msg259652Briefly what i have:
T3DPoint = record
X: integer;
Y: Integer;
Z: Integer;
end;
T3DCubeArr = Array of Array of Array of TCube;
TLinkListItem = class
//Properties, etc
end;
TLinkList = class
private
fFirst: TLinkListItem;
fLast: TLinkListItem;
fSize: integer;
public
property First: TLinkListItem read fFirst;
property Last: TLinkListItem read fFirst;
property Size: integer read fSize;
procedure Add(position: integer; item: TLinkListItem);
procedure Remove(position: integer);
end;
TCube = class
private
fI]"]>BlockednIt: TLinkListItem;
fPosition: T3DPoint;
public
property I]"]>BlockednIt: TLinkListItem read fI]"]>BlockednIt;
function Isempty: boolean
end;
TcubeLinkList = class
//is this needed?
end;
TVisualizeLinkList = class
private
fDrawArea: T3DCubeArr;
public
create(sizeX, sizeY, SizeZ); //create 3d array with certain size
procedure addCubeAt(point: T3DPoint);
procedure remCubeAt(point: T3DPoint);
end;
I need to be able to move, insert, add, remove, turn.
it's really similar to a snake game but it wont move constantly and there must be more operations available like turn whole list or insert into the middle etc.
All i need is Advice on which Datastructures i should use and briefly how to actually implement this. I need this Code to be Solid, thats why i asked here in the forum.