- 这里的变量是全局变量,可以在代码中拿来用的。增量代表鼠标拖动 时的变化量。
- 值: 代表默认值,可以被修改。
- 可以选择垂直放置滑块。
turtles-own [money] to setup clear-all create-turtles agent_num[ setxy random-xcor random-ycor set money (total_money / agent_num) ] reset-ticks end to go ask turtles[ let agsets other turtles-here if count agsets >= 1 [ transaction (one-of agsets) ] forward 1 ] tick end to transaction [trader] let deltam 0 let money1 ([money] of trader) let epsilon (random-float 1) set deltam (epsilon - 1) * money + epsilon * money1 if money + deltam >= 0 and money1 - deltam >= 0 [ set money money + deltam ask trader[ set money money1 - deltam ] ] end to to-update-plot let lst [money] of turtles set-histogram-num-bars 100 if not empty? lst [ set-plot-x-range 0 max lst histogram lst ] end