# Comparing Values in a Calculated Property

Need to compare Prestige values for 5 players to assign VP. The highest gets 10, 2nd gets 6 VP, 3rd gets 3 VP, 1 VP and 0 VP.
(red, Yellow, Green, White, Blue…)
If there’s a tie, you average the values. (
-Tie for first gets 10+6/2=8…
-Tie for 2nd gets 6+3/2=4 (round down.)
-Or a 3 way tie for 3rd gets 3 points.

So I have Global Properties PrestigeR, PrestigeG, PrestigeY etc.

Is there an easier way to compare the values then texted IF( , ,) detailing every possible scenario?

VPG=If(PrestigeG>PrestigeR && PrestigeG>PrestigeY && PrestigeG>PrestigeW && PrestigeG>PrestigeB, 10,
If(PrestigeG>=PrestigeR && PrestigeG>=PrestigeY && PrestigeG>=PrestigeW && PrestigeG>=PrestigeB, 10, … with lots of nested ifs…

Ok… I can figure out first and last…
Setup a calculation for VPG1=PrestigeG>=PrestigeR && PrestigeG>=PrestigeY && PrestigeG>=PrestigeW && PrestigeG>=PrestigeB,1,x)
Same for VPY1, VPR1… etc.

then in a separate CP, Sum (VPG1+VPY1+VPR1+VPW1+VPB1) give the ties and I can figure out VP based on the number of ties for 1s place, and a similar process for last place and ties.

But I can’t figure out how to do 2nd, 3rd, and 4th place?

I’ve figured it out! Just took a few days to come up with a better solution…

Can you post the solution here?

So I’m working on the Module for Progress Evolution of Technology.
Ok. So I have Global Properties for Prestige “Score”. Blue, Green, Red, White, yellow. PrestigeB, PrestigeG, … And the “score” for each could be between 0 Prestige to 17 (or 20+ VP)…

Who ever is Highest Score gets 10 VP, 2nd gets 6, 3rd, gets 3 VP, 4th gets 1 VP, Last gets 0. And Ties are half round down. i.e If Blue and Green are tied for first 10+6/2=8 VP. If there is a 3 way tie for 2nd, 3rd, 4th… 6+3+1=10/3… 3 VP each. (i.e. My score only gets me VP if I’m better relative to everyone else.)

So rather than trying to make a filter sort, I realized that with only 5 variables, that it is easier to just calculate each players relative score compared to the other 4. I made a prototype for each players’s final victory points broken down from the various scoring sources…
Step 1. Make a prototype for each player’s score board.
2. On the Prototype made a Calculated property to count PrestigeWins i.e. if (PrestigeX>PrestigeG, 1,0) + if (PrestigeX>PrestigeR, 1,0)+… (Where PrestigeX is one player’s Prestige Score.)
3. Repeat for Prestige Losses.
4. Then make a CP for the PrestigeScore= If(Wins==4, 10 VP, (If wins==3 && Losses==0, 8 VP , If (Wins==3 && Losses==1, 6 VP (2nd place)…

i.e
4 wins= 1st. (10)
3 wins & 0 losses = tie for first (8)
3 wins & 1 Loss = 2nd (6)
2 wins & 0 Losses = tie for 1s, 2nd, 3rd (6)
2 wis & 1 Loss == tie for 2nd 3rd
2 wins & 2 losses = 3rd… etc.

And because it is limited to 5 players and some of the results over lap I could even make those an or statement in the Calculated property.

It took me a few days to realize that I don’t need to build a filter sort, since there are only 15 possible results and most overlap. So really only about 7 possible win/loss results.

I hope that helps the next VP score creator.