当前位置: 首页>>代码示例>>Python>>正文


Python World.stepForward方法代码示例

本文整理汇总了Python中World.World.stepForward方法的典型用法代码示例。如果您正苦于以下问题:Python World.stepForward方法的具体用法?Python World.stepForward怎么用?Python World.stepForward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在World.World的用法示例。


在下文中一共展示了World.stepForward方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: extract_startsize

# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import stepForward [as 别名]
def extract_startsize(a):
    beetype, formation, formnumber, seed = a
    w = World(beetype,
              len(formation),
              len(formation)*2,
              len(formation)*2,
              {"seed":0, "formation":formation},
              seed,
              True)
    w.stepForward()
    i = 0
    return [seed, beetype.__name__, formnumber,  w.sizeOfWorld]   
开发者ID:Wieke,项目名称:bee-formation,代码行数:14,代码来源:batch-performance-test.py

示例2: do_work

# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import stepForward [as 别名]
def do_work(a):
    beetype, formation, formnumber, seed = a
    w = World(beetype,
              len(formation),
              len(formation)*2,
              len(formation)*2,
              {"seed":0, "formation":formation},
              seed,
              True)

    i = 0
    while not w.finished and  i < 1000:
        w.stepForward()
        i += 1


    if not i < 1000:
        print(seed, beetype.__name__, "formation", formnumber, "  DNF!")
        return [seed, beetype.__name__, formnumber, "DNF", "DNF", w.beeSteps, w.sizeOfWorld]        
    else:
        print(seed, beetype.__name__,"formation",formnumber, "done!")
        return [seed, beetype.__name__, formnumber, w.totalStates, w.timeToFinish, w.beeSteps, w.sizeOfWorld]        
开发者ID:Wieke,项目名称:bee-formation,代码行数:24,代码来源:batch-performance-test.py

示例3: BeeForm

# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import stepForward [as 别名]

#.........这里部分代码省略.........
                               self.widthofworld,
                               self.heightofworld,
                               self.beearguments.copy(),
                               self.worldseed)
            self.view.startworldwidth = self.widthofworld
            self.view.startworldheight = self.heightofworld
            self.view.reset(self.world)
            self.updatetime()
            self.updateDrawingArea()
            self.setupcomlist()


    def startstop(self):
        if self.world is not None:
            if not self.running:
                self.running = True
                timeout_add(self.runworldinterval, self.runWorld)
            else:
                self.running = False

    def stepback(self):
        if self.world is not None:
            if self.world.currentState > 0:            
                self.running = False
                self.world.stepBackward()
                self.updateDrawingArea()
                self.updateComlist()
                self.updatebeedebug()
                self.updatetime()

    def stepforward(self):
        if self.world is not None:
            self.running = False
            self.world.stepForward()
            self.updateDrawingArea()
            self.updateComlist()
            self.updatebeedebug()
            self.updatetime()            

    def updatetime(self):
        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
开发者ID:Wieke,项目名称:bee-formation,代码行数:69,代码来源:BeeForm.py


注:本文中的World.World.stepForward方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。