def __init__(self, argparser): Application.__init__( self, argparser, True ) # starting mock mode, init flags (-w and -ng) will be redirected to the server self.server_process = None self.running = True signal(SIGINT, self.close_processes)
def __init__(self, argparser): Application.__init__(self, argparser) self.base_color = None self.color = (1.0, 1.0, 1.0) # relative coordonate to image center self.y = self.height / 2 self.x = self.width / 2 # offset from self.offset_y = 0 self.offset_x = 0 self.model.set_all('white') self.state = 'init' self.spawns = [] self.speed = 1 self.fade = 1 self.vector = None self.color_level = [0] * 6 self.last_spawn_color = 0 # Treating arguments parser = argparser.parse_args() self.invader = parser.invader self.ai = parser.auto self.file = parser.pattern if (self.file == ''): self.image = Image.new('RGB', size, (255, 255, 255)) else: self.image = Image.open(self.file) self.image = self.image.resize(size)
def __init__(self, touch_mode='quadridirectional'): Application.__init__(self, touch_mode=touch_mode) self.pierres = [] self.bomb1 = Bomb((0, 0), 1) self.bomb2 = Bomb((0, 0), 2) self.bomb3 = Bomb((0, 0), 3) self.bomb4 = Bomb((0, 0), 4) self.bomb5 = Bomb((0, 0), 1) self.bomb6 = Bomb((0, 0), 2) self.bomb7 = Bomb((0, 0), 3) self.bomb8 = Bomb((0, 0), 4) self.bomb9 = Bomb((0, 0), 1) self.bomb10 = Bomb((0, 0), 2) self.bomb11 = Bomb((0, 0), 3) self.bomb12 = Bomb((0, 0), 4) self.slotbombs = [ self.bomb1, self.bomb2, self.bomb3, self.bomb4, self.bomb5, self.bomb6, self.bomb7, self.bomb8, self.bomb9, self.bomb10, self.bomb11, self.bomb12 ] self.bombs = [] for i in range(1, self.height, 2): for j in range(self.width): if (j == 1 or j == 3 or j == 6 or j == 8): self.pierres.append((i, j)) self.p1 = Player((14, 5), 1, 'cyan') self.p2 = Player((0, 4), 2, 'darkblue') self.p3 = Player((6, 0), 3, 'green') self.p4 = Player((8, 9), 4, 'purple')
def __init__(self, parser, animations): Application.__init__(self, parser) config = animations[self.args.type] self.durations = [int(config['dur_min']*config['rate']), int(config['dur_max']*config['rate'])] self.rate = Rate(config['rate']) self.colors = config['colors'] self.generator = self.generators[config['generator_id']]
def __init__(self): Application.__init__(self) self.PIECE = (8, 4) self.TABJEU = [[0] * 7 for _ in range(6)] self.DIRECTION = (0, 0) self.fin = False self.rate = Rate(self.RATE_SPEED) self.player_actu = True
def __init__(self, argparser, touch_mode='quadridirectional'): Application.__init__(self, argparser, touch_mode=touch_mode) self.DIRECTION = DOWN self.HEAD = (5, 5) self.queue = [self.HEAD] self.FOOD_POSITIONS = {} self.rate = 2 self.rate_increase = self.args.speed self.start_food = self.args.food
def __init__(self): Application.__init__(self) pygame.init() self.fin = False self.games = ['pong','puissance4','tetris'] self.indiceGame = 0 self.choix = self.games[self.indiceGame] self.PLATEAU_COLOR = 'blue' self.launch = False
def __init__(self, argparser, touch_mode='quadridirectional'): Application.__init__(self, argparser, touch_mode=touch_mode) self.DIRECTION=DOWN self.HEAD=(5,5) self.queue=[self.HEAD] self.FOOD_POSITIONS={} self.rate=2 self.rate_increase=self.args.speed self.start_food=self.args.food
def __init__(self, parser, animations): Application.__init__(self, parser) config = animations[self.args.type] self.durations = [ int(config['dur_min'] * config['rate']), int(config['dur_max'] * config['rate']) ] self.rate = Rate(config['rate']) self.colors = config['colors'] self.generator = self.generators[config['generator_id']]
def __init__(self, port, argparser=None): Application.__init__(self, argparser) self.port = int(port) self.flask = Flask(__name__) logging.basicConfig(level=logging.DEBUG) self.current_auth_nick = self.OFF self.nicknames = {} self.lock = RLock() CORS(self.flask) self.loop = None self.route()
def __init__(self, port, argparser=None): Application.__init__(self, argparser) self.port = int(port) self.flask = Flask(__name__) logging.basicConfig(level=logging.DEBUG) self.current_auth_nick = self.OFF self.nicknames = {} self.lock = RLock() CORS(self.flask) self.loop = None self.route()
def __init__(self): Application.__init__(self, touch_mode='quadridirectional') self.score = 0 self.t0 = time.time() self.playing = True self.command = { 'left': False, 'right': False, 'down': False } # User commands (joy/keyboard) self.breakout = Breakout(self.arbalet.height, self.arbalet.width)
def __init__(self): Application.__init__(self, touch_mode='quadridirectional') self.grid = numpy.zeros([self.height, self.width], dtype=int) self.old_grid = deepcopy(self.grid) self.speed = 2 # Speed of tetromino fall in Hertz self.score = 0 self.playing = True self.tetromino = None self.command = {'left': False, 'right': False, 'down': False, 'rotate': False} # User commands (joy/keyboard) self.touchdown = False # True if the tetro has reached the floor self.music = Music()
def __init__(self, argparser): Application.__init__(self, argparser) self.parser = argparser self.renderer = None self.framerate = 44100 ##### Fourier related attributes, we generate a suitable log-scale self.num_bands = self.width if self.args.vertical else self.height self.min = 50 self.max = 22050 #self.db_scale = [self.framerate*2**(b-self.num_bands) for b in range(self.num_bands)] #self.db_scale = [self.min+self.max*2**(b-self.num_bands+1) for b in range(self.num_bands)] self.db_scale = [self.max*(numpy.exp(-numpy.log(float(self.min)/self.max)/self.num_bands))**(b-self.num_bands) for b in range(1, self.num_bands+1)] print("Scale of maximum frequencies:", list(map(int, self.db_scale)))
def __init__(self, argparser, num_lanes, path, speed): Application.__init__(self, argparser, touch_mode='columns') self.arbalet.touch.set_keypad(False) self.num_lanes = num_lanes self.score = 0 self.speed = float(speed) self.rate = Rate(self.speed) self.grid = [['background']*num_lanes for h in range(self.height)] # The coming notes (last line included even if it will overwritten by the bottom bar) self.bar = ['idle']*num_lanes # The bottom bar, idle = not pressed, hit = pressed during a note, pressed = pressed outside a note # Threads creation and starting self.renderer = Renderer(self.model, self.grid, self.bar, self.height, num_lanes, self.width) self.reader = SongReader(path, num_lanes, self.args.level, speed) self.sound = SoundManager(path) self.hits = UserHits(self.num_lanes, self.arbalet, self.sound, self.args.simulate_player)
def __init__(self, touch_mode='quadridirectional'): Application.__init__(self, touch_mode=touch_mode) self.rate=2 self.DIRECTION1=DOWN self.HEAD1=(1,1) self.queue1=[self.HEAD1] self.DIRECTION2=UP self.HEAD2=(13,8) self.queue2=[self.HEAD2] self.FOOD_POSITIONS={} self.rate_increase=0.15 self.start_food=3
def __init__(self): Application.__init__(self, touch_mode='quadridirectional') self.grid = numpy.zeros([self.height, self.width], dtype=int) self.old_grid = deepcopy(self.grid) self.speed = 2 # Speed of tetromino fall in Hertz self.score = 0 self.playing = True self.tetromino = None self.command = { 'left': False, 'right': False, 'down': False, 'rotate': False } # User commands (joy/keyboard) self.touchdown = False # True if the tetro has reached the floor self.music = Music()
def __init__(self): Application.__init__(self) pygame.init() self.BALLE = [7, random.randrange(0, 9)] self.P1_RACKET = range(3, 6) self.P2_RACKET = range(3, 6) self.P1_DIRECTION = [] self.P2_DIRECTION = [] self.P1_SCORE = 0 self.P2_SCORE = 0 self.SCORE_WIN = 5 self.TABJEU = [[0] * 10 for _ in range(14)] self.fin = False self.ballspeed_increase = 0.01 self.ballspeed = 0.5 self.limspeed = 0.11 self.RATE_SPEED = 2 self.lenP1_RACKET = len(self.P1_RACKET) self.lenP2_RACKET = len(self.P2_RACKET)
def __init__(self, argparser, num_lanes, path, speed): Application.__init__(self, argparser, touch_mode='columns') self.arbalet.touch.set_keypad(False) self.num_lanes = num_lanes self.score = 0 self.speed = float(speed) self.rate = Rate(self.speed) self.grid = [ ['background'] * num_lanes for h in range(self.height) ] # The coming notes (last line included even if it will overwritten by the bottom bar) self.bar = [ 'idle' ] * num_lanes # The bottom bar, idle = not pressed, hit = pressed during a note, pressed = pressed outside a note # Threads creation and starting self.renderer = Renderer(self.model, self.grid, self.bar, self.height, num_lanes, self.width) self.reader = SongReader(path, num_lanes, self.args.level, speed) self.sound = SoundManager(path) self.hits = UserHits(self.num_lanes, self.arbalet, self.sound, self.args.simulate_player)
def __init__(self, parser, rate): Application.__init__(self, parser) self.balls = [] self.rate = Rate(rate) def rand(): return choice([-1, 1]) * uniform(1. / rate, 10. / rate) for ball in range(4): self.balls.append( Ball(ball, randint(0, self.height - 1), randint(0, self.width - 1), self.height, self.width, Ball.colors[ball % len(Ball.colors)], rand(), rand())) # Motion control via Leap Motion self.swipe = [None] self.swipe_lock = RLock() if leapmotion: self.leap_listener = SampleListener(self.swipe, self.swipe_lock) self.controller = Controller() self.controller.add_listener(self.leap_listener)
def __init__(self, parser, rate): Application.__init__(self, parser) self.balls = [] self.rate = Rate(rate) def rand(): return choice([-1, 1])*uniform(1./rate, 10./rate) for ball in range(4): self.balls.append(Ball(ball, randint(0, self.height-1), randint(0, self.width-1), self.height, self.width, Ball.colors[ball%len(Ball.colors)], rand(), rand())) # Motion control via Leap Motion self.swipe = [None] self.swipe_lock = RLock() if leapmotion: self.leap_listener = SampleListener(self.swipe, self.swipe_lock) self.controller = Controller() self.controller.add_listener(self.leap_listener)
def __init__(self, parser): Application.__init__(self, parser) self.CHAR_COLORS = self.args.type self.BG_COLOR = 'black'
def __init__(self, argparser): Application.__init__(self, argparser) self.image = None self.palette = None self.vertical = False
def __init__(self, parser): Application.__init__(self, parser) self.CHAR_COLORS = self.args.type self.BG_COLOR = 'black'
def __init__(self, argparser): Application.__init__(self, argparser, True) # starting mock mode, init flags (-w and -ng) will be redirected to the server self.server_process = None self.running = True signal(SIGINT, self.close_processes)
def __init__(self): Application.__init__(self, touch_mode='quadridirectional') self.t0 = time.time() self.playing = True self.command = {'left': False, 'right': False,'left_p2': False, 'right_p2': False} # User commands (joy/keyboard) self.pong = Pong(self.arbalet.height,self.arbalet.width)
def close(self, reason='unknown'): Application.close(self, reason)
def __init__(self, argparser): Application.__init__(self, argparser) self.port = str(self.args.port) self.context = zmq.Context() self.connection = None
def close(self, reason='unknown'): Application.close(self, reason) if leapmotion: self.controller.remove_listener(self.leap_listener)
def __init__(self, argparser): Application.__init__(self, argparser) self.video_reader = None
def close(self, reason='unknown'): Application.close(self, reason) if leapmotion: self.controller.remove_listener(self.leap_listener)
def __init__(self, parser, rate): Application.__init__(self, parser) self.rate = Rate(rate) self.t = Table(self.height, self.width, 3) print(self.t.table)
def __init__(self, argparser): Application.__init__(self, argparser) self.colors = ['red', 'green', 'blue'] self.color_index = 0
def __init__(self, argparser): Application.__init__(self, argparser) self.colors = ['red', 'green', 'blue'] self.color_index = 0
def __init__(self, argparser): Application.__init__(self, argparser) self.port = str(self.args.port) self.context = zmq.Context() self.connection = None
def __init__(self, argparser): Application.__init__(self, argparser) self.video_reader = None
def __init__(self, port, argparser=None): Application.__init__(self, argparser) self.bottle = Bottle() self.port = int(port) self.route()