Computer Science Canada Poker Code Messed Up |
Author: | berf [ Tue Jun 20, 2006 3:28 pm ] |
Post subject: | Poker Code Messed Up |
I have a poker program started and have tried to debug it on my own but I can't find the problem. This is just the start, using mod and div to determine what the card is and what the suit of it is. I still need to add the different kind of hands but I should be able to do that on my own. Any help on this problem is greatly appreciated. |
Author: | Bored [ Tue Jun 20, 2006 4:00 pm ] |
Post subject: | |
Well first off welcome to CompSci. Now you say you have a problem, well what is your problem? We can't help you fix it if we don't know what it is. Asweel It's much more helpfull if you post the source code (remember to use the [code ] tags) so that we can see your program. Any information you can give us into your problem or your code will help us give you an answer. |
Author: | Bored [ Tue Jun 20, 2006 4:01 pm ] |
Post subject: | |
Well that was weird, the download didn't show the first time. |
Author: | TheOneTrueGod [ Tue Jun 20, 2006 6:45 pm ] | ||||||
Post subject: | |||||||
Allright, first things first: Thank you for using the mathematical method You don't know how many people don't use it, and should. (Or maybe you do if you've seen some of my previous posts) That being said, I ran your program, and It took me a few runs to find your error. It claims that a certain variable doesn't have a value (playershand (show, h) ) The problem is probably because you didn't initiate it. Using some Super duper debugging techniquesTM I found out that the error happened at (1,2) -- First player, second card. After tracing through your code, the only logical reason is that something went wrong with your deal procedure. You'll have to look more into that on your own though. In the future, please post a better description, rather than "I had a problem", as it'll help us help you. This is a good example of why parameters are good. It would be MUCH easier to trace the variable in question if you passed it as a parameter to your procedures. Now, theres one issue with your code that I saw:
Why? Why not just:
or even better,
Other than that, nice work with getting the cards working on a 0-51 system, though the procedures could use a little work. Try getting them to work with parameters, as it may make your life easier. |
Author: | berf [ Tue Jun 20, 2006 8:28 pm ] |
Post subject: | |
Im not sure how exactly I would use procedures in this. I'm not really new to turing, ive done it the last 2 years but my teacher doesnt really teach, or give help unless you're one of his wonder students. So I've done most of turing on my own. Hence I'm not familiar with all the short cuts as you could tell with my face card procedure. I had most of this program working before but without suits, and I didn't really do that well so i restarted. So any help on how to use the parameters would be greatly appreciated. |
Author: | TheOneTrueGod [ Tue Jun 20, 2006 9:38 pm ] | ||
Post subject: | |||
Well, preferably read the [Turing Walkthrough]. It has some info on procedures + functions + parameters. I'll write out some pseudo code for ya for a couple useful procedures.
If you've read the article it should be clear on what to do. If you have any other problems, feel free to post em up. Good luck. |
Author: | berf [ Thu Jun 22, 2006 1:13 pm ] | ||||
Post subject: | |||||
I found the problem as to why i was getting a variable has no value.
so on my original i just when
So i had no way if the same number was picked twice to re-select a new number. Just if anyone was wondering the solution to it |