My work for Hoon 101. Will remain private until the class is over.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

62 lignes
1.2KB

  1. :: Hoon 101 - Week 6
  2. :: ~bannum-magtus || s@p7.co.nz
  3. ::
  4. :- %say
  5. |= [[* eny=@uvJ *] [x=@ y=@ ~] ~]
  6. :- %noun
  7. ?: (gth (mul x y) 52)
  8. !!
  9. =<
  10. :: Im so sorry
  11. (take-hands x y new-deck)
  12. |%
  13. ++ take-hands
  14. |= [x=@ y=@ d=(list tape)]
  15. ^- (list (list tape))
  16. =/ hands=(list (list tape)) ~
  17. |-
  18. ?: =(x 0)
  19. hands
  20. %= $
  21. hands :-((scag y d) hands)
  22. d (slag y d)
  23. x (dec x)
  24. ==
  25. ++ suit-store
  26. ^- (list tape)
  27. ["H" "D" "C" "S" ~]
  28. ++ suit-donnees
  29. ^- (list tape)
  30. ["A" "2" "3" "4" "5" "6" "7" "8" "9" "10" "J" "Q" "K" ~]
  31. ++ new-deck
  32. =/ nd=(list tape) ~
  33. =/ s 0
  34. |-
  35. ?: (gte s 4)
  36. (shuffle-deck nd eny)
  37. =/ v 0
  38. |-
  39. ?. (lth v 13)
  40. ^$(s +(s))
  41. %= $
  42. v +(v)
  43. nd :-((weld (snag v suit-donnees) (snag s suit-store)) nd)
  44. ==
  45. ++ shuffle-deck
  46. |= [unshuffled=(list tape) entropy=@]
  47. ^- (list tape)
  48. =| shuffled=(list tape)
  49. =/ random ~(. og entropy)
  50. =/ remaining (lent unshuffled)
  51. |-
  52. ?: =(remaining 1)
  53. :_ shuffled
  54. (snag 0 unshuffled)
  55. =^ index random (rads:random remaining)
  56. %= $
  57. shuffled (snag index unshuffled)^shuffled
  58. remaining (dec remaining)
  59. unshuffled (oust [index 1] unshuffled)
  60. ==
  61. --