I have 10 points to distribute between 0-6 players depending on how many of their pieces have been placed on certain locations in an area. Say 3 players have an equal number of pieces there, they get 3 points each. This calculation is done for about 20 different areas, with 4-8 locations in each area, so there are lot of possible outcomes.
Do I need to write ? : strings for each location, for each possible combination and outcome? Or is there a more concise way to write the calculation and round down?
Like, here's a draft example I wrote to calculate just "r's" score for area 1 with 4 locations, where I first calculated totals 1r, 1b etc. for how many pieces each player has in the area:
1r==0 ? 0 : 1r>0&&1b+1g+1y+1k+1e=0 ? 10 : 1r==(1b+1g+1y+1k+1e) ? 5 : 1r==1&&1b+1g+1y+1k+1e=2 ? 3 : 1r==1&&1b+1g+1y+1k+1e=3 ? 2 : 1r==2&&1b+1g+1y+1k+1e=1 ? 6 : 1r==3&&1b+1g+1y+1k+1e=1 ? 7
This gives me outcomes in rough order of likelihood: 0, 10, 5, 3, 2, 6, 7, and will work, but repeat 6 times for each of 20 locations, and it's a chore to write out.
Any tips?