Skip to content

Conversation

kenpower
Copy link
Contributor

@kenpower kenpower commented Oct 6, 2018

No description provided.

@leios
Copy link
Member

leios commented Oct 6, 2018

Hey @kenpower, it looks like your Monte Carlo code is still in this PR. Any way you can get rid of those files?

@Gathros Gathros added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) Hacktoberfest The label for all Hacktoberfest related things! labels Oct 6, 2018
@kenpower kenpower force-pushed the stable_marrige_scala branch from 57844e1 to 7949624 Compare October 7, 2018 20:16
Copy link
Member

@jiegillet jiegillet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand the code fine, but I'm not super happy with the structure. Maybe you can add some stableMatching function that does the matching instead of doing in in main.


def main(args: Array[String]): Unit = {

bachelors foreach (b => b.propose())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real matching happens, it shouldn't be in main it should be in StableMarriage somewhere.

@jiegillet jiegillet self-assigned this Oct 10, 2018
@june128 june128 requested a review from jiegillet October 10, 2018 06:30
@kenpower kenpower force-pushed the stable_marrige_scala branch from 7949624 to fad401e Compare October 10, 2018 07:24

def findStableMatches(men: Man*): Unit = {
bachelors = men.to[ListBuffer]
bachelors foreach (b => b.propose())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this loop adapt dynamically as you add values to bachelors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... a bit awkward I know. bachelors is acting as a LIFO queue. Maybe better in a while()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about the mutable.queue, I should use that also.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a while loop with a mutable queue would be the most readable solution.

@kenpower kenpower force-pushed the stable_marrige_scala branch from fad401e to 996e748 Compare October 10, 2018 12:57
@jiegillet jiegillet merged commit e8fdf02 into algorithm-archivists:master Oct 11, 2018
@kenpower kenpower deleted the stable_marrige_scala branch March 26, 2021 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hacktoberfest The label for all Hacktoberfest related things! Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)

4 participants