I can see the tack near F to avoid the shoals, but then once you'd gone North towards X, couldn't ou have played that leg further north and then avoided a couple of more tacks on the way back west again?

Not knowing any local currents or rounding requirements that may be a dumb question. Or were you just tacking to cover the competition?

Sailboat racing. Just like poker, a simple game with a small rulebook.

We call that "banging the corners" of the course. It's very difficult to accurately call a lay line so far away. I've constantly been advised not to try, and to just make a few extra tacks. Yet, frequent tacking impairs speed, so what to do?

The wind was fading fast, and after each tack, I'd fall off a bit to build speed, and find myself not driving where I wanted to go, so in this instance you're probably correct.

If I'd had more breeze, I probably would have pointed better, not need to drive to "X", and not needed some of those tacks.

There are several things I can do to help mitigate the poor pointing in light air:

Not carry a full crew.
Buy a new, high tech genoa.
Empty out the boat some more.
Replace my running rigging with light, high tech stuff.