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


Python BZRC.close方法代码示例

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


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

示例1: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))
    
    gridVisualizer = GridFilter(-400,800,-400,800,0.9,0.97)
    
    agent = Agent(bzrc)

    prev_time = time.time()

    # Run the agent
    try:
        gridVisualizer.init_window(801, 801)
        while True:
            time_diff = time.time() - prev_time
            gridVisualizer = agent.tick(time_diff, gridVisualizer)
            if (time_diff >= 1):
                gridVisualizer.update_grid()
                gridVisualizer.draw_grid()
                prev_time = time.time()
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:okiobe,项目名称:bzflag470,代码行数:35,代码来源:testAgent.py

示例2: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port, foodSupply = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    gridPlotter = GridFilter()
    cc = CommandCenter(bzrc, foodSupply,gridPlotter)
    gridPlotter.init_window(800, 800,cc.tick)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            action = threading.Thread(target =cc.tick, args=[time_diff])
            action.start()
            action.join()
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:VanWardawg,项目名称:BZRFlag,代码行数:32,代码来源:TerranAgent.py

示例3: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
 def main(self):
     
     # Process CLI arguments.
     try:
         execname, host, port  = sys.argv
     except ValueError:
         execname = sys.argv[0]
         print >>sys.stderr, '%s: incorrect number of arguments' % execname
         print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
         sys.exit(-1)
 
     # Connect.
     
     bzrc = BZRC(host, int(port))
     mytanks = bzrc.get_mytanks()
     for i in range(len(mytanks)):
         if i < 8:
             if i < 5:
                 self.tanks.append(SuperUberAgent(bzrc,mytanks[i],"a"))
             else:
                 self.tanks.append(SuperUberAgent(bzrc,mytanks[i],"d"))  
         else:
             self.tanks.append(BayesAgent(bzrc,mytanks[i],self.grid, self.obsList))
     
        
     try:
         while True:
             self.tick(self.tanks,bzrc)
            
     except KeyboardInterrupt:
         print "Exiting due to keyboard interrupt."
         bzrc.close()
开发者ID:Altair3,项目名称:Tanks,代码行数:34,代码来源:Driver.py

示例4: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    agent = Agent(bzrc)

    prev_time = time.time()
    # thread = threading.Thread(target=init_window, args=(int(800),int(800)))
    # thread.start()
    init_window(int(800),int(800))
    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            agent.tick(time_diff)
            draw_grid(time_diff > 10)
            if time_diff > 10:
                prev_time = time.time()
    except (KeyboardInterrupt, SystemExit):
        print "Exiting due to keyboard interrupt."
        bzrc.close()
        draw_grid(True)
开发者ID:brainwood-school,项目名称:cs470,代码行数:34,代码来源:agentBayesFilter.py

示例5: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    # bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    # initialize the visualization stuff
    world_size = int(bzrc.get_constants()['worldsize'])
    viz = KalmanViz(world_size)

    # create our agent (just assume it's the first tank on our team)
    agent = KalmanFilterAgent(bzrc, 0, viz)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            prev_time = time.time()
            agent.tick(time_diff)

    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
        viz.destroy()
开发者ID:thyer,项目名称:CS470,代码行数:36,代码来源:KalmanFilterAgent.py

示例6: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    # bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))
    agent = PFAgent(bzrc)
    agent.tick()

    plot_single(agent.calculate_obstacles_force, agent.obstacles, 'obstacles.png')
    plot_single(agent.calculate_goal_force, agent.obstacles, 'goal.png')
    plot_single(agent.calculate_random_force, agent.obstacles, 'random.png')
    plot_single(agent.calculate_tangential_force, agent.obstacles, 'tangential.png')

    plot_single(agent.get_forces_on_tank, agent.obstacles, 'combined.png')

    print("finished")
    bzrc.close()
开发者ID:thyer,项目名称:CS470,代码行数:27,代码来源:show_field.py

示例7: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port, use_penalized_mode = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >> sys.stderr, "%s: incorrect number of arguments" % execname
        print >> sys.stderr, "usage: %s hostname port enablepenalties" % sys.argv[0]
        sys.exit(-1)

    # Connect.
    # bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    use_penalized_mode = use_penalized_mode == "1"  # convert into a boolean
    print "use_penalized_mode is %d" % use_penalized_mode
    agent = Agent(bzrc, use_penalized_mode)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            agent.tick(time_diff)
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:swesonga,项目名称:cs470,代码行数:30,代码来源:multi_agent_search.py

示例8: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    agent = basicAgent(bzrc)

    init_window(800,800)
    # Run the agent
    try:
        tickCounter = 0
        prev_time = time.time()
        while True:
            time_diff = time.time() - prev_time
            prev_time = time.time()
            agent.tick(time_diff)
            if tickCounter % 10 == 0:
                draw_grid()
                update_grid(numpy.array(zip(*agent.beliefMap)))
                #update_grid(numpy.array(agent.beliefMap))
            tickCounter = tickCounter + 1
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:bweaver2,项目名称:bzrFlag,代码行数:35,代码来源:basicAgent.py

示例9: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >> sys.stderr, "%s: incorrect number of arguments" % execname
        print >> sys.stderr, "usage: %s hostname port" % sys.argv[0]
        sys.exit(-1)

    # Connect.
    # bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    agent = Agent(bzrc)

    prev_time = time.time()

    # Run the agent
    try:

        # initialize all the tanks to 'not turning'
        mytanks = bzrc.get_mytanks()
        for tank in mytanks:
            print tank.index
            agent.angleset.append(False)
            agent.startangle.append(0)

        while True:
            time_diff = time.time() - prev_time
            prev_time += time_diff
            agent.tick(time_diff)
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:lwthatcher,项目名称:CS-470,代码行数:37,代码来源:dumbagent.py

示例10: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
	# Process CLI arguments.
	try:
		execname, host, port = sys.argv
	except ValueError:
		execname = sys.argv[0]
		print >>sys.stderr, '%s: incorrect number of arguments' % execname
		print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
		sys.exit(-1)

	# Connect.
	#bzrc = BZRC(host, int(port), debug=True)
	bzrc = BZRC(host, int(port))
	
	bayes = Bayes()
	constants = bzrc.get_constants()
	bayes.self_not_obs_given_not_occ(float(constants['truenegative']))
	bayes.set_obs_given_occ(float(constants['truepositive']))
	
	agent = Agent(bzrc, bayes)

	prev_time = time.time()

	# Run the agent
	try:
		while True:
			time_diff = time.time() - prev_time
			agent.tick(time_diff)
	except KeyboardInterrupt:
		print "Exiting due to keyboard interrupt."
		bzrc.close()
开发者ID:lwthatcher,项目名称:CS-470,代码行数:33,代码来源:grid_agent_02.py

示例11: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)
        
    #print "Running Tyler & Morgan's Super Smart Flag Capturer"
    numpy.set_printoptions(precision=3,suppress=True)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))
    
    agent = Agent(bzrc)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            new_time = time.time()
            time_diff = new_time - prev_time
            prev_time = new_time
            agent.tick(time_diff)
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:rIZenAShes,项目名称:TM.CS470.2012,代码行数:33,代码来源:kalman_agent.py

示例12: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >> sys.stderr, "%s: incorrect number of arguments" % execname
        print >> sys.stderr, "usage: %s hostname port" % sys.argv[0]
        sys.exit(-1)

    # Connect.
    # bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    print "Starting agent: Kalman Filter shooter"
    agent = KalmanTank(bzrc)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            now = time.time()
            time_diff = now - prev_time
            agent.tick(time_diff)
            prev_time = now
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:jy19,项目名称:CS470,代码行数:31,代码来源:kalman.py

示例13: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        #noise needs to be passed into the necessary functions
        execname, host, port, psi, noise = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port psi noise' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    gridPlotter = GridFilter()
    bzrc = BZRC(host, int(port))
    nexus = Nexus(bzrc, int(psi), int(noise),gridPlotter)
    gridPlotter.init_window(800, 800,nexus.tick)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            action = threading.Thread(target =nexus.tick, args=[time_diff])
            action.start()
            action.join()
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:VanWardawg,项目名称:BZRFlag,代码行数:32,代码来源:ProtossAgent.py

示例14: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
	# Process CLI arguments.
	try:
		execname, host, port, search = sys.argv
	except ValueError:
		execname = sys.argv[0]
		print >>sys.stderr, '%s: incorrect number of arguments' % execname
		print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
		sys.exit(-1)

	# Connect.
	#bzrc = BZRC(host, int(port), debug=True)
	bzrc = BZRC(host, int(port))

	if search == 'b':
		agent = VisibilityGraphAgent(bzrc, BreadthFirstSearch(False))
	elif search == 'd':
		agent = VisibilityGraphAgent(bzrc, DepthFirstSearch(False))
	elif search == 'a':
		agent = VisibilityGraphAgent(bzrc, AStarSearch(False))
	else:
		print >>sys.stderr, 'bad search value. must be a d or b'
		sys.exit(-1)

	prev_time = time.time()

	# Run the agent
	try:
		while True:
			time_diff = time.time() - prev_time
			prev_time = time.time()
			agent.tick(time_diff)
	except KeyboardInterrupt:
		print "Exiting due to keyboard interrupt."
		bzrc.close()
开发者ID:Seiji42,项目名称:cs-470-labs,代码行数:37,代码来源:VisibilityGraphAgent.py

示例15: main

# 需要导入模块: from bzrc import BZRC [as 别名]
# 或者: from bzrc.BZRC import close [as 别名]
def main():
    # Process CLI arguments.
    try:
        execname, host, port = sys.argv
    except ValueError:
        execname = sys.argv[0]
        print >>sys.stderr, '%s: incorrect number of arguments' % execname
        print >>sys.stderr, 'usage: %s hostname port' % sys.argv[0]
        sys.exit(-1)

    # Connect.
    #bzrc = BZRC(host, int(port), debug=True)
    bzrc = BZRC(host, int(port))

    agent = Agent(bzrc)

    prev_time = time.time()

    # Run the agent
    try:
        while True:
            time_diff = time.time() - prev_time
            agent.tick(time_diff)
    except KeyboardInterrupt:
        print "Exiting due to keyboard interrupt."
        bzrc.close()
开发者ID:mikebcurtis,项目名称:bzrflag,代码行数:28,代码来源:dumbagent.py


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