1. it could be odd in case we don't manage, the first solution I did
was just a greedy algorithm, but that only worked with even number of
players
2. yes well now I pass the rankings and the list of players
separately, but yeah every player will be part of a team
3. this looks the same as 1), and sometimes there can be 5 vs 6 for example

2015-10-05 12:25 GMT+01:00 Mark Engelberg <mark.engelb...@gmail.com>:
> Are there an even number of players?
> Are all players assigned to teams?
> Are the two teams necessarily of equal sizes?
>
> On Mon, Oct 5, 2015 at 3:45 AM, andrea crotti <andrea.crott...@gmail.com>
> wrote:
>>
>> Hi everyone,
>>
>> I was trying for fun to solve the following problem:
>>
>> given a list of football players with some defined skills, find out which
>> team selection would be balanced.
>>
>> For example given just 4 players A, B, C, D there would be the following
>> team selections:
>>
>> - (A, B) vs (C, D)
>> - (A, C) vs (B, D)
>> - (A, D) vs (B, C)
>>
>> So it's a combinatorial problem however both inside teams and inside the
>> selection the order does not count, so the number of possible teams
>> is a lot smaller than the actual all possible permutations.
>>
>> I came up with a brute force solution here:
>>
>>
>> https://github.com/AndreaCrotti/football/blob/master/src/cljc/football/engine.cljc#L75
>>
>> which however explodes already for 12 players because:
>>
>> - it does all the possible permutations of teams (12! in that case)
>> - partition accordingly (using sets to remove duplicates) and evaluate
>>   every single one of them
>>
>> Any idea how to make this faster?
>> Other advices on the code are welcome as well..
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to