SAMPLES = 25
# Change spacing by changing the relative length of the vectors.  It looks
# like scaling by 0.75 is pretty good, but this is adjustable:
VEC_LEN = 0.75 * WORLDSIZE / SAMPLES
# Animation parameters:
ANIMATION_MIN = 0
ANIMATION_MAX = 500
ANIMATION_FRAMES = 50
FLAG_INT = 0
OTHER_TANK = 20

BZRC = BZRC('localhost', 50101)
# print 'got here'
time.sleep(2)
# print 'done sleeping'
mytanks, othertanks, flags, shots = BZRC.get_lots_o_stuff()
f = othertanks[OTHER_TANK]
# commands = []
# command = Command(FLAG_INT, 1,.5, False)
# commands.append(command)
# results = BZRC.do_commands(commands)
# print f.color
# print 'flag x = ' + str(f.x)
# print 'flag y = ' + str(f.y)

########################################################################
# Field and Obstacle Definitions


def generate_field_function(scale):
    def function(x, y):
Exemple #2
0
# How many samples to take along each dimension:
SAMPLES = 25
# Change spacing by changing the relative length of the vectors.  It looks
# like scaling by 0.75 is pretty good, but this is adjustable:
VEC_LEN = 0.75 * WORLDSIZE / SAMPLES
# Animation parameters:
ANIMATION_MIN = 0
ANIMATION_MAX = 500
ANIMATION_FRAMES = 50
FLAG_INT = 0

BZRC = BZRC('localhost', 50103)
# print 'got here'
time.sleep(2)
# print 'done sleeping'
mytanks, othertanks, flags, shots = BZRC.get_lots_o_stuff()
f = flags[FLAG_INT]
# print f.color
# print 'flag x = ' + str(f.x)
# print 'flag y = ' + str(f.y)

########################################################################
# Field and Obstacle Definitions

def generate_field_function(scale):
    def function(x, y):
        '''User-defined field function.'''
        sqnorm = (x**2 + y**2)
        if sqnorm == 0.0:
            return 0, 0
        else: