Activity for RubenVerg
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Roll n fair dice Dyalog APL, 2 bytes ```apl ?⍴ ``` Dyadic 2-train, takes $n$ as its left argument and $m$ as its right argument The Roll function `?` expects an array of maximum bounds and replaces each item with a random number between 1 and that bound (ie `?2 6 5` returns `(random between 1 and 2) (rando... (more) |
— | over 1 year ago |
Edit | Post #288899 |
Post edited: does the leaderboard like this more? |
— | over 1 year ago |
Edit | Post #288899 | Initial revision | — | over 1 year ago |
Answer | — |
A: Can you give me half? [Extended] Dyalog APL, 4 bytes 10 bytes, 4 unique ```apl '÷'÷⍥≢'÷÷' ``` This computes the length of the string `'÷'` divided by the length of the string `'÷÷'` Alternate solution (extended only) (6 unique, 6 bytes) ```apl ⊢÷+⍨×∞ ``` This computes \[ \left(\lambda x.\frac{x}{... (more) |
— | over 1 year ago |
Comment | Post #288897 |
I think this has also a hard limit after n = 17 (if I remember correctly), because an intermediate step is generating a n-dimensional array and 17 is the maximum rank allowed in dyalog (more) |
— | over 1 year ago |
Comment | Post #288897 |
I was trying to come up with a closed form solution, but realized it would almost definitely be longer than just generating all the cases, which is quite short in APL. I suppose I'll try to get a closed form anyways and see if I was right (more) |
— | over 1 year ago |
Edit | Post #288897 |
Post edited: |
— | over 1 year ago |
Edit | Post #288897 | Initial revision | — | over 1 year ago |
Answer | — |
A: Expected value of highest dice rolled Dyalog APL, 16 bytes ```apl {(+/÷≢)⌈/¨,⍳⍵/6} ``` Explanation: `,⍳⍵/6` generate a list of all the possible sets of rolls `⌈/¨` find the maximum of each `+/÷≢` find the average (sum up all values and divide by the length of the list) this is incredibly slow and expensive memory-wise ... (more) |
— | over 1 year ago |
- ← Previous
- 1
- 2
- Next →