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


Python Model.move方法代码示例

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


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

示例1: __init__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import move [as 别名]
class Controller:
    def __init__(self):
        self.model = Model()
        self.view = View(self.model.WORLD_SIZE)
        self.view.main_menu = True
        # self.model.robot.image=self.model.robot.image.convert(pygame.Surface((20, 20)))
        # self.model.robot.image=self.model.robot.image.convert_alpha(pygame.Surface((20, 20)))
        # self.model.robot.image.set_colorkey((255,255,255))
    
    def Run(self, ):


        main = self.model.get_keyboard()            # checking if QUIT has been pressed
        if self.view.new_game:
            self.model.restart()
            self.view.new_game = False
        if (not self.view.game_over) and (not self.view.main_menu):
            self.model.get_position_agents()            # analyzing social situation
            self.model.update_won_towers()
            self.model.get_targets()
            self.model.get_outcome_matrices()
            self.model.map_outcome_matrices_in_interdependence_space()
            self.model.check_for_deception()
            self.model.move(self.view.dt)                           # moving the agents
        self.view.display(self.model)
        if not main:
            return False
        else:
            return True
开发者ID:ewerlopes,项目名称:simulation-deception,代码行数:31,代码来源:sim.py

示例2: makemove

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import move [as 别名]
 def makemove(self):
     if self.move >= 4:
         return
     model = Model()
     model.grid = self.grid.copy()
     model.move(self.move)
     if (self.grid == model.grid).all():
         self.invalid = True
     self.grid = model.grid.copy()
开发者ID:sihrc,项目名称:2048-Python-ML,代码行数:11,代码来源:minimax.py

示例3: zip

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import move [as 别名]
        for row, col in zip(*np.where(node.grid == 0)):
            newnode = Node(move = 4, grid = node.grid)
            newnode.grid[row, col] = 2
            node.children.append(decide(newnode, depth - 1))
        node.getScore()
        return node



if __name__ == "__main__":
    # pygame.init()
    while True:
        current_model = Model()
        # view = View(current_model)
        while True:
            grid = current_model.grid.copy()
            if len(np.where(grid != 0)[0]) > 8:
                depth = 5
            else:
                depth = 3
            node = decide(Node(5, grid), depth = depth)
            move = node.bestMove()
            if move == None:
                print "GAMEOVER"
                break
            current_model.move(move)
            # view.draw()
            current_model.update()
            # view.draw()
        print np.max(node.grid)
开发者ID:sihrc,项目名称:2048-Python-ML,代码行数:32,代码来源:minimax.py


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