At 16:24 -0500 01_02_05, Lists wrote:
>I'm having a mental block. What's the easiest way to sort by 2 criteria
>simultaneously?
>
>That is, I need to sort a list of four players by how many answers to a
>quiz were correct.
>
>If any of the four players tie when considering correct answers, I need
>to then sort any players that tie by how fast they completed the quiz.
You can make a nested propList:
rankList: [<-score>:[<time>:<player>]]
Then the winner is:
rankList[1][1]
Just make sure that the "sorted" flag is set for all lists.
in pseudo:
rankList = [:]
rankList.sort()
repeat with player in playerList
score = -player.score
timeList = rankList.getAProp(score)
if timeList.voidP then
timeList = [:]
timeList.sort()
rankList.addProp(score, timeList)
end if
timeList.addProp(player.time, player)
end repeat
Jakob
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]