CARLresearch / PromNight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutoPromPicker

Remember Prom Night? ๐ŸŽถ

One of the biggest issues โš” we faced was to make sure all the handsome boys๐Ÿคต were paired to all the gorgeous girls๐Ÿ’ƒ in a fashion that takes care of everyone's priority ๐Ÿ’›

"Nah! That's just a fairytale scenario", if this is your thought maybe python ๐Ÿcan do some magic do ensure that we can pair all of our mates in a manner they never break up

Yesโšก, it can be done. Although we can't guarentee of getting those perfect pairs ๐Ÿ’‘snitched together always but everyone gets to happy.๐Ÿ˜Š

As every other wizards๐Ÿง™โ€โ™‚๏ธ , python has its own conditions โ—for this spell:

  • Everyone should be brutually honest when asked about ranking their partners in order of preferrence
  • The number of boys and girls must be equal. We don't want anyone to be left out in the corner. ๐Ÿ’”

Some Theoretical Background: ๐Ÿ”

The given use case is an application of the popular Stable Marriage Problem and is solved by theGayle-Shapely algorithm

Psuedo Code: ๐Ÿค”

Initialize all m โˆˆ M and w โˆˆ W to free
    while โˆƒ free man m who still has a woman w to propose to do
        w := first woman on m's list to whom m has not yet proposed
        if w is free then
            (m, w) become engaged
        else some pair (m', w) already exists
            if w prefers m to m' then
                m' becomes free
                (m, w) become engaged 
            else
                (m', w) remain engaged
            end if
        end if
    repeat

Explanation: ๐Ÿ‘จโ€๐Ÿซ

  • Until there's any boy left unpaired, the remaining unpaired boys go and ask out the girls as per their turns

Ask out

  • Each unmatched boy asks out the girls in his order of preference

preference

  • For every girl he asks out, if the girl is single, then she accepts the proposal and they get paired

yes

  • If the girl is already paired with another boy, she chooses according to her order of preference either to reject the proposal or to dump her current partner and accept the proposal,getting repaired in the process

rematch

  • If a boy is dumped, he has to again ask out a girl in the above process

Usage:

Convinced..huh? ๐Ÿ˜‰ and want this spell for yourself?

Here you go:

  • clone or Download this repo โฌ
  • Open the Terminal ๐Ÿฑโ€๐Ÿ’ป
  • Move inside ๐Ÿ‘‰ the repo cd AutoPromPicker
  • Open autoprompick.py and change the names of the girls,boys and preferences as desired๐Ÿงฑ
  • Now, the climax you have been waiting for!๐Ÿ˜Ž. Run the script using Terminal python autoprompick.py
  • Abracadabra โšก

I assume you have python installed on your system and set to path.

Further Work: ๐Ÿ—

  • Tune this script to take in the number of girls and boys from the terminal,their names and preference of each
  • Create a GUI for this
  • Deploy๐Ÿšข the above using Flask
  • Create an end to end auto prom picker system, where the N boys and N girls register themselves,put up their profile,rate each other and our script takes those values and gives them their best pair(s) as per precedence of ask out

License ๐Ÿ“œ

MIT License

Crafted with โค by Smaranjit Ghose

About

License:MIT License


Languages

Language:Python 100.0%