专栏名称: Python开发者
人生苦短,我用 Python。伯乐在线旗下账号「Python开发者」分享 Python 相关的技术文章、工具资源、精选课程、热点资讯等。
目录
相关文章推荐
Python爱好者社区  ·  月薪3万35岁脑干出血程序员:ICU躺了28 ... ·  昨天  
Python爱好者社区  ·  务必立即拿下软考证(政策红利) ·  2 天前  
Python爱好者社区  ·  软考,yyds ·  昨天  
Python爱好者社区  ·  Science披露:近3年,垃圾论文激增,9 ... ·  2 天前  
51好读  ›  专栏  ›  Python开发者

基于 Agent 的模型入门:Python 实现隔离仿真

Python开发者  · 公众号  · Python  · 2017-07-12 20:36

正文

请到「今天看啥」查看全文


count_similar += 1

else :

count_different += 1

if y > 0 and ( x , y - 1 ) not in self . empty_houses :

if self . agents [( x , y - 1 )] == race :

count_similar += 1

else :

count_different += 1

if x < ( self . width - 1 ) and y > 0 and ( x + 1 , y - 1 ) not in self . empty_houses :

if self . agents [( x + 1 , y - 1 )] == race :

count_similar += 1

else :

count_different += 1

if x > 0 and ( x - 1 , y ) not in self . empty_houses :

if self . agents [( x - 1 , y )] == race :

count_similar += 1

else :

count_different += 1

if x < ( self . width - 1 ) and ( x + 1 , y ) not in self . empty_houses :

if self . agents [( x + 1 , y )] == race :

count_similar += 1

else :

count_different += 1

if x > 0 and y < ( self . height - 1 ) and ( x - 1 , y + 1 ) not in self . empty_houses :

if self . agents [( x - 1 , y + 1 )] == race :

count_similar += 1

else :

count_different += 1

if x > 0 and y < ( self . height - 1 ) and ( x , y + 1 ) not in self . empty_houses :

if self . agents [( x , y + 1 )] == race :

count_similar += 1

else :

count_different += 1

if x < ( self . width - 1 ) and y < ( self . height - 1 ) and ( x + 1 , y + 1 ) not in self . empty_houses :

if self . agents [( x + 1 , y + 1 )] == race :

count_similar += 1







请到「今天看啥」查看全文