0

ideas regarding this game!! how should i write code for this??

 A group of n players enter a room whereupon they each receive a hat. Each player can see everyone else’s hat but not his own.  The players must each simultaneously guess a hat color, or pass.  The group loses if any player guesses the wrong hat color or if every player passes.  Players are not necessarily anonymous, they can be numbered.  Assignment of hats is assumed to be random

27th Apr 2017, 5:13 AM
Surya Pratap Singh
Surya Pratap Singh - avatar
1 Odpowiedź
+ 12
#python import random colors=["red","blue","pink","black","brown","white","green","yellow","rainbow"] p1="" p2="" p3="" p=[p1,p2,p3] for pc in p: pc=random.choice(colors) while len(p) != 0: for i in p: cg=input("guess your color: ") if cg == i: print("you win!") p.remove(i) elif cg == "pass": print("you pass.") else: print("you lose.") print("game over. this game sucks and is poorly designed. cant everyone just tell eachother their hat color and win? if you cant, there are too many colors, so you have no reasonable chance to win or affect anything. also this program may or maynot work. just stretching my whiteboard coding skills I guess") #edit: too lazy to implement the rest of the rules. it wouldn't make the game that much better anyway. cant they come up with GOOD games? geez, stick to tic tac toe. this should still be a starting point for the original poster though
27th Apr 2017, 5:43 AM
Ahri Fox
Ahri Fox - avatar