Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- players = {"player 1":0, "player 2":0}
- def play_ghost():
- for p_id in cycle(players):
- ##code..
- if end_game() : ##if this is true, add 1 to the OTHER player
- ##what to write here ?
- wins = {"player1": 0, "player2": 0}
- this, other = "player1", "player2"
- for i in range(rounds_count): # really, variable i don't use
- this, other = other, this # swap players
- if end_game():
- wins[this] +=1
- else:
- wins[other] += 1
- players = [0, 0]
- players[1] # player 2, because lists are 0-based
- players[1:] # all players but the first
- # if you want to do more complex selects, do this, but DON'T for simple stuff
- [player for index, player in enumerate(players) if index == 1]
- players = {"player 1":0, "player 2":0}
- names = players.keys()
- other = dict(zip(names, names[::-1]))
- # other = {'player 1': 'player 2', 'player 2': 'player 1'}
- def play_ghost():
- for p_id in cycle(players):
- ##code..
- if end_game() : ##if this is true, add 1 to the OTHER player
- players[other[p_id]] += 1
- players = [0, 0]
- def play_ghost():
- for index in range(len(players)):
- #code...
- if end_game():
- players[(index + 1) % 2] += 1 # Uses mode to select other player
Add Comment
Please, Sign In to add comment