本文整理汇总了Python中World.World.getworldState方法的典型用法代码示例。如果您正苦于以下问题:Python World.getworldState方法的具体用法?Python World.getworldState怎么用?Python World.getworldState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.getworldState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BeeForm
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import getworldState [as 别名]
#.........这里部分代码省略.........
text = str(self.world.currentState) + " / " + str(self.world.totalStates)
self.timelabel.set_text(text)
def setupcomlist(self):
position = 0
if self.comlist.get_n_columns() > 0:
for i in reversed(range(0,self.comlist.get_n_columns())):
self.comlist.remove_column(
self.comlist.get_column(i))
columns = ["Position","Awake"]
if self.selectedbeeclass is not None:
if self.selectedbeeclass.comkeys() is not None:
columns = columns + self.selectedbeeclass.comkeys()
for c in columns:
column = Gtk.TreeViewColumn(c)
cell = Gtk.CellRendererText()
column.pack_start(cell, True)
column.add_attribute(cell, "text", position)
position += 1
self.comlist.append_column(column)
self.comstore = Gtk.ListStore(*[str]*position)
self.comlist.set_model(self.comstore)
def updateComlist(self):
self.comstore.clear()
for position, bee, move, com in self.world.getworldState():
entry = list()
entry.append(str(position[0]) + "," + str(position[1]))
entry.append(str(bee.awake))
if bee.__class__.comkeys() is not None:
for c in bee.__class__.comkeys():
if com is not None:
if c in com:
entry.append(str(com[c]))
else:
entry.append("None")
else:
entry.append("None")
self.comstore.append(entry)
def checkbeearguments(self):
if self.selectedbeeclass == None:
self.logline("No bee selected")
return False
if self.amountofbees == None:
self.logline("Amount of bees not set.")
return False
elif self.amountofbees < 1 or "formation" not in self.beearguments:
self.logline("Please draw a formation of at least a single bee")
return False
if self.widthofworld == None:
self.logline("Width not set.")
return False