Comparing arrays with arrays
Posted on 2000-02-25
I need a way to compare arrays with other arrays. These are generally arrays of ordinal values. I'd like to add arrays to arrays, compare to see if all items in first array are in second, and remove items from an array from an array. I've looked at SETS and it looks like it has some of what I need, but lacks the ability to add and remove items.
function InArray(A:array of Byte; B:array of Byte) : Boolean;
returning true if all items in array A are in B. Note: There can be duplicates of the same value and if there are, there has to be atleast that many in array B to return TRUE.
function AddArray(A:array of Byte; B : Array of Byte): array of byte;
function SubtractArray(A:array of Byte;B:array of byte): array of bytw
I could generally write these myself, but I was wondering if there was a package out there that was already written that could do this.
It could be done either using dynamic/variant arrays or Tlist, it don't matter, but I need a way to COUNT the members in the array and access the data so I can save it to a stream. It should also not require too much CPU resources because it is going to be called many times.
If someone can point me to a link that will help me I'll give 200 points, if someone goes thru the trouble and writes it themselves or posts/emails me the exact functions I need, I'll give 400+ points. I have 1200 available.
This is for an online game that is similiar to a MUD, but it is graphical. It is for the slots system to keep track of how many of each bodypart are not equipping anything.
If you want to help out, with the game project. Let me know. We need graphics artists and programmers. We curretnly have 4 people on it.