fork download
  1. Elsa = "Elsa"
  2.  
  3. Anna = "Anna"
  4.  
  5. BestChars = {}
  6.  
  7. BestID = {}
  8.  
  9. Characters = {}
  10.  
  11. Characters[Anna] = 1
  12.  
  13. Characters[Elsa] = 2
  14.  
  15. CharList = {"Anna", "Elsa"}
  16.  
  17. ovar = 0
  18.  
  19. WorstChar = "Default" --Debug to make it not crash
  20.  
  21. Worst = nil --Anna's not bad, but of the list she is the worst.
  22.  
  23. for i = 1, #CharList do
  24.  
  25. if Characters[CharList[i]] >= ovar +1 then --I can't remember if this works
  26.  
  27. ovar = Characters[CharList[i]]
  28.  
  29. table.insert(BestChars, 1, CharListi)
  30.  
  31. table.insert(BestID, 1, Characters[CharList[i]])
  32.  
  33. Best = CharList[i]
  34.  
  35. elseif Characters[CharList[i]] <= Worst then
  36.  
  37. WorstChar = CharList[i]
  38.  
  39. Worst = Characters[CharList[i]]
  40.  
  41. for c = 1, #BestChars do
  42.  
  43. if Characters[CharID[c]] <= Characters[CharList[i]] then
  44.  
  45. table.insert(BestChars, c, CharList[i])
  46.  
  47. table.insert(BestID, c, i)
  48.  
  49. end
  50.  
  51. end
  52.  
  53. elseif Worst == nil then
  54.  
  55. Worst = Characters[CharList[i]]
  56.  
  57. WorstChar = CharList[I]
  58.  
  59. for c = 1, #BestChars do
  60.  
  61. if Characters[CharID[c]] <= Characters[CharList[i]] then
  62.  
  63. table.insert(BestChars, c, CharList[i])
  64.  
  65. table.insert(BestID, c, i)
  66.  
  67. end
  68.  
  69. end
  70.  
  71. end
  72.  
  73. end
  74. start = 0
  75. for b =1, #BestChars do
  76.  
  77. if start == 0 then
  78.  
  79. io.write(BestChars[b])
  80.  
  81. start = 1
  82.  
  83. else
  84.  
  85. io.write(">"..BestChars[b])
  86.  
  87. end
  88.  
  89. end
  90.  
Success #stdin #stdout 0.02s 2536KB
stdin
Standard input is empty
stdout
Standard output is empty