On Sunday, January 27, 2019 at 3:42:35 AM UTC+2, Lutz Horn wrote: > > Hi Anca, > > Am 26.01.19 um 09:27 schrieb Anca Emanuel: > > How do you make an planing for that event ? > > > > Here is my > > implementation: > https://github.com/ancaemanuel/comb/blob/master/chess_tournament.go > > > > This was not an easy problem. After some years of thinking an pencil > work I > > have an optimal solution. > > Some remarks: > > * Your code needs some comments that explain why it does what it does. > * The names you choose (n, d, i, j, k) don't tell us anything about > their meaning. Use intention revealing names. > * Did you try to write some test > (https://golang.org/doc/code.html#Testing) for your code? How do you > know it is correct without them? > > Lutz > > Thank you for your feedback. Yes, the code is not very explicit. I am not very good in writing test in golang, but visually, there are combinations of n people taken 2 to verify, and that is not very hard. I was thinking about that and I have https://github.com/ancaemanuel/comb/blob/master/comb.go to generate them ( an classical algorithm to generate combinations of n taken k in lexicographic order ) but I got lazy...
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.