cs.addToModel(redBlock) cs.addToModel(greenBlock) cs.addToModel(blueBlock) cards = ImageSet('cards') card = None disp = Display((320, 240)) score = 0 isPrimary = False while (cards or card) and disp.isNotDone(): if card is None: card = cards.pop() cs.addImage(card) res = cs.getSegmentedImage() color = res.meanColor() if ((color[0] < 254) and (color[1] < 254) and (color[2] < 254)): isPrimary = True else: isPrimary = False card.drawText('Click left if primary, otherwise right', 0, 0) card.drawText(str(score) + ' correct answers', 0, 210) card.save(disp)