def position(self, i): print('Debris clickeed', Debris.TI) ti = Debris.TI dx, dy = randint(0, 5), randint(0, 5) self._t.tween(200, x=280+dx+16*ti//3, y=154+dx+16*ti % 3, w=16, h=16) Debris.TI += 1
def random_pokemon(): y = __random.randint(0, Pokemon.grid_height - 1) x = 0 if y == Pokemon.grid_height - 1: x = __random.randint(0, Pokemon.short_grid_width - 1) else: x = __random.randint(0, Pokemon.grid_width - 1) return EnemyPokemon(0, 0, x, y)
def __init__(self, drs, fig, crafty, world): print('Treeclickeed__init__', i) self.world = world self.i = i dx, dy = randint(0, 20), randint(0, 10) self._t = crafty.e('2D, Canvas, Mouse, Tween, debris%d' % fig)\ .attr(x=360+dx+16*drs//4, y=134+dy+16*drs % 4, w=16, h=16, _globalZ=15) self._t.bind("Click", self.click)
def random_splice(str): begin = __random.randint(0,len(str)/2) end = __random.randint(len(str)/2, len(str)) withIter = __random.choice([True, False, False]) iter = None if withIter: iter = __random.randint(0, end - begin) + 1 else: iter = 1 return ListSplice(begin, end, iter, str)
def _position(self, i): print('Treeclickeed', Tree.TI) ti = Tree.TI dx, dy = randint(0, 14), randint(0, 14) self._t.tween(200, x=140+dx+25*ti//3, y=180+dx+25*ti % 3, w=20, h=20) Tree.TI += 1 self._click = self._brake if Tree.TI >= 8: self.world.fogfade()
def urandom(n): """urandom(n) -> str Return n random bytes suitable for cryptographic use.""" import __random randbytes = [chr(__random.randint(0, 256)) for i in range(n)] return "".join(randbytes)
def urandom(n): """urandom(n) -> str Return n random bytes suitable for cryptographic use.""" import __random randbytes= [__random.randint(0,255) for i in range(n)] return bytes(randbytes)
def random(level): return Number(__random.randint(0, 10))
def generate_problem(): choice = __random.randint(0,1) if choice == 0: return ListSplice.generate_list_splice() return Expression.generate_exp_question()
def fruitfall(self): print('fruitfall') for fruit in range(12): self.crafty.e('2D, Canvas, Tween, fruit%d' % fruit)\ .attr(x=280 + 20*fruit//3, y=140+20*fruit % 3, w=16, h=16, _globalZ=14)\ .tween(randint(100, 3000), y=140+10+20*fruit % 3)
def urandom(n): """urandom(n) -> str Return n random bytes suitable for cryptographic use.""" import __random randbytes = [chr(__random.randint(0, 256)) for i in range(n)] return ''.join(randbytes)
def randRange(self, mini, maxi): """Random Range. :class:`crafty.core.BCrafty` :returns: a number ranging from mini to maxi """ return randint(mini, maxi)
def urandom(n): """urandom(n) -> str Return n random bytes suitable for cryptographic use.""" import __random randbytes = [__random.randint(0, 255) for i in range(n)] return bytes(randbytes)