Computer Science Canada BlackJack Game Help |
Author: | l0tt0 [ Sat Oct 18, 2003 11:34 pm ] | ||
Post subject: | BlackJack Game Help | ||
Ok, I just started learning Turing this year in school. So far we have learned if/elseif, variables, and yesterday we just learned basic loops and how to exit them. My teacher hasn't taught us arrays yet but I went forward and read a couple tutorials on them. Today I tried making a BlackJack Game which is really basic but the problem I'm having is: - The code will only finish when you bust Here's my code
Thanks in advance to anyone that can help me out! |
Author: | l0tt0 [ Sat Oct 18, 2003 11:43 pm ] | ||
Post subject: | Figured It Out | ||
I figured it out, it wasn't hard at all. But I haven't learned about alot of this stuff yet so it was sort of hard for me. But reading posts on here is really helpful . Here's my finished code (for now, as I learn more I will make it better). Could some people still give me some comments/suggestions on this though please? Thanks!
|
Author: | Tony [ Sat Oct 18, 2003 11:46 pm ] |
Post subject: | |
I'm confused I dont see the point in the use of array the way you have your game set up. you would just enclose everything from "total:=" line to the end in another loop/endloop to run your game indefinatly. Thing is... thats not how blackjack is played. Dealer can also bust. And this way you dont display what cards one gets. And if one starts figuring cards out by change in total, then one can get 5 of a kind I donno how accurate your game has to be. |
Author: | l0tt0 [ Sun Oct 19, 2003 12:18 am ] | ||
Post subject: | |||
tony wrote: And if one starts figuring cards out by change in total, then one can get 5 of a kind i see what you mean by the array thing thanks alot. I know thats not how blackjack is played i was just trying to keep it simple for this point. I didnt really understand about what you mean by what i quoted...could you explain this a bit more? I have just spent a bit more time making it better, and tomorrow I am going to try and make it so the dealer can bust. This is the updated version I have.
btw. is there a function to close the run window screen if they choose N? Thanks |
Author: | Tony [ Sun Oct 19, 2003 12:31 am ] |
Post subject: | |
what I ment is that since you randomly chouse the value of the card instead of card itself, same card can be picked out more then once. You'd understand what I'm talking about when you deside to draw which cards are in play. Also thing might come in useful - Dealer's AI: hit untill total of 16 or more. I mean come on... Dealer will not stop at 1 as it shows in some of your cases (for one, there're 2 cards) |
Author: | l0tt0 [ Sun Oct 19, 2003 12:24 pm ] |
Post subject: | |
ok i understand what you meant. And ya i was gonna make something like the dealer hits until 16. btw. is there a way to close the run window at the end fo it? |
Author: | l0tt0 [ Sun Oct 19, 2003 12:38 pm ] | ||
Post subject: | |||
Here is the updated version with dealer AI.
|
Author: | Tony [ Sun Oct 19, 2003 1:13 pm ] | ||
Post subject: | |||
ok, thats better to close the program, you call
oddly enough, it quits the program. |
Author: | l0tt0 [ Sun Oct 19, 2003 1:47 pm ] |
Post subject: | |
ok thanks alot for all your help |
Author: | Mazer [ Mon Oct 20, 2003 8:03 am ] | ||
Post subject: | |||
if you want to close the run window, you'll first have to open it (manually)
|
Author: | morgoth [ Fri Nov 21, 2003 8:03 pm ] |
Post subject: | black jack eh? |
I also finished a blackjack game for my school I think it's very good but I think I will upload it later hopefully I can get some bits for it lol |
Author: | morgoth [ Fri Nov 21, 2003 8:08 pm ] |
Post subject: | |
for your deck randomizer you should make an array deck :1..52 create a for loop that will place the numbers 1 to 13 four times then have another for loop that will swap the different numbers, if you use this idea you can never get more that four of the same card. |
Author: | Tony [ Fri Nov 21, 2003 8:17 pm ] |
Post subject: | |
well you just need to fill the array with numbers in order. Then you can use my random number list function to "shuffle" the deck |
Author: | thoughtful [ Fri Nov 21, 2003 11:18 pm ] | ||
Post subject: | |||
hmm...if you want to make something which invloves graphics and stuff you should make 2d array for example
now you can load the pictures in it. 1..4 represents the four suits, where as 1..13 represents the the cards. so if you choose 1 to be you ACES than if you have card(1,13) it is the king of ACES. You can also check if the card has been played before or not. this is not that hard to make. You just need all the pictures of cards and then tell computer that cards from 10-13 are worth 10, 1 is worth 1 or 11 and the rest are the same. You can even have like the picture of a deck where u click to get hit or you can knock on the table to stay. If you wana take this to the next level you can have the first card face down as in real black jack. Thats simple also you just need the program to draw a face down card picture for any first card and add its value to the total and then the rest are all gonna be face up cards. There might be an easier way of making this if you wana go ahead with thie graphical version maybe u can let the forum know and somebody might tell you an easier way. |
Author: | Tony_200004 [ Thu Dec 04, 2003 9:22 pm ] |
Post subject: | |
One thing... when you program is quitting instead of if reply = "n" then exit do if reply = "n" then quit the exit doesnt work as well as the quit... the exit is almost like a crash when you use it to close the program and the quit just is a straight out quit |
Author: | poly [ Thu Dec 04, 2003 9:52 pm ] |
Post subject: | |
Quote: the exit doesnt work as well as the quit... the exit is almost like a crash when you use it to close the program and the quit just is a straight out quit EXIT's are used to exit loops or for statements, QUIT is to quit programs |