aboutsummaryrefslogtreecommitdiff
path: root/challenge-052/richard-park/apl/TieTest.aplf
blob: 31126bacf07f48521044304195bbdfc75d049d75 (plain)
1
2
3
4
5
6
7
8
9
10
 TieTest{
⍝ Can there be a tie?
     ⎕IO0
     n             ⍝ Number of coins
     b2¯1¯1+2*n   ⍝ Binary with n bits
     d(+÷≢)b        ⍝ Division of coins
     rn÷(⌈,⌊)n÷2    ⍝ Ratios of coins for 2 players
     vb[;dr]       ⍝ 0 Valid divisions of n coins between 2 players
     ⌸⍤1v        ⍝ All combinations of coins divided between 2 players
 }