
November 23rd, 2012, 12:13 AM
|
 |
Contributing User
|
|
|
|
|
chase the indexes until you get to the start. If the length of this cycle is the length of the list the game is valid.
L = [1,2,0]
Start your count at 0.
Start at index 0. Save index 0.
Add 1 to your count.
Look up L[0]. It is 1.
Is it 0?
No.
Add 1 to your count.
Look up L[1]. It is 2.
Is it 0?
No.
Add 1 to your count.
Look up L[2]. It is 0.
Is it 0?
Yes.
Is the count equal to the list length?
Yes.
These are valid assignments for the game.
__________________
[code] Code tags[/code] are essential for python code!
|