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.

Reply via email to