I'm creating a game in python and I need to get the first player to move round the table after each turn;
I've created a player object which contains a name that remains constant and an order which changes after each turn.
However I can't order by players so that the first player changes each time;
class Player:
def __init__(self):
self.order = 0
self.name = 0
player_count = 10
players = []
for i in range(player_count):
players.append(i)
players[i] = Player()
players[i].name = i
players[i].order = i
#def play_turn():
#pass
for i in range(player_count):
if i + 1 == player_count:
players[i].order = 0
else:
players[i].order += 1
players.order.sort()
#play_turn()
It is saying:
AttributeError: 'list' object has no attribute 'order'