1. #!/usr/bin/env aspl 2. #ENVARG= -wsname TRANSIENT -groupingclass DICEGROUP 3. 4. ;;*********************************************************************** 5. ;; throwdice.aspl 6. ;; Simulate three players throwing dice on a craptable. 7. ;; ASPL, A Set Programming Language 8. ;; Copyright © 2021-2025 Bassem W. Jamaleddine 9. ;; All rights reserved. 10. ;;*********************************************************************** 11. 12. endScriptIfShellArgsLessThan 1 13. 14. displayoff 15. 16. printblock SIMULATION FOR 3 PLAYERS THROWING DICE $1 TIMES ON A CRATABLE 17. 18. ;;if $2 and $3 are not specified then ggthrowdice() set them to default 1 1 19. p1 = ggthrowdice(player,player1,throws,$1,dieland1trials, 5 $2,dieland2trials, 3 $3) 20. p2 = ggthrowdice(player,player2,throws,$1,dieland1trials, 5 $2,dieland2trials, 3 $3) 21. p3 = ggthrowdice(player,player3,throws,$1,dieland1trials, 5 $2,dieland2trials, 3 $3) 22. 23. ;; set ks vector 24. ks faces face1 face2 entropy ppdd ffl aelm 25. 26. displayon 27. 28. printblock SHOW THE THROW NUMBERS WHEN p1 AND p2 HAVE ABSOULTELY THE SAME OUTCOME 29. fU`ks= p1 p2 30. ;; similarities on throw number (ffl) along the ks (z) vector 31. 32. printblock SIMILARITY WHEN p1 AND p2 HAVE ABSOULTELY THE SAME OUTCOME 33. sim`fflz p1 p2 34. 35. printblock SHOW THE THROW NUMBERS WHEN ALL 3 PLAYERS HAVE ABSOULTELY THE SAME OUTCOME 36. fU`ks= p1 p2 p3 37. ;; similarities on throw number (ffl) along the ks (z) vector 38. 39. printblock SIMILARITY WHEN ALL 3 PLAYERS HAVE ABSOULTELY THE SAME OUTCOME 40. sim`fflz p1 p2 p3 41. 42. ks dicesum ppdd ffl aelm 43. printblock SHOW THE THROW NUMBERS WHEN ALL 3 PLAYERS HAVE THE SAME SUM 44. fU`ks= p1 p2 p3 45. 46. printblock SIMILARITY WHEN ALL 3 PLAYERS HAVE SAME SUM 47. sim`fflz p1 p2 p3 48. 49. ks diceord ppdd ffl aelm 50. printblock SHOW THE THROW NUMBERS WHEN p1 AND p2 HAVE THE SAME DICE LANDING ORDER 51. fU`ks= p1 p2 52. 53. 54. endscript 55. 56. __END__ 57. 58. $00 must be followed by three arguments: 59. number of throws, retrial on one die, retrial on the other die 60. 61. This script does the simulation of three players throwing dice on a craptable. 62. The script takes three arguments representing the number of throws, the number 63. of retrials for a specific face on one die, and the number of retrials for a 64. specific face on the other one. 65. Set the retrials to 1 and 1 for a fair dice roll. 66. Increasing the retrials cause the similarity to increase and the entropy to 67. decrease (since certainty is higher when bias increases). 68. The script prints the result of all three players that have the same sum, and also 69. prints when they have absolutely the same outcome (on both faces of the dice). 70. 71. simulate 900 throws for the three players 72. (1) $00 900 73. 74. simulate 900 throws for the three players retrying once each of the die 75. (2) $00 900 1 1 76. 77. (1) and (2) are equivalent as the throws are fair and not biased 78. 79. simulate 900 throws for the three players retrying 3 times the 1st landing die 80. and 4 times the other 81. $00 900 3 4 82. increase the retrials and the entropy will decrease as the certainty increases, 83. since it is more likely to guess the outcome. 84. 85. NOTE: * to see the script trace as it is being processed by the interpreter 86. add the -SCT option on the command line, for example: 87. $00 100 -SCT 88. $00 100 3 5 -SCT 89.