Simple solitaire
<p>I'm trying to make a simple solitaire in wich you get a random number of card heaps with a random number of cards in ex. heap1: 4 cards, heap2 5 cards and so on.
Lets say we have four heaps with values 4, 5, 7, 1. 
Now what is done is that one card is removed from each heap to create a new one.
So the next step would look like this 4, 5, 7, 1 -> 3, 4, 6, 4.
The solitaire is finished when it reaches a stable number ex.
5, 3, 2 -> 4, 2, 1, 3 -> 3, 1, 2 ,4... now we will always get the same four values if the numbers are sorted.</p>

<p>How would this be done in the best way? I have some basic knowledge in programming but 
nothing advanced. </p>

<p>So far i have tried this but it does not work out well, i don't know how to make the loop
stop at a stable number.</p>

<pre><code>while len(y) &gt; 1:
    for i in range(len(y)):
        y[i] -= 1
    y = [x for x in y if x != 0]
    y.append(len(y))
    y.sort()
    print(y)
</code></pre>
