initpython:# Start with empty setall_objects=set()# Making 10 objects and adding to set of all_objectsforiinrange(0,10):all_objects.add('obj'+str(i))# Current objectscurr_objects=set()# Random object function# Takes in the number of objects wanted in curr_objectsimportrandomdefrandom_objects(num=1):globalall_objectsglobalcurr_objectscurr_objects=random.sample(all_objects,num)# The game starts here.labelstart:showscreendebug"Start with 10 objects in total"$random_objects(3)"3 random objects"$random_objects(5)"5 random objects"# Check if obj1 and obj2 are in curr_objectsifall(xincurr_objectsforxin["obj1","obj2"]):"You have obj1 and obj2"elif"obj1"incurr_objects:"You have obj1"else:"You don't have obj1 at all"returnscreendebug():hbox:frame:hasvboxtext"all_objects:"forobjinsorted(all_objects):textobjframe:hasvboxtext"curr_objects:"forobjinsorted(curr_objects):textobj
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.