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