Back before I learned to code I played a lot of Fifa. One of the many things I’ve wasted a good portion of life on! Still, I just saw a TV advert announcing the release of the new version, so thought it deserved a kata in memory of the many happy hours.
You have placed bets on a series of football matches. Your ticket is represented by (ticket) and will look something like this:
Each line is a seperate bet and will be a key:value pair within the ticket object. In each case you will always place a bet for a home win, an away win and a draw. You’re weird like that. Each bet is for a different game.
Your will also be given an array of (results). Like this:
[3-0, 1-1, 0-2] results.split(‘-‘)
if (r1) result+=arr;
if (r2) result+=arr;
if (r3) result+=arr;