comparison Lists.lua @ 4:6c8f9473b22e

Notes on list storage keys
author John@Yosemite-PC
date Sat, 03 Mar 2012 10:25:01 -0500
parents 431ddc8bdb4a
children 2ce0f4db1a3e
comparison
equal deleted inserted replaced
3:431ddc8bdb4a 4:6c8f9473b22e
7 -- A separate user list is held - lists index into this 7 -- A separate user list is held - lists index into this
8 8
9 9
10 -- TODO: rename player 10 -- TODO: rename player
11 11
12 12 -- notes on list storage:
13 -- Storing names as I do now is atrocious.
14 -- It prevents insertions (twss) to the middle of the list because then it acts
15 -- as a side effect onto all the others. ie ABCD -> AXBCD would be phrased as
16 -- "insert X and shift down B,C,D" which sucks. BCD haven't really been affected
17 -- (yet) because their relative positions to the others are still intact - ie
18 -- they are still below A right where they belong. But really X hasn't done
19 -- anything to affect their relative standing.
20 --
21 -- Ok so we can't use names.
22 --
23 -- We can't use monotonic integers either because it suffers the same problem.
24 -- Also consider, randoming in someone to a list of ABCD. Say they roll spot 2.
25 -- What if someone else runs a separate raid and also randoms someone into slot
26 -- 2? How do you handle that conflict? Difficult. Also, consider this:
27 -- List of ABCD on night 1.
28 -- Admin 1 on night 2 rolls in 30 new people. ABCD's indexes are shuffled to be
29 -- between 1-35.
30 -- Admin 2 on night 3 rolls in 5 new ones and people ABCD and PQRST now all have
31 -- indexes between 1-9.
32 -- When these two are resolved against one another, do the 1-9 peopole end up on
33 -- top of the list compared to those other 30?
34 --
35 -- Solution:
36 -- Need a huge random space with purposely left gaps to leave plenty of room for
37 -- conflicts.
38 -- So if ABCD had randomed on a space of say, 10,000 and then were sorted into
39 -- order, then the next 30 could roll into that same space and have a proper
40 -- ordering. Then the next 5, etc.
41 --
42 -- Handling conflicts:
43 --
13 44
14 bsk.lists = {} 45 bsk.lists = {}
15 bsk.players = {} 46 bsk.players = {}
16 47
17 local RaidList = {} 48 local RaidList = {}