from TCPIPWrapper import TCPServer s = TCPServer(2222) while True: input = raw_input("Enter 1 for Yes, 0 for No: ") s.send(input)
pass if random.randint(0,1) < 1: trialMode = MODE_MISSILE phase = MISSILE_INIT_PHASE else: trialMode = MODE_AIRPLANE phase = AIRPLANE_INIT_PHASE targetSurface,targetLoc = placeAirplane(phase) #purge any stuff in the socket stream qqq = bciSocket.recvmostrecent() #send trial start signal to the BCI to turn it on bciSocket.send(TRIAL_START_PACKET) #write out trial info to log log("Starting trial: " + ("Missile" if trialMode == MODE_MISSILE else "Airplane")) x.updateText("score","Score: " + str(goodScore-badScore)) x.updateText("attempts","Attempts: " + str(attempts)) blankenize(gun) pygame.draw.polygon(gun,gunColor,rectCoords(GUN_SURFACE_SIZE,GUN_SURFACE_SIZE,GUN_LEN,GUN_WIDTH,gunOrientation)) gunLoc = polarToRect(GUN_SURFACE_SIZE,gunOrientation,GUN_BASE_X,GUN_BASE_Y) if trialMode == MODE_MISSILE: targetSurface,targetLoc = placeMissile(phase,MISSILE_DISTANCE) else: