Need native Bubble Math Calculation

Hello,

I have a golf application that outputs scorecards including player handicaps. One iteration of my scorecard also takes the total number of handicap strokes awarded each player and distributes them across the 18 holes being played. Here’s an example:

To explain further, let’s just look at the first player on the scorecard (Brent Elliott). His handicap is 20. Consequently, Brent gets one stroke per hole plus an additional stroke on holes 1 and 6. Why 1 and 6? Because hole #1 is the hardest hole on the course and hole #6 is the second hardest hole on the course. (see the line labeled 'Men’s Handicap" for a ranking of difficulty by hole).

So I’m currently using a Plug-In (I’ll omit the name of the Plug-in so I don’t get in trouble with Bubble Forum moderators) to compute how many asterisks to place in the appropriate cells. Honestly, the Plug-in formula has worked really well for me though I occasionally encounter glitches. However, I recently began receiving a message in my Editor from Bubble saying the Plug-in I’m using is deprecated and that I may lose functionality on or after March 24th, 2024. Obviously, this is a huge concern to me!

Here is the formula assuming the player’s gender is male (M):

Here is the conditional formula assuming the player’s gender is female (F):

Formalize A_Ladies

Conclusion: I am looking for help to develop a formula using Bubble’s native expression builder.