Re: card dealer

2013-09-28 Thread Tim Roberts
Antoon Pardon wrote: > >Op 28-09-13 12:31, Ned Batchelder schreef: >> >> I've thought that way about it too: there are so many shuffles any way, >> it won't be a problem. But think about it like this: if you shuffle a >> deck of 52 cards with a default Python random object, then once you have >>

Re: card dealer

2013-09-28 Thread Antoon Pardon
Op 28-09-13 12:31, Ned Batchelder schreef: On 9/28/13 2:01 AM, Steven D'Aprano wrote: On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ag

Re: card dealer

2013-09-28 Thread Dave Angel
On 28/9/2013 06:31, Ned Batchelder wrote: > > I've thought that way about it too: there are so many shuffles any way, > it won't be a problem. But think about it like this: if you shuffle a > deck of 52 cards with a default Python random object, then once you have > dealt out only 28 car

Re: card dealer

2013-09-28 Thread Ned Batchelder
On 9/28/13 2:01 AM, Steven D'Aprano wrote: On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items

Re: card dealer

2013-09-27 Thread Steven D'Aprano
On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: > On 9/27/13 12:10 PM, Denis McMahon wrote: >> On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: >> >>> i recall >>> writing a shuffle function in C decades ago, which took an array of >>> (52) unique items and put them in random order.

Re: card dealer

2013-09-27 Thread Ned Batchelder
On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items and put them in random order. Whenever I tried to write shuffles I came up against a fairly fundamental

Re: card dealer

2013-09-27 Thread Dave Angel
On 27/9/2013 12:10, Denis McMahon wrote: > On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: > >> i recall >> writing a shuffle function in C decades ago, which took an array of (52) >> unique items and put them in random order. > > Whenever I tried to write shuffles I came up against a fairly

Re: card dealer

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: > i recall > writing a shuffle function in C decades ago, which took an array of (52) > unique items and put them in random order. Whenever I tried to write shuffles I came up against a fairly fundamental limit: 52! > prng states Granted pr

Re: card dealer

2013-09-27 Thread Dave Angel
On 27/9/2013 07:26, Dave Angel wrote: > On 27/9/2013 06:24, markot...@gmail.com wrote: > I sent the previous message long before I had finished. > > If you had created your global list containing list(range(52)), then you > could do nearly your entire program with one call to random.sample. > > ht

Re: card dealer

2013-09-27 Thread Alister
kaart % 13 a = kaart / 13 print(mast[int(a)] + " " + > aste[int(m)]) > > def vali_järgmine_vaba(n): > i = -1 > > while(n > 0): > n -= 1 i = i + 1 while kaart_tõmmatud[i]: > i = i + 1 > kaart_tõmmatud[i] = True return

Re: card dealer

2013-09-27 Thread MRAB
+ aste[int(m)]) def vali_järgmine_vaba(n): i = -1 while(n > 0): n -= 1 i = i + 1 while kaart_tõmmatud[i]: i = i + 1 kaart_tõmmatud[i] = True return i def random(n): return randint(0, n) while True: n = int(input("Mitu

Re: card dealer

2013-09-27 Thread Dave Angel
= vali_järgmine_vaba(n) > m = kaart % 13 > a = kaart / 13 > print(mast[int(a)] + " " + aste[int(m)]) > > def vali_järgmine_vaba(n): > i = -1 > > while(n > 0): > n -= 1 > i = i + 1 > while kaart_tõmmatud[i]: >

card dealer

2013-09-27 Thread markotaht
> 0): n -= 1 i = i + 1 while kaart_tõmmatud[i]: i = i + 1 kaart_tõmmatud[i] = True return i def random(n): return randint(0, n) while True: n = int(input("Mitu kaarti tõmmata(0 et väljuda): ")) if(n==0): break f