   A shot in the dark.
  Hey everyone, I was wondering if someone would be interested in tackling a little side project.I was originally going to put my whole project on hold until I could understand more complex programming so that I could alter classes and what not. But what I need is basically a “Super collections” class.Right now in VB I can use a listbox, or a collection class, or many in tandem to simulate basic AI functions. However, if I could have a prefab super collection, I think this would save me a lot of processor and programming time. What I need is a collections class that can do the following.people_eating = New supercollectionpeople_eating.double“This would indicate the values stored would be DOUBLEpeople_eating.integer“This would indicate the values stored would be INTEGERSpeople_eating.maximum“This would determine the maximum number of entries the super collection could hold”people_eating.add“This would add one entry to the first slot of the collection and remove the last entry.”people_eating.average“This would provide an average of all values stored in the collection”people_eating.maxnum“This would provide the largest value stored by the collection”people_eating.minnum“This would provide the smallest value stored by the collection”people_eating.entry(z)“This would retrieve the value at position zAlso another cool thing would be if I could do as follows;Dim melist(30) as doubleFor z = 1 to 30Melist(z)= people_eating.sortup(z)Next z“The above would sort the values from highest to lowest and transfer those values to the melist array without disturbing the order of the people_eating collection.”Anyways, this is probably tray boring, but if someone is interested, I’d be muchos happy.Cheers   
  This doesn't seem to fit the guidelines of the Help Wanted forum which should be used to recruit for projects or promote your services to others. You seem to be needing help and asking for programming and UI materials. I'm going to move you to the AI forum where you can hopefully get your questions answered.   ;  This doesn't seem like the right forum either. I would put it in General Programming.   ;  Yep. It doesn't belong in AI, either.Moved.   ;  um, I think there may have been some confusion around what it is I need.  Thanks guys by directing this post to the correct forum.I'm under the impression that what I want done needs to be done with a more powerful language, such as C++.  I was informed that VB toolbox tools are programmed using C++.  So this is the reason for my post.  I think in another post somewhere, someone was under the impression I needed VB programming help.  Sorry, that is not my interest.Thanks again.   ;  So are you wanting this for VB.NET?If you're interested in saving processor time, then you'll need to specify Big-Oh notation constraints on the operations you're wanting to perform.For example, would it be acceptable if the add operation had to move all current items along to fit in the new one, which is O(n), or would you require that it simply works like appending to a list, which is O(1). Or perhaps you'd just want it to be at least as good as O(log n)?What about entry(z)? Would it be acceptable if it found item n by say stepping through a list which is O(n), or must it be as fast as looking up an item in an array which is O(1). Or again perhaps something like O(log n) or even O(sqrt n) is good enough?Now for the bad news: You can't really have both of these being O(1).What about minnum, maxnum and sortup. Is it okay for these to be O(n)?If not then these would require that the container also needs to internally maintain the sorted order of the items within it, which pretty much rules out the previously mentioned functions from being O(1).This kind of stuff might not seem very important to you right now, but once you get say 30000 items in there, some of the things you'll want to do with this container might take 20 seconds, whereas if you can direct us more towards what your requirements are then that thing might take only 0.1s.I'm also not clear on whether you expect it to be possible to hold fewer than "maximum" values in the container at any given time. If not, then what are the values of all the entries initially? Or should accesing an item that has not been set yet cause some kind of exception?   ;  You could probably just use a List.  Since it's a List of ints or doubles, you can then use Average(), Max(), and Min() in addition to List's full array of methods.  I can't see any reason why you'd need to write your own "super collection" class.   ;  Mike TacularWell right now, to simulate the more complex AI functions I use serveral Collections and listbox's, because each has a function that I need.  However, I'm going to need hundreds of these collections, so programming all those suckers working in tandem would be a nightmare to organize.  And it would just be so sloppy I'd hate to include it in my program.iMalcNow, I'm trying to fully grasp what you've said.  But I'm using Visual Studios Visual Basic 2008.  I heard that 2008 is an integration of .NET and 2005?Can it hold fewer than maximum items?No, once the maximum has been set, the colletion size never changes.  If it make a difference, I don't imagine the entries in the list getting any bigger than 365.  With 30-60 being the average collection sizes.Perhaps there can be an operation .set(z) = value where it can directly set the value at a specific spot in the collection.If I understand you correctly, what I envision is "new entry move all values down one slot, dumping the last entry"As for minnum and maxnum, can you explain this a little more?  using the numbers I'm envisioning, do you think I'll be able to have my o(1), which sounds better.Thank you very much.;Quote:Original post by AwokenNow, I'm trying to fully grasp what you've said.  But I'm using Visual Studios Visual Basic 2008.  I heard that 2008 is an integration of .NET and 2005?Can it hold fewer than maximum items?No, once the maximum has been set, the colletion size never changes.  If it make a difference, I don't imagine the entries in the list getting any bigger than 365.  With 30-60 being the average collection sizes.Perhaps there can be an operation .set(z) = value where it can directly set the value at a specific spot in the collection.If I understand you correctly, what I envision is "new entry move all values down one slot, dumping the last entry"As for minnum and maxnum, can you explain this a little more?  using the numbers I'm envisioning, do you think I'll be able to have my o(1), which sounds better.VS2008 is just the next major release after VS2005. Every version of VS since 2002 has been able to produce .NET executables. Your statement doesn't really make sense.So the size is fixed, okay. What should it initially contain? What should the result of entry(10) say, be if the container has only just been declared?If you're planning only only ever having 365 entries, and typically 30-60 then it sounds to me like you don't need to create any kind of generic container. It would be best to just use an array and write the necessary functions to provide the functionality you need.I think the idea of having the add function move all values along by one is not a good idea unless it is called very very rarely. Perhaps what you really want is a circular buffer?The way you've shown usage of 'sortup' shows that it looks like an mth-largest fucntion. The best algorithm for finding the nth largest item is O(n). To call an O(n) function n times makes it an O(n*n) operation. That means it would be slow. However if the container knew the order of the items then it could give you the answer straight away in every case. Of course that means it has to track the ordering of the items every time one is inserted/changed/removed, which takes some time.You don't really want an mth-largest function here as far as I can see though. You just want to create a sorted array from the container's contents. That can be much quicker. Sound okay?Just remember that a container can never do every possible operation quickly. For most operations you want it to do quickly, something else it does will probably have to be slower. Reconsider whether all of the things you want it to do should be the responsibility of the container, or the responsibility of the code using the container.   ;  o.k, I've removed VB from my computer because for now I have other projects that need my attention.  (I have difficulties with time management)  So if it's not there it can't tempt me.  That being said, is there a way for me to post a snip-bit of my code with colors and all?  I'd like to show you what I got, and explain the specific's of what I'm talking about.  IF you see my code, you'll have a better understanding of what I'm aiming for.But I'll need a good week to get that up,  can someone show me the proper [whatever][/whatever] to show my code?   