lucky draw
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
globals [tickets winners] to setup clear-all set tickets [] ; 初始化籤的列表 set winners [] ; 初始化中獎者號碼的列表 let total-tickets number-of-tickets ; 從使用者那裡獲取總籤數 ; 生成一個從1到total-tickets的數字列表 repeat total-tickets [ set tickets lput total-tickets tickets set total-tickets total-tickets - 1 ] output-print (word "There are total " length tickets " lucky numbers.") end to draw ifelse (length tickets > 0) [ ; 隨機選擇一個籤並從列表中移除 let drawn one-of tickets set tickets remove-item (position drawn tickets) tickets set winners lput drawn winners output-print (word "The lucky winner is: " drawn) ] [ output-print "All the numbers are drawn." ] end ;to-report number-of-tickets ; ; ; 這裡假設你有一個介面元素讓使用者輸入總籤數 ; ; report user-input "請輸入總共有多少個籤:" ; ;end
There is only one version of this model, created over 1 year ago by Brian Chih.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
lucky draw.png | preview | Preview for 'lucky draw' | over 1 year ago, by Brian Chih | Download |
This model does not have any ancestors.
This model does not have any descendants.