def main(st): # st = lib.SimpleStage() st.register_players(lib.Player((0, 0, 256), "Yamatope", 0), lib.Player((256, 0, 0), "Hayashi", 1)) while (st.frame <= stg.MAX_FRAME): sys.stdout.write("\r{:0=3} / {} frame".format(st.frame, stg.MAX_FRAME)) sys.stdout.flush() # time.sleep(0.01) st.pre_draw() lib.Character.all_passive_change(st) mv.lethal_hayashi(st.players[1]) mv.yamatope_moves(st.players[0]) lib.Character.all_move(st) lib.Bullet.all_move(st) lib.Character.all_lethal_blow(st) lib.Character.respawn_check(st) if (st.frame % int(round(1 / stg.DT)) == 0): st.draw_field() # st.draw_field() st.frame += 1 sys.stdout.write("\nnow drawing...") st.output() sys.stdout.write("\033[2K\033[G") sys.stdout.write(st.__class__.__name__ + " has finished!!\n")
while True: try: N = int(raw_input('Type how many packs of cards to use (N): ').strip()) mc = int( raw_input( 'Choose matching condition (mc): type "1" for value, "2" for suit, "3" for both: ' ).strip()) break except ValueError: print('That was no valid number. Try again') # create a pile using N (from input) pacs of cards cards = lib.Cards(N) # create two players player1 = lib.Player() player2 = lib.Player() # shuffle the cards cards.shuffle(cards.cards_number) # define set of matching conditions mc_list = ['value'] if mc == 1 else ['suit'] if mc == 2 else [ 'value', 'suit' ] if mc == 3 else exit("%s is not acceptable value for matching condition" % mc) # play the game i = 1 while i < cards.cards_number: mc_value = cards.match(mc_list, i)
def set_player(server, player): player_obj = lib.Player() player_obj.player = player player_obj.guild = server lib.players[server] = player_obj return lib.players[server]
# -*- coding:utf8 -*- import sys import os sys.path.append(os.getcwd()) import lib import time if __name__ == '__main__': player = lib.Player() control = lib.Control(lib.DD()) recorder = lib.PathRecorder(player=player, control=control, delay=0.5) print(recorder.inner_record())