# Winter Holiday Tag - December project # Game of Tag basic project, no extensions import radio from codex import * import ascii_art import time import random # -- Constants -- NUM_PLAYERS = 15 MY_NUM = 1 present = ''' /.=BLACK x=WHITE 0=GREEN #=RED @=ORANGE C=CYAN ....xx.........xx....... ...x##xx.....xx##x...... ...x####xxxxx####x...... ....xx###x#x###xx....... ......x##x#x##x......... .......xxxxxxx@@@....... ...xxxxxxxxxxxxxxx@..... ...x0000x###x0000x.@.... ...x0000x###x0000x.@.... ...xxxxxxxxxxxxxxx.CCC.. ...x0000x###x0000x.CCC.. ...x0000x###x0000x.CCC.. ...x0000x###x0000x.CCC.. ...x0000x###x0000x.CCC.. ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...x0000x###x0000x...... ...xxxxxxxxxxxxxxx...... ''' tag = ascii_art.get_images(present, scale=10) #-- Functions -- def set_pic(have_present): if have_present: display.draw_image(tag[0]) pixels.set([RED, RED, GREEN, GREEN]) else: display.show(pics.TARGET) pixels.off() # -- Set Up -- radio.on() radio.config(channel=6) have_present = Fase if MY_NUM == 1: have_present = True # -- Play Game -- while True: set_pic(have_present) if buttons.is_pressed(BTN_U) and have_present: send_to = MY_NUM while send_to == MY_NUM: send_to = random.randint(1, NUM_PLAYERS) radio.send(str(send_to)) have_present = False msg = radio.receive() if msg: if msg == str(MY_NUM): have_present = True