+
+ {Array.from({ length: numCows }).map((_, index) => (
+
{
+ cowRefs.current[index] = el;
+ }}
+ animate={{
+ x: cowPositions[index] || 0,
+ }}
+ />
+ ))}
+
+
+
+ Finish
+
+
+
+
+
+
+
+
+ {winners.length > 0 && (
+
+
+ Results:
+
+
+ {winners.slice(0, 3).map((winnerIndex, rank) => {
+ let placeText = "";
+ let trophyColor = "";
+ switch (rank) {
+ case 0:
+ placeText = "1st Place: ";
+ trophyColor = "#FFD700"; // Gold
+ break;
+ case 1:
+ placeText = "2nd Place: ";
+ trophyColor = "#C0C0C0"; // Silver
+ break;
+ case 2:
+ placeText = "3rd Place: ";
+ trophyColor = "#CD7F32"; // Bronze
+ break;
+ default:
+ placeText = `${rank + 1}th Place: `;
+ trophyColor = "#808080";
+ }
+ return (
+
+
+
+ {placeText} Cow {winnerIndex + 1}
+
+
+ );
+ })}
+ {winners.length > 3 && (
+
+ Other finishers:{" "}
+ {winners
+ .slice(3)
+ .map((w) => `Cow ${w + 1}`)
+ .join(", ")}
+
+ )}
+
+
+ )}
+
+ )}
+