if board.is_winning(): already_won.add(board) if len(already_won) == winning_pos: print(f"The winning board is:\n{board}") return board.sum_unmarked() * n def task1(input): numbers, boards = read_input(input) return score_winning_board(numbers, boards, 1) def task2(input): numbers, boards = read_input(input) return score_winning_board(numbers, boards, len(boards)) if __name__ == "__main__": util.set_debug(False) sample = util.read_strs("input/sample/04.in", sep="\n\n") input = util.read_strs("input/04.in", sep="\n\n") print("TASK 1") util.call_and_print(task1, sample) util.call_and_print(task1, input) print("\nTASK 2") util.call_and_print(task2, sample) util.call_and_print(task2, input)
email_msg += "AVG bidsz/asksz: %d/%d\n" % ((bid_sz_tot/quote_cnt), (ask_sz_tot/quote_cnt)) email_msg += "\n" email_msg += error_lines util.email(email_subj, email_msg) if __name__ == '__main__': util.check_running() util.check_include() parser = OptionParser() parser.add_option("-d", "--debug", default=False, action="store_true", dest="debug") (options, args) = parser.parse_args() if options.debug: util.set_debug() else: util.set_log_file() util.info('launching guillotine listener') cfg_file = os.environ['CONFIG_DIR'] + '/exec.conf' util.info("loading config file: %s" % cfg_file) trade_cfg = config.load_trade_config(cfg_file) gtc = guillotine.multiplex_channel() gtc.connect(trade_cfg['servers'], trade_cfg['account'], trade_cfg['password'], name="gt_listener_" + os.environ['STRAT']) gtc.register(gt_listener(gtc)) timeout = 0.2 #polling frequency in seconds asyncore.loop(timeout, use_poll=True)