mylist = [[varx1, varx2, varx3], [vary1, vary2, vary3]]
The issue comes in that I need to be able to adjust these at will. One
of the lists of course (I'm planning the first one) will represent the
playerID of each player connected via the specific client. The second
part will represent the data that needs to be kept track of for each
player. A good example is a list of all the units that a player has
disabled (since undisabling happens after the turn of the person who
disabled a unit). Player 1 on a client may have no units disabled, while
player 2 gets a good hit with an EMP and managed to disable 5 units.
Next turn of course this will change. Right now with a regular list I
just append and pop/remove variables in the list as necessary. How do I
do this for the individual lists inside the 2d list rather then adding
on say a 3rd list (which I don't need)?
--
Do not be afraid to joust a giant just because some people believe in
windmills.
FOSS Moonbase Commander available @ http://code.google.com/p/tether
It would be nice if you could have a friendlier data structure for
passing the information, but I don't know if the network code you're
using allows that.
If you are stuck with lists of lists then fortunately it's pretty
simple (though somewhat ugly).
The basic idea is that once you can talk about one of the nested lists
you can do anything with it that you could do with a list by itself.
For example:
mylist = [[varx1, varx2, varx3], [vary1, vary2, vary3]]
mylist[0].append(fred)
mylist now has [[varx1, varx2, varx3, fred], [vary1, vary2, vary3]]
If you're going to be doing a lot with a particular nested list you
can give it a handy name:
inside_job = mylist[1]
Then you can use it without having to say [1] all the time.
TTFN
Do not be afraid to joust a giant just because some people believe in
windmills.
FOSS Moonbase Commander available @ http://code.google.com/p/tether