Maybe I'm getting this wrong.

We have current task state "A" and old task state "B".  They both have the same score.

We concatenate like this:  self.old_task_states + [self.task_states] .  The list is [B, A].  So B has an index of 1, and A has an index of 2.  We swap B to be the current task state and A to be the old one.

Then we go through again, and we again concatenate like this:  self.old_task_states + [self.task_states] so the list is [A, B].  We swap again.  And so on....