Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx01.iad01.newshosting.com!newshosting.com!216.196.98.142.MISMATCH!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Tue, 07 Feb 2012 09:35:43 -0600 |
| Message-ID | <4F3144CE.1B87@mindspring.com> (permalink) |
| Date | Tue, 07 Feb 2012 10:35:42 -0500 |
| From | pete <pfiland@mindspring.com> |
| Reply-To | pfiland@mindspring.com |
| Organization | PF |
| X-Mailer | Mozilla 3.04Gold (WinNT; I) |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.c |
| Subject | Re: card-counting program for blackjack |
| References | <18e43b14-0c7a-41bf-84a8-dc27f0e199f2@c6g2000vbk.googlegroups.com> <4F314405.6A9F@mindspring.com> |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 90 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 4.154.218.149 |
| X-Trace | sv3-YZZFBGh6pV9aqdzDdk+5xebsUMRxWh/tilW5KehgRIofHcD65mU3/URrQwBDgY/aLAFxL6L0KxAEtLm!yo4s12ixh6xhqfGjA1mb71r61FfBclDu1By3Eq6GEZH3ww3kSmG8vntr0Ik9OF6R4wGvsxKG3gAP!YO1QZw783NY= |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 3342 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c:16840 |
Show key headers only | View raw
pete wrote:
>
> luser- -droog wrote:
> >
> > Sir, is that a keyboard in your sleeve?
> >
> > 692(1)03:51 PM:~ 0> cat bj.c && echo --------- && make bj && bj
> > #include <ctype.h>
> > #include <stdio.h>
> > #include <string.h>
> >
> > enum { cards = 13, suits = 4, decks = 4 };
> > int count[cards];
> > int total;
> > char symbols[] = "234567890jqka";
> >
> > void reset() {
> > int i;
> > total = 0;
> > for (i=0; i < cards; i++)
> > total += count[i] = suits * decks;
> > }
> >
> > void sub(char c) {
> > if(c=='s')
> > reset();
> > else {
> > char *p = strchr(symbols, tolower(c));
> > if (p == NULL) return;
> > --count[ p - symbols ];
> > --total;
> > }
> > }
> >
> > void show() {
> > int i;
> > for (i=0; i < cards; i++) printf(" %c ", toupper(symbols[i]));
> > puts("");
> > for (i=0; i < cards; i++) printf("%3d ", count[i]);
> > printf(" 10s:%d ", count[8]+count[9]+count[10]+count[11]);
> > printf(" Total:%d", total);
> > puts("");
> > for (i=0; i < cards; i++) printf("%3d ", (count[i]*100)/total);
> > printf(" 10s:%d ", ((count[8]+count[9]+count[10]+count[11])*100)/
> > total);
> > puts("");
> > }
> >
> > char buf[99];
> >
> > void readline() {
> > fgets(buf,99,stdin);
> > }
> >
> > void doline() {
> > int i = 0;
> > while(buf[i]){
> > if (!isspace(buf[i]))
> > sub(buf[i]);
> > ++i;
> > }
> > }
> >
> > int main() {
> > reset();
> > while(1) {
> > show();
> > readline();
> > doline();
> > }
> > return 0;
> > }
> >
> > ---------
> > cc -g -Wall bj.c -o bj
> > 2 3 4 5 6 7 8 9 0 J Q K A
> > 16 16 16 16 16 16 16 16 16 16 16 16 16 10s:64 Total:
> > 208
> > 7 7 7 7 7 7 7 7 7 7 7 7 7 10s:30
>
> This point is where the output stops on my machine.
> Either that,
> or this is the point where the program runs too slowly
> for me to continue waiting for more output.
I think I'm supposed to input something at this point
but I haven't figured out what yet.
--
pete
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
card-counting program for blackjack luser- -droog <mijoryx@yahoo.com> - 2012-02-05 13:56 -0800
Re: card-counting program for blackjack pete <pfiland@mindspring.com> - 2012-02-07 10:32 -0500
Re: card-counting program for blackjack pete <pfiland@mindspring.com> - 2012-02-07 10:35 -0500
Re: card-counting program for blackjack luser- -droog <mijoryx@yahoo.com> - 2012-02-07 22:59 -0800
csiph-web