aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Proctor <simon.proctor@zpg.co.uk>2019-07-08 13:55:32 +0100
committerSimon Proctor <simon.proctor@zpg.co.uk>2019-07-08 13:55:32 +0100
commita30f3f17bbab2c0fa6ee27558e1cd1d990191608 (patch)
treef0f7fd8052879de46aa2e9f0281bf8a4678a6df7
parent4405f5b8bc503c92d86e76d679c4750fff6a9f02 (diff)
downloadperlweeklychallenge-club-a30f3f17bbab2c0fa6ee27558e1cd1d990191608.tar.gz
perlweeklychallenge-club-a30f3f17bbab2c0fa6ee27558e1cd1d990191608.tar.bz2
perlweeklychallenge-club-a30f3f17bbab2c0fa6ee27558e1cd1d990191608.zip
Cakes
-rw-r--r--challenge-016/simon-proctor/perl6/ch-1.p617
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-016/simon-proctor/perl6/ch-1.p6 b/challenge-016/simon-proctor/perl6/ch-1.p6
new file mode 100644
index 0000000000..eff2f108e4
--- /dev/null
+++ b/challenge-016/simon-proctor/perl6/ch-1.p6
@@ -0,0 +1,17 @@
+use v6;
+
+#| Calculate the largest slace of Pie from Pythagoras Pie Puzzle
+sub MAIN() {
+ my $cake = FatRat.new(1);
+ my $slice = 0;
+ my $person = 0;
+ for 1..100 -> $size {
+ my $nslice = $cake * ($size/100);
+ $cake -= $nslice;
+ if $nslice > $slice {
+ $slice = $nslice;
+ $person = $size;
+ }
+ }
+ say "Person $person gets {$slice*100}% of the cake or {$slice.nude().join("/")}";
+} \ No newline at end of file