Talk:Seven-sided dice from five-sided dice: Difference between revisions
Talk:Seven-sided dice from five-sided dice (view source)
Revision as of 22:30, 14 September 2009
, 14 years ago→J solution seems ugly: simplify code
(→J solution seems ugly: instructive version) |
m (→J solution seems ugly: simplify code) |
||
Line 30:
dice5=: [: >: ] ?@$ 5: NB. makes a y shape array of 5s, "rolls" the array and increments.
rolltwice=: [: dice5 2 ,~ ] NB. rolls dice5 twice for each desired dice7 roll (y rows, 2 cols)
base5to10=: 5
keepgood=: #~ 21&> NB. compress out values not less than 21
groupsof3=: [: >. >: % 3: NB. increments, divides by 3 and takes ceiling
|