Stuck in a loop

hexusnexus at gmail.com hexusnexus at gmail.com
Mon Mar 31 21:22:49 EDT 2008


I wrote a simple algorithm and it keeps getting stuck in a loop.  I
guess I'm just to tired to figure it out:

compcount=[5,4,2,2]
suitrank=[0,0,0,0]

trump=2
l,lt=0,0
while l<4:
    while lt<4:
        if l==trump:
            l+=1
        if l>3:
            break
        if lt==trump:
            lt+=1
        if compcount[l]<compcount[lt]:
            suitrank[l]+=1
    lt+=1
l+=1

In case you're wondering, the point is to rank suits from highest to
lowest based on how few cards each suit has.  I hope that's enough
information.



More information about the Python-list mailing list