diff Lists.lua @ 3:431ddc8bdb4a

Beginnings of a random populate command
author John@Yosemite-PC
date Fri, 02 Mar 2012 23:09:14 -0500
parents 00286ba3b9c4
children 6c8f9473b22e
line wrap: on
line diff
--- a/Lists.lua	Fri Mar 02 22:44:30 2012 -0500
+++ b/Lists.lua	Fri Mar 02 23:09:14 2012 -0500
@@ -324,6 +324,18 @@
     end
     -- TODO: batch into a single op - no need to spam 25 messages in a row
 end
+function bsk:PopulateListRandom(index)
+    -- difference (raid+reserve)^list, then random shuffle that, then add
+    bsk:PopulateRaidList()
+    local list = bsk.lists[index]
+
+    local t = {}
+    --for i = 1,#list do
+    --    if not (RaidList(list[i]) or ReserveList(list[i])) then
+    --        tinsert(t,)
+    --    end
+    --end
+end
 --}}}
 
 -- "Soft" actions- ie things that cause nonpermanent state {{{
@@ -416,3 +428,12 @@
     assert(false)
 end
 
+local shuffleArray = function(array)
+    local arrayCount = #array
+    for i = arrayCount, 2, -1 do
+        local j = math.random(1, i)
+        array[i], array[j] = array[j], array[i]
+    end
+    return array
+end
+