def __init__(self): Input.__init__(self) self._candidates = [] self._candidates_set = [] self._regex = set() self._regex_expressions = [] self._entries = set()
def __init__(self, *args): Input.__init__(self) self.tokenizer = nltk.data.load('tokenizers/punkt/english.pickle') if len(args) == 1 and isinstance(args[0][0], str): print("AdvancedChecker for Regex:\n") self.regex_list = args[0] self.type = "REGEX" else: print("AdvancedChecker for Triples:\n") self.triples = args[0] self.type = "TRIPLES"
def main() -> None: print('--- Ping Pong Pi Client starting... ---') print('> Server URL: %s' % SERVER_URL) print('> Resource Type: %s' % RESOURCE_TYPE) print() config = ClientConfig(SERVER_URL) display = Display.get_display() input = Input.get_input() atexit.register(input.clear) atexit.register(display.clear) try: with Resource(RESOURCE_TYPE, config) as resource: input.register_key_handler(lambda: handle_input(resource)) last_status = resource.get_status() display.show_message(last_status.name, get_color_for_status(last_status)) while True: status = resource.get_status() if last_status != status: print('Status changed to: %s' % status) display.show_message(status.name, get_color_for_status(status)) last_status = status try: sleep(1) except KeyboardInterrupt: exit() except ConnectionError: display.show_message('Initial status check failed - stopping', Color.RED)
def __init__(self, x: float, y: float, data: type, mass, phone: ConnectPhone = None) -> None: """ Initialize a player with given parameters. :param x: initial x-position :param y: initial y-position :param data: Dataclass used to store player settings """ self.mass = mass self.initial_position: np.ndarray = np.array([x, y], dtype=float) self.position: np.ndarray = np.array([x, y], dtype=float) self.velocity: np.ndarray = np.zeros(2, dtype=float) self.acceleration: np.ndarray = np.zeros(2, dtype=float) self.score = 0 self.input: Input = Input(data, phone) self.name = '' self.color: Colors = Colors.random() self.data: type = data self.shield_on: bool = False self.health_bar: HealthBar = HealthBar(self, PlayerSettings.health)
def recommendation(): # number of recommended items numberOfItems = 20 print(numberOfItems) # (PortfolioDescription, EvaluationOfRecommenders) portfolioDescr, evaluationOfRecommenders = Input.input01() portfolioDescr, evaluationOfRecommenders = Input.input02() #portfolio:Portfolio portfolio = Portfolio(portfolioDescr) # itemIDs:list<int> itemIDs = portfolio.run(evaluationOfRecommenders, numberOfItems) print(itemIDs)
def __init__(self, input_folder="../instructions/input_example", output_folder="../instructions/output", debug=False): self.input = Input(input_folder) self.output_folder = output_folder self.debug = debug self.menu = Menu()
def main(): black = (0, 0, 0) pygame.init() screen = pygame.display.set_mode((1000, 1000)) done = False foe_ball = Ball(200, 200, uuid4(), Team.FOE, 50, 50) friend_ball = Ball(100, 200, uuid4(), Team.FRIEND, 50, -50) ego_ball = Ball(500, 500, uuid4(), Team.EGO, 50, 50) flag = Flag(100, 100) world_state = State([foe_ball] + [friend_ball] + [ego_ball], flag) clock = pygame.time.Clock() while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True screen.fill(black) # reset the screen before we redraw the state clock.tick(60) # tagpro runs at 60hz delta_t_ms: int = clock.get_time() pygame_pressed = pygame.key.get_pressed() if pygame_pressed[pygame.K_k]: ego_ball.handle_pop() elif pygame_pressed[pygame.K_r]: ego_ball.is_popped = False elif pygame_pressed[pygame.K_SPACE]: # Of all sensible keypress combinations, choose the one with the lowest score in dt. best_keypresses = myopic.best_keypresses(world_state, delta_t_ms) current_input = Input({ego_ball.id: best_keypresses}) else: current_input = Input( {ego_ball.id: Keys.from_pygame_pressed(pygame_pressed)}) world_state = world_state.next_state(current_input, delta_t_ms) world_state.draw(screen) pygame.display.flip()
def loadInputSystem(self): self.input = Input(self)
def __init__(self): Input.__init__(self) self.test = [] self.predition = []
def __init__(self, words, similarity): Input.__init__(self) self.words = words self.sim = similarity self.index = 0
def __init__(self): Input.__init__(self)