Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.sinclair > #23 > unrolled thread
| Started by | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| First post | 2011-03-03 11:15 -0800 |
| Last post | 2011-03-08 07:31 -0800 |
| Articles | 14 — 7 participants |
Back to article view | Back to comp.sys.sinclair
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Blackjack for the ZX80 (mostly) completed "N.N. Thayer" <nnthayer1@gmail.com> - 2011-03-03 11:15 -0800
Re: Blackjack for the ZX80 (mostly) completed rwap <rich@rwapservices.co.uk> - 2011-03-03 12:25 -0800
Re: Blackjack for the ZX80 (mostly) completed "N.N. Thayer" <nnthayer1@gmail.com> - 2011-03-03 12:45 -0800
Re: Blackjack for the ZX80 (mostly) completed greenaum@yahoo.co.uk (greenaum) - 2011-03-11 06:33 +0000
Re: Blackjack for the ZX80 (mostly) completed "Chris Young" <chris.usenet@mail-filter.com> - 2011-03-03 20:58 +0100
Re: Blackjack for the ZX80 (mostly) completed "N.N. Thayer" <nnthayer1@gmail.com> - 2011-03-03 13:34 -0800
Re: Blackjack for the ZX80 (mostly) completed "N.N. Thayer" <nnthayer1@gmail.com> - 2011-03-03 13:36 -0800
Re: Blackjack for the ZX80 (mostly) completed gus <gdeldago@gmail.com> - 2011-03-04 04:17 -0800
Re: Blackjack for the ZX80 (mostly) completed "N.N. Thayer" <nnthayer1@gmail.com> - 2011-03-04 05:17 -0800
Re: Blackjack for the ZX80 (mostly) completed gus <gdeldago@gmail.com> - 2011-03-04 06:02 -0800
Re: Blackjack for the ZX80 (mostly) completed "Chris Young" <chris.usenet@mail-filter.com> - 2011-03-04 17:44 +0100
Re: Blackjack for the ZX80 (mostly) completed gus <gdeldago@gmail.com> - 2011-03-09 08:05 -0800
Re: Blackjack for the ZX80 (mostly) completed Linards Ticmanis <ticmanis@gmx.de> - 2011-03-07 19:59 +0100
Re: Blackjack for the ZX80 (mostly) completed Leiradella <leiradella@bigfoot.com> - 2011-03-08 07:31 -0800
| From | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| Date | 2011-03-03 11:15 -0800 |
| Subject | Re: Blackjack for the ZX80 (mostly) completed |
| Message-ID | <0acd516a-d32f-4f7c-b860-1791051fee7d@y31g2000prd.googlegroups.com> |
On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > - There's one major gameplay flaw that was inherited from his original > code: when you're dealt an ace, you're not given the option to > designate it as 11 if doing so would not put you over 21. The program > automatically designates it as 1. Hmm. I tried tacking on another subroutine at the end. Initial redirect: 21 IF J=11 AND D+J<21 THEN GOSUB 660 22 IF J=1 AND D+J<21 THEN GOSUB 660 then 660 PRINT "ACE DEALT, COUNT AS 11 OR 1?" 661 INPUT U 662 IF U=11 THEN LET J=11 663 IF U=1 THEN LET J=1 664 RETURN The results were strange - sometimes the program would seem to ignore the subroutine entirely. It would deal me an 11 or 1 in my starting hand with with no prompt for choosing which, or it would ask me to choose and then give my choice to the computer's hand. I figure there must be something I'm not understanding about the game logic. Any help would be appreciated :)
[toc] | [next] | [standalone]
| From | rwap <rich@rwapservices.co.uk> |
|---|---|
| Date | 2011-03-03 12:25 -0800 |
| Message-ID | <5b6773ec-15ce-46e0-aa9d-3d0b215ec4bd@c8g2000vbv.googlegroups.com> |
| In reply to | #23 |
On Mar 3, 7:15 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > - There's one major gameplay flaw that was inherited from his original > > code: when you're dealt an ace, you're not given the option to > > designate it as 11 if doing so would not put you over 21. The program > > automatically designates it as 1. > > Hmm. I tried tacking on another subroutine at the end. > > Initial redirect: > > 21 IF J=11 AND D+J<21 THEN GOSUB 660 > 22 IF J=1 AND D+J<21 THEN GOSUB 660 > > then > > 660 PRINT "ACE DEALT, COUNT AS 11 OR 1?" > 661 INPUT U > 662 IF U=11 THEN LET J=11 > 663 IF U=1 THEN LET J=1 > 664 RETURN > > The results were strange - sometimes the program would seem to ignore > the subroutine entirely. It would deal me an 11 or 1 in my starting > hand with with no prompt for choosing which, or it would ask me to > choose and then give my choice to the computer's hand. > > I figure there must be something I'm not understanding about the game > logic. Any help would be appreciated :) Don't forget lines 21 and 22 should be checking for D+J<=21 (not just <21) You could also use: 21 IF (J=11 OR J=1) AND D+J<=21 THEN GOSUB 660
[toc] | [prev] | [next] | [standalone]
| From | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| Date | 2011-03-03 12:45 -0800 |
| Message-ID | <87c61cd9-9bac-4f3b-84ae-6e43c4fce9fb@y31g2000prd.googlegroups.com> |
| In reply to | #25 |
On Mar 3, 2:25 pm, rwap <r...@rwapservices.co.uk> wrote: > On Mar 3, 7:15 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > > > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > > - There's one major gameplay flaw that was inherited from his original > > > code: when you're dealt an ace, you're not given the option to > > > designate it as 11 if doing so would not put you over 21. The program > > > automatically designates it as 1. > > > Hmm. I tried tacking on another subroutine at the end. > > > Initial redirect: > > > 21 IF J=11 AND D+J<21 THEN GOSUB 660 > > 22 IF J=1 AND D+J<21 THEN GOSUB 660 > > > then > > > 660 PRINT "ACE DEALT, COUNT AS 11 OR 1?" > > 661 INPUT U > > 662 IF U=11 THEN LET J=11 > > 663 IF U=1 THEN LET J=1 > > 664 RETURN > > > The results were strange - sometimes the program would seem to ignore > > the subroutine entirely. It would deal me an 11 or 1 in my starting > > hand with with no prompt for choosing which, or it would ask me to > > choose and then give my choice to the computer's hand. > > > I figure there must be something I'm not understanding about the game > > logic. Any help would be appreciated :) > > Don't forget lines 21 and 22 should be checking for D+J<=21 (not just > <21) > > You could also use: > 21 IF (J=11 OR J=1) AND D+J<=21 THEN GOSUB 660 Well, in the case of D+J=21, there's no need to decide between 11 and 1 - just whether to hit or stand, and at 21 the player will stand. (I suppose I could make it so that the player's hand automatically halts if he hits 21, but I rather like the surprise-tension of "Oh! 21. I'll stand." Sounds silly but it's true.) What I'm not understanding is the abnormal behavior I'm seeing from the program when I add my subroutine. Why would it prompt me for the 11-vs-1 choice, and then put my choice into the *computer's* hand instead of mine? Or worse yet, ignore the subroutine entirely and just keep dealing out 11's and 1's without prompting at all? There's something about the program's logic that I'm not comprehending. :(
[toc] | [prev] | [next] | [standalone]
| From | greenaum@yahoo.co.uk (greenaum) |
|---|---|
| Date | 2011-03-11 06:33 +0000 |
| Message-ID | <4d95814d.13544375@news.eternal-september.org> |
| In reply to | #26 |
On Thu, 3 Mar 2011 12:45:57 -0800 (PST), "N.N. Thayer"
<nnthayer1@gmail.com> sprachen:
>the program when I add my subroutine. Why would it prompt me for the
>11-vs-1 choice, and then put my choice into the *computer's* hand
>instead of mine?
You're using the wrong variable?
--------------------------------------------------------------------------------
"There's nothing like eating hay when you're faint," the White King remarked to Alice, as he munched away.
"I should think throwing cold water over you would be better," Alice suggested: "--or some sal-volatile."
"I didn't say there was nothing better," the King replied. "I said there was nothing like it."
Which Alice did not venture to deny.
[toc] | [prev] | [next] | [standalone]
| From | "Chris Young" <chris.usenet@mail-filter.com> |
|---|---|
| Date | 2011-03-03 20:58 +0100 |
| Message-ID | <4D7000EB.MD-1.4.17.chris.young@unsatisfactorysoftware.co.uk> |
| In reply to | #23 |
On Thu, 3 Mar 2011 11:15:11 -0800 (PST) da kidz on comp.sys.sinclair were rappin' to MC N.N. Thayer: > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > - There's one major gameplay flaw that was inherited from his original > > code: when you're dealt an ace, you're not given the option to > > designate it as 11 if doing so would not put you over 21. The program > > automatically designates it as 1. > > I figure there must be something I'm not understanding about the game > logic. Any help would be appreciated :) I can't help with that (not without examining the code more than I have done, at least), but I think the RND is skewed incorrectly. Surely the RND command should be RND(13), then IF J>10 THEN LET J=10 Then you can just check for J=1 for an ace (with your subroutine), and the probability of getting a 10 is increased to what it should be for a pack of cards. Chris -- +-------------------------------------------+ | Unsatisfactory Software - "because it is" | | http://www.unsatisfactorysoftware.co.uk | | Your Sinclair: A Celebration | +- http://www.yoursinclair.co.uk -----------+ DISCLAIMER: I may be making all this stuff up again.
[toc] | [prev] | [next] | [standalone]
| From | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| Date | 2011-03-03 13:34 -0800 |
| Message-ID | <4905f389-fbfb-4c44-a82f-188ee3a081f1@a21g2000prj.googlegroups.com> |
| In reply to | #27 |
On Mar 3, 1:58 pm, "Chris Young" <chris.use...@mail-filter.com> wrote: > On Thu, 3 Mar 2011 11:15:11 -0800 (PST) da kidz on comp.sys.sinclair were rappin' > to MC N.N. Thayer: > > > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > - There's one major gameplay flaw that was inherited from his original > > > code: when you're dealt an ace, you're not given the option to > > > designate it as 11 if doing so would not put you over 21. The program > > > automatically designates it as 1. > > > I figure there must be something I'm not understanding about the game > > logic. Any help would be appreciated :) > > I can't help with that (not without examining the code more than I > have done, at least), but I think the RND is skewed incorrectly. > > Surely the RND command should be RND(13), then > IF J>10 THEN LET J=10 > > Then you can just check for J=1 for an ace (with your subroutine), and > the probability of getting a 10 is increased to what it should be for > a pack of cards. > > Chris > > -- > +-------------------------------------------+ > | Unsatisfactory Software - "because it is" | > | http://www.unsatisfactorysoftware.co.uk | > | Your Sinclair: A Celebration | > +-http://www.yoursinclair.co.uk-----------+ > > DISCLAIMER: I may be making all this stuff up again. Ah, good point! I had just lifted RND(11) from the original code. You'd think I would have realized the issue, given my obsession with making the game "realistic". :) Thanks.
[toc] | [prev] | [next] | [standalone]
| From | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| Date | 2011-03-03 13:36 -0800 |
| Message-ID | <653a5970-fca8-4e35-9e05-a13dea679195@d26g2000prn.googlegroups.com> |
| In reply to | #27 |
On Mar 3, 1:58 pm, "Chris Young" <chris.use...@mail-filter.com> wrote: > On Thu, 3 Mar 2011 11:15:11 -0800 (PST) da kidz on comp.sys.sinclair were rappin' > to MC N.N. Thayer: > > > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > - There's one major gameplay flaw that was inherited from his original > > > code: when you're dealt an ace, you're not given the option to > > > designate it as 11 if doing so would not put you over 21. The program > > > automatically designates it as 1. > > > I figure there must be something I'm not understanding about the game > > logic. Any help would be appreciated :) > > I can't help with that (not without examining the code more than I > have done, at least), but I think the RND is skewed incorrectly. > > Surely the RND command should be RND(13), then > IF J>10 THEN LET J=10 > > Then you can just check for J=1 for an ace (with your subroutine), and > the probability of getting a 10 is increased to what it should be for > a pack of cards. > > Chris > > -- > +-------------------------------------------+ > | Unsatisfactory Software - "because it is" | > | http://www.unsatisfactorysoftware.co.uk | > | Your Sinclair: A Celebration | > +-http://www.yoursinclair.co.uk-----------+ > > DISCLAIMER: I may be making all this stuff up again. Ah, good point! I had just lifted RND(11) from the original code. You'd think I would have realized the issue, given my obsession with making the game realistic. :) Thanks. The odd behavior I'm seeing (giving my selection to the dealer, or ignoring the subroutine completely) must be originating somewhere outside the subroutine. Time to stare at the code some more.
[toc] | [prev] | [next] | [standalone]
| From | gus <gdeldago@gmail.com> |
|---|---|
| Date | 2011-03-04 04:17 -0800 |
| Message-ID | <950495e2-c05f-40e2-af9f-331c87f2a3d4@y36g2000pra.googlegroups.com> |
| In reply to | #27 |
On Mar 3, 4:58 pm, "Chris Young" <chris.use...@mail-filter.com> wrote: > On Thu, 3 Mar 2011 11:15:11 -0800 (PST) da kidz on comp.sys.sinclair were rappin' > to MC N.N. Thayer: > > > On Mar 1, 6:09 pm, "N.N. Thayer" <nnthay...@gmail.com> wrote: > > > - There's one major gameplay flaw that was inherited from his original > > > code: when you're dealt an ace, you're not given the option to > > > designate it as 11 if doing so would not put you over 21. The program > > > automatically designates it as 1. > > > I figure there must be something I'm not understanding about the game > > logic. Any help would be appreciated :) > > I can't help with that (not without examining the code more than I > have done, at least), but I think the RND is skewed incorrectly. > > Surely the RND command should be RND(13), then > IF J>10 THEN LET J=10 > > Then you can just check for J=1 for an ace (with your subroutine), and > the probability of getting a 10 is increased to what it should be for > a pack of cards. > > Chris > > -- > +-------------------------------------------+ > | Unsatisfactory Software - "because it is" | > | http://www.unsatisfactorysoftware.co.uk | > | Your Sinclair: A Celebration | > +-http://www.yoursinclair.co.uk-----------+ > > DISCLAIMER: I may be making all this stuff up again. Hi, I will say exactly the same. Tim in his implementation use 11 as the number for the ACE, that way the chance of get a 10 is 1 in 11. A better solution is to use the range [1..13] so the chances you will be 4 in 13 just like Chris suggested. A good solution, that Rich already mention is to handle the complete cards deck, so you must deal with the 52 cards, so the program never gives 5 cards with the same value in a hand :) Gus
[toc] | [prev] | [next] | [standalone]
| From | "N.N. Thayer" <nnthayer1@gmail.com> |
|---|---|
| Date | 2011-03-04 05:17 -0800 |
| Message-ID | <20d85645-67db-4abb-a716-33df5b092f02@q12g2000prb.googlegroups.com> |
| In reply to | #32 |
On Mar 4, 6:17 am, gus <gdeld...@gmail.com> wrote: > A good solution, that Rich already mention is to handle the complete > cards deck, so you must deal with the 52 cards, so the program never > gives 5 cards with the same value in a hand :) > > Gus Yeah, that's also a good point, why not use all 52 cards? One other thing I discovered is that I can't just force the player to choose 11 or 1 when a card is dealt, because that's a hard commitment, and real blackjack lets you have a "soft" total where either 11 or 1 applies until the total > 21 and then you stay with 1. So I'll have to display both possible totals to the player (and maybe more than two possible totals, if the player happens to be dealt multiple aces, unlikely as that may be when working with 52 cards - though I'm not sure what the rules are on counting just some aces as 11 or 1, or whether you have to keep them all the same). I thought the ZX80's BASIC would be my major limitation, but it turns out that just structuring the program logic correctly is the hardest! The ZX80 is more than capable of handling realistic blackjack if I can just freaking figure out how to code it.
[toc] | [prev] | [next] | [standalone]
| From | gus <gdeldago@gmail.com> |
|---|---|
| Date | 2011-03-04 06:02 -0800 |
| Message-ID | <f919d1e2-e5b9-4c26-84cf-7c393c545f83@o21g2000prn.googlegroups.com> |
| In reply to | #33 |
On Mar 4, 10:17 am, "N.N. Thayer" <nnthay...@gmail.com> wrote: > On Mar 4, 6:17 am, gus <gdeld...@gmail.com> wrote: > > > A good solution, that Rich already mention is to handle the complete > > cards deck, so you must deal with the 52 cards, so the program never > > gives 5 cards with the same value in a hand :) > > > Gus > > Yeah, that's also a good point, why not use all 52 cards? > > One other thing I discovered is that I can't just force the player to > choose 11 or 1 when a card is dealt, because that's a hard commitment, > and real blackjack lets you have a "soft" total where either 11 or 1 > applies until the total > 21 and then you stay with 1. So I'll have > to display both possible totals to the player (and maybe more than two > possible totals, if the player happens to be dealt multiple aces, > unlikely as that may be when working with 52 cards - though I'm not > sure what the rules are on counting just some aces as 11 or 1, or > whether you have to keep them all the same). > > I thought the ZX80's BASIC would be my major limitation, but it turns > out that just structuring the program logic correctly is the hardest! > The ZX80 is more than capable of handling realistic blackjack if I can > just freaking figure out how to code it. The mod to handle 52 cards will be a major one :) maybe you like to implement in the first place a version with the 13 cards, and if you like to make it a little more realistic you can count the numbers of each card that the program deal. For the 52 cards version it will be the best solution to shuffle the deck of cards before each hand Now we will wait until your next version to be released :) Have fun ! Gus
[toc] | [prev] | [next] | [standalone]
| From | "Chris Young" <chris.usenet@mail-filter.com> |
|---|---|
| Date | 2011-03-04 17:44 +0100 |
| Message-ID | <4D712504.MD-1.4.17.chris.young@unsatisfactorysoftware.co.uk> |
| In reply to | #33 |
On Fri, 4 Mar 2011 05:17:45 -0800 (PST) da kidz on comp.sys.sinclair were rappin' to MC N.N. Thayer: > Yeah, that's also a good point, why not use all 52 cards? Probably because in a casino, you're dealing with more than one pack :) So you'd have to have an additional option to specify the number of packs in play. This could simply be a variable at the top of the code the user can change if they desire. > One other thing I discovered is that I can't just force the player to > choose 11 or 1 when a card is dealt, because that's a hard commitment, > and real blackjack lets you have a "soft" total where either 11 or 1 > applies until the total > 21 and then you stay with 1. So I'll have > to display both possible totals to the player That sounds like a better solution, and probably easier to work with. Chris -- +-------------------------------------------+ | Unsatisfactory Software - "because it is" | | http://www.unsatisfactorysoftware.co.uk | | Your Sinclair: A Celebration | +- http://www.yoursinclair.co.uk -----------+ DISCLAIMER: I may be making all this stuff up again.
[toc] | [prev] | [next] | [standalone]
| From | gus <gdeldago@gmail.com> |
|---|---|
| Date | 2011-03-09 08:05 -0800 |
| Message-ID | <e09a89c0-a044-4b76-bd40-08c9e669ae51@l14g2000pre.googlegroups.com> |
| In reply to | #35 |
On Mar 4, 1:44 pm, "Chris Young" <chris.use...@mail-filter.com> wrote: > On Fri, 4 Mar 2011 05:17:45 -0800 (PST) da kidz on comp.sys.sinclair were rappin' > to MC N.N. Thayer: > > > Yeah, that's also a good point, why not use all 52 cards? > > Probably because in a casino, you're dealing with more than one pack > :) > > So you'd have to have an additional option to specify the number of > packs in play. This could simply be a variable at the top of the code > the user can change if they desire. > > > One other thing I discovered is that I can't just force the player to > > choose 11 or 1 when a card is dealt, because that's a hard commitment, > > and real blackjack lets you have a "soft" total where either 11 or 1 > > applies until the total > 21 and then you stay with 1. So I'll have > > to display both possible totals to the player > > That sounds like a better solution, and probably easier to work with. > > Chris > > -- > +-------------------------------------------+ > | Unsatisfactory Software - "because it is" | > | http://www.unsatisfactorysoftware.co.uk | > | Your Sinclair: A Celebration | > +-http://www.yoursinclair.co.uk-----------+ > > DISCLAIMER: I may be making all this stuff up again. But in a casino you do not know how many card are on the deck ? I mean if you can't know how many cards are on play how do you figure out the chances of the next card ?
[toc] | [prev] | [next] | [standalone]
| From | Linards Ticmanis <ticmanis@gmx.de> |
|---|---|
| Date | 2011-03-07 19:59 +0100 |
| Message-ID | <4d752b16$0$7651$9b4e6d93@newsspool1.arcor-online.net> |
| In reply to | #33 |
On 03/04/2011 02:17 PM, N.N. Thayer wrote: > One other thing I discovered is that I can't just force the player to > choose 11 or 1 when a card is dealt, because that's a hard commitment, > and real blackjack lets you have a "soft" total where either 11 or 1 > applies until the total > 21 and then you stay with 1. So I'll have > to display both possible totals to the player (and maybe more than two > possible totals, if the player happens to be dealt multiple aces, > unlikely as that may be when working with 52 cards - though I'm not > sure what the rules are on counting just some aces as 11 or 1, or > whether you have to keep them all the same). I'm not an expert at blackjack, but if a player receives more than one ace, wouldn't all but one of them necessarily be counted as 1? Because two times 11 is already 22, so you'd bust. So I'd say you never need more than two possible totals. -- Linards Ticmanis
[toc] | [prev] | [next] | [standalone]
| From | Leiradella <leiradella@bigfoot.com> |
|---|---|
| Date | 2011-03-08 07:31 -0800 |
| Message-ID | <ca455284-8b6c-4cdc-872b-30f8c6678eee@v11g2000prb.googlegroups.com> |
| In reply to | #47 |
> I'm not an expert at blackjack, but if a player receives more than one > ace, wouldn't all but one of them necessarily be counted as 1? Because > two times 11 is already 22, so you'd bust. So I'd say you never need > more than two possible totals. The way I did it some time ago was to always count aces as 11 when the hand sums up to 21 (because players want to score as high as possible.) If the player draws a card and the sum goes over 21, I decrease the values of his/her aces one by one to 1 until the sum goes below or equal to 21, meaning the player could have one ace counting as 1 and another ace counting as 11. If after decreasing all aces values the sum is still over 21 the layer looses. The drawback is that sometimes an A-7 hand summing 18 still have space for more cards, but it's up to the player to realize that the hand also values 8. Cheers, Andre
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.sinclair
csiph-web