r-moeritz / swissdutch

A Python implementation of the Dutch pairing system for Swiss format tournaments.
MIT License
12 stars 2 forks source link

Implement D.4 for LSB pairing #2

Open r-moeritz opened 10 years ago

r-moeritz commented 10 years ago

When a score bracket contains players with many different scores there can be multiple different ways to pair them. To find the best pairings we determine the B.3-factor by summing the squared differences in the scores of each pair of players (a bye counts as 1 less than the lowest score in the bracket). The best pairings then are those with the lowest B.3-factor.

This is only applicable to the LSB and only if it is heterogeneous but being treated as homogeneous (because 50% or more of the players are floaters).

B-Esmaili commented 4 years ago

You got any plan for this?

r-moeritz commented 4 years ago

Hi @B-Esmaili, TBH I haven't touched this code in 5 years and have moved onto other things. I should probably update the README accordingly. OTOH you are welcome to fix this and open a PR ;)

B-Esmaili commented 4 years ago

@rmoritz actually i wanna port this thing to C# but i'll open a pull request if i catch any extra time.

r-moeritz commented 4 years ago

@B-Esmaili Translating the code to C# doesn't seem like a good use of time. Why not integrate it into your .net application with IronPython? You could even compile it into an assembly. Your call, obviously, just saying.

B-Esmaili commented 4 years ago

how about performance.and is IronPyton supported with .net core?

r-moeritz commented 4 years ago

IronPython does work with .net core, see https://github.com/ironLanguages/ironpython2, but I don't have any numbers to tell you what performance is like compared to C#. I can imagine that being an interpreted language, Python will in many cases be slower than the equivalent C#. The question is: does it make enough of a difference to matter for your use-case? Lifting the code as-is and using IronPython to integrate it into a C# codebase is obviously a lot less work than translating the code to C#, and if the performance is acceptable, then who cares if it would theoretically be faster in C#? OTOH if performance is critical to you for some reason, taking the time to translate the code to C# might be worth your while. The way I'd normally go about this is to try the easier option and see if it is good enough for my needs. If so, then great, you're done. Otherwise, you'll have to take the hard road. This is how I went about it at the time I wrote this library - I didn't do it to be masochistic - trust me, I have other things I'd rather be doing. I wrote it because I needed a SwissDutch pairing system for ChessRank, my web-based chess tournament management software that I was building. I couldn't find anything suitable, and so I wrote this library. Had something suitable been available at the time, I definitely wouldn't have spent my time writing this!

B-Esmaili commented 4 years ago

Thanks for sharing your thoughts.I am building an online chess game and i am planning to use this library as the pairing engine.in this game 20000 players will be playing simultaneously.i'll do some benchmarking to decide.nevertheless thanks for sharing the code.

gbtami commented 3 years ago

For huge number of players lichess.org fork of bbpPairings at https://github.com/cyanfish/bbpPairings may be a better choice.