LilasCorner / jlootbox

Other
1 stars 0 forks source link

Player might choose to compare with self #10

Open JohnTMurphy-NIU opened 2 years ago

JohnTMurphy-NIU commented 2 years ago

Player.java line 459 should technically have a trap so that the player does not add self to the list of possible comparison partners. This shouldn't matter much- in large populations, the chance of choosing self is small, and in any case the only effect would be that the comparison would be equal- but technically we might want to avoid this. (The method to ensure that the other agent is not self might be tricky if agents do not have a unique identifier, but Java's built-in comparison Object.equals(Object other) method may suffice.)

A more robust strategy might be to create a separate method that chooses another agent (not self) at random and creates an edge in one go. This would join the 'choose random' portion from askOtherPlayer with the 'make new edge' from compare() and might be cleaner.