Search the Community
Showing results for tags 'golf'.
-
I am writing a golf league management system and one request is to give points for lowest net score. Simple enough. Now when there is a tie I need to go back starting at the first hole and get the lowest score and if a tie move to the next hole and so on. Also there can be more than one division so I have the division seperated. Here is the array containing the players that have tied. In the example below A is the division the next is the Players unique id and ppoints is what they would have gotten if there was no tie. Not all this information is needed but have it in the array until the script is complete. The s_id is needed to update the database which has already been populated with the scores. Array ( [A] => Array ( [193] => Array ( [s_id] => 9 [pid] => 193 [ppoints] => 6 [net] => 31 [tie] => yes ) [199] => Array ( [s_id] => 10 [pid] => 199 [ppoints] => 7 [net] => 31 [tie] => yes ) [191] => Array ( [s_id] => 5 [pid] => 191 [ppoints] => 5 [net] => 31 [tie] => yes ) ) [B] => Array ( [202] => Array ( [s_id] => 8 [pid] => 202 [ppoints] => 6 [net] => 25 [tie] => yes ) [194] => Array ( [s_id] => 11 [pid] => 194 [ppoints] => 7 [net] => 25 [tie] => yes ) ) ) This array is the strokes achieved by each golfer. So you have the unique id and then h1 is hole1 and so on. Array ( [189] => Array ( [h1] => 4 [h2] => 4 [h3] => 5 [h4] => 4 [h5] => 5 [h6] => 4 [h7] => 3 [h8] => 5 [h9] => 5 ) [203] => Array ( [h1] => 4 [h2] => 4 [h3] => 5 [h4] => 5 [h5] => 5 [h6] => 5 [h7] => 4 [h8] => 5 [h9] => 5 ) [190] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [204] => Array ( [h1] => 5 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 5 [h6] => 5 [h7] => 5 [h8] => 4 [h9] => 6 ) [191] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 3 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 5 ) [201] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [192] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [202] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 5 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [193] => Array ( [h1] => 4 [h2] => 5 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [199] => Array ( [h1] => 5 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [194] => Array ( [h1] => 4 [h2] => 4 [h3] => 5 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [200] => Array ( [h1] => 4 [h2] => 4 [h3] => 4 [h4] => 4 [h5] => 4 [h6] => 4 [h7] => 4 [h8] => 4 [h9] => 4 ) [195] => Array ( [h1] => 5 [h2] => 5 [h3] => 5 [h4] => 5 [h5] => 5 [h6] => 5 [h7] => 5 [h8] => 5 [h9] => 5 ) [197] => Array ( [h1] => 5 [h2] => 5 [h3] => 5 [h4] => 5 [h5] => 5 [h6] => 5 [h7] => 5 [h8] => 5 [h9] => 6 ) [196] => Array ( [h1] => 5 [h2] => 5 [h3] => 5 [h4] => 5 [h5] => 5 [h6] => 5 [h7] => 5 [h8] => 5 [h9] => 5 ) [198] => Array ( [h1] => 5 [h2] => 5 [h3] => 5 [h4] => 5 [h5] => 5 [h6] => 5 [h7] => 5 [h8] => 5 [h9] => 5 ) ) So here's what needs to happen. Those 3 in the first division who have ties need to compare scores. So first hole 193 and 191 got 4 sonot they move to the second hole. 191 got a 4 so he ranks first so 193 would rank second and 199 would be third. I need a loop to compare all thrugh the 9 holes just in case it goes till the end. Hope I explained it well enough. Thanks in advance for the help.