Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. The Prime Bubble rolls a 6, meaning that the Cascader will iterate six times
  2.  
  3. #1: We always start with a 6 sided die, and it rolls a 2, so the next die has 6x2=12 sides
  4. #2: The 12 sided die rolls an 8, meaning that the third die has 12x8=96 sides
  5. #3: The 96 sided die rolls a 35, meaning that die 4 has 96x35=3360 sides
  6. #4: The 3360 sided die rolls a 2290, so die 5 has 3360x2290 = 9,817,920 sides
  7. #5: The 9.8 million sided die rolls a 5,101,894, so the final die has 50,090,870,753,280 sides
  8. #6: The 50 trillion sided die rolls a one. Hooray.
  9. Since the last die rolled gave a 1, your function or program should output 1.
  10.  
  11. The Prime Bubble rolls a 2, meaning that the Cascader will iterate twice.
  12.  
  13. #1: We always start with a 6 sided die, and it rolls a 4, so the next die has 6x4 = 24 sides
  14. #2: The 24 sided die rolls a 14
  15.  
  16. Since the last die rolled gave a 14, your function or program should output 14.
  17.  
  18. (*1+?)^:(?`])@6
  19.  
  20. *|{x,1+1?x:(*).x}/[*a;6,a:1+1?6]
  21.  
  22. *|{x,1+1?x:(*).x}/[*a;6,a:1+1?6] / the solution
  23. { }/[n; c ] / iterate over lambda n times with starting condition c
  24. 1?6 / 1 choose 6, between 0..5 (returns a list of 1 item)
  25. 1+ / add 1 (so between 1..6)
  26. a: / store as 'a'
  27. 6, / prepend 6, the number of sides of the first dice
  28. *a / we are iterating between 0 and 5 times, take first (*)
  29. (*).x / multi-argument apply (.) multiply (*) to x, e.g. 6*2 => 12
  30. x: / save that as 'x'
  31. 1? / 1 choose x, between 0..x-1
  32. 1+ / add 1 (so between 1..x)
  33. x, / prepend x
  34. *| / reverse-first aka 'last'
  35.  
  36. (6 3 / 1 choose 6 => 3, so perform 3 iterations
  37. 18 15 / 1 choose (6*3=18) => 15
  38. 270 31 / 1 choose (18*15=270) => 31
  39. 8370 5280) / 1 choose (270*31=8730) => 5280
  40.  
  41. X6DLΩF*DLΩ
  42.  
  43. 6×X$6X’¤¡X
  44.  
  45. ¤ | Following as a nilad:
  46. 6X | - A random number between 1 and 6
  47. ’ | - Decrease by 1 (call this N)
  48. 6 | Now, start with 6
  49. $ ¡ | Repeat the following N times, as a monad
  50. × | - Multiply by:
  51. X | - A random number between 1 and the current total
  52. X | Finally, generate a random number between 1 and the output of the above loop
  53.  
  54. (r=RandomInteger)@{1,Nest[r@{1,#}#&,6,r@5]}
  55.  
  56. 6X×$5СXX
  57.  
  58. 6X×$5СXX - Link: no arguments
  59. 6 - initialise left argument to 6
  60. 5С - repeat five times, collecting up as we go: -> a list of 6 possible dice sizes
  61. $ - last two links as a monad = f(v): e.g [6,18,288,4032,1382976,216315425088]
  62. X - random number in [1,v] or [6,6,6,6,6,6]
  63. × - multiply (by v) or [6,36,1296,1679616,2821109907456,7958661109946400884391936]
  64. X - random choice (since the input is now a list) -> faces (on final die)
  65. X - random number in [1,faces]
  66.  
  67. ⊞υ⁶F⊕‽⁶⊞υ⊕‽ΠυI⊟υ
  68.  
  69. ⊞υ⁶
  70.  
  71. F⊕‽⁶
  72.  
  73. ⊞υ⊕‽Πυ
  74.  
  75. I⊟υ
  76.  
  77. ≔⁶θF‽⁶≧×⊕‽θθI⊕‽θ
  78.  
  79. ≔⁶θ
  80.  
  81. F‽⁶
  82.  
  83. ≧×⊕‽θθ
  84.  
  85. I⊕‽θ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement