Advertisement
ranisalt

Função Matchmaking em Lua

May 27th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.30 KB | None | 0 0
  1. function matchMaking(players)
  2.     local a, b, c = {}, {}, table.copy(players)
  3.     while (sum(a) >= sum [b] and  #b < #players / 2)
  4.         table.insert(b, c[#c])
  5.         c.remove(c, #c)
  6.         if sum(b) > sum(a) then
  7.             a, b = b, a
  8.         end
  9.     a  = a + copy[1]
  10.     return a, b
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement