Soccer leagues are often listed by points earned and games played. A team earns 3 points for a win and 1 point
for a tie. Zero points are earned for a loss.
The challenge is to create a function that gets two scalars, gamesPlayed
and pointsEarned and returns three scalars, winTotal, lossTotal, and tieTotal.
For this golf, ignore the possibility that the team may have more than 2 ties.
A non-golfed example is presented to give you somewhere to start.
sub record { my ($gp, $pts) = @_; my $win = 3; my $tie = 1; my ($winTot, $lossTot, $tieTot); $winTot = int ($pts / $win); $tieTot = $pts - ( $winTot * $win ); $lossTot = $gp - ( $winTot + $tieTot); return ($winTot, $lossTot, $tieTot); }
In reply to Golf Soccer Stats by SparkeyG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |