I've been working on programming a board game to practice python. I use a cycle to do turn order like this:
turncycle = [0,1,2,3]
for turnindex in cycle(turncycle):
#.
#...turn stuff
#...turnindex is used for active player
#.
What I want to do is given a turn index start a mini turn where an event-card triggers and they have to something. Is there a way to rebuild the list so I can change [0,1,2,3] into [1,2,3,0] or cycle starting from 1,2, or 3 and then cycle through the rest once?
What about something like this?
def next_cycle(lst):
return turncycle[1:] + turncycle[:1]
turncycle = [0, 1, 2, 3]
for turnindex in range(len(turncycle)):
turncycle = next_cycle(turncycle)
print turncycle