Created
October 27, 2017 17:27
-
-
Save backnotprop/4a12ddb24e84032a671fb28188813a84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Proposal Stage 1 | |
* - everyone sends out a proposal and they are either accepted or rejected | |
* - recursive until everone has accepted proposal | |
*/ | |
function _proposalStage(start){ | |
let i = typeof start !== 'undefined' ? start : 1; | |
while(i < Object.keys(_DB).length + 1) { | |
let sender = _DB[i]; | |
if(!sender.hasAcceptedSentProposal) { | |
// need to go through proposal stages for this person and their preferences | |
// next offer is first choice in preference list that hasn't been proposed to yet | |
// send offer to that person, propose Offer will accept or reject the offer | |
proposalProcess( sender, _DB[sender.choices[0].id], sender.choices[0].strength ); | |
} | |
i++; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment