囚徒困境仿真

上传人:ba****u 文档编号:123579825 上传时间:2022-07-22 格式:DOCX 页数:3 大小:129.01KB
返回 下载 相关 举报
囚徒困境仿真_第1页
第1页 / 共3页
囚徒困境仿真_第2页
第2页 / 共3页
囚徒困境仿真_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述
囚徒困境:编程: 1在海龟窗口中的程序: turtles-own totalpay pay to placeuniqueif count-turtles-here = 1 stopsetxy random screen-width random screen-height placeuniqueendto getpaylet :currentdir 0 :current 0 set pay 0 repeat 8set :current ( one-of-turtles-towards :currentdir 1 ) ifelse color = blueif (color-of :current) = blue set pay pay + 10if (color-of :current) = red set pay pay + profit set :currentdir :currentdir + 45set totalpay totalpay + payend to movefd 1 rt random 360 placeunique end to decidelet :current 0 :currentdir 0 :max 0 :maxcurrent 0repeat 8set :current (one-of-turtles-towards :currentdir 1) if :current -1if (totalpay-of :current) :maxset :max totalpay-of :current set :maxcurrent :current set :currentdir :currentdir + 45 setc color-of :maxcurrentend在观察者的窗口中的编程:to setupcacrt screen-width * screen-height * (pctcover / 100)ask-turtles ifelse (random 100) copercent setc bluesetc redask-turtles setshape square-shapeplaceuniqueendto goask-turtlesgetpaymovedecideend当利润率=10%是最终的状态时所有企业都采取合作的策略。如下图所有的方块都为蓝色(代表合作)。当利润率=10%是最终的状态时所有企业都采取不合作,背叛的策略。如下图:所有方块都变为红色(代表背叛)
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!