Joined: Nov '11
Location: United Kingdom
Age: 40 (M)
Posts: 747
right ive started messing about making a poker game, its still in the early stages (a few hours of coding) but its a work in progress, dont know how many mobsters will care about it but its in a standard basic code at the moment and im developing it on dark basic so far it can shuffle a deck and deal to a selected range of players for holdem and omaha next job is hand ranking (so it identifies the best hand) code:
cls dim deck(52) dim cards$(10,9)
menu: input "game type 1= holdem 2 = omaha 3 = stud(6 max) : ", gametype input "limit 1= no limit 2 = pot limit 3 = fixed limit : ", limit if limit < 1 or limit > 3 then goto menu if gametype < 1 or gametype > 3 then goto menu
print "dealing" if gametype = 1 then deal(10,1) if gametype = 2 then deal(10,2) if gametype = 3 then deal(6,3)
for a=1 to 10 print a showholecards(a,gametype) next a
wait key if gametype=1 or gametype=2 then print "dealing flop" if gametype=1 or gametype=2 then print cards$(1,5) + " "+cards$(1,6) + " "+cards$(1,7) + " " wait key if gametype=1 or gametype=2 then print "dealing turn" if gametype=1 or gametype=2 then print cards$(1,8) wait key if gametype=1 or gametype=2 then print "dealing river" if gametype=1 or gametype=2 then print cards$(1,9) wait key
do if escapekey()=1 then end loop
function deal(players,gametype) shuffledeck()
if gametype < 3 then a$ = getcard() if gametype < 3 then b$ = getcard() if gametype < 3 then c$ = getcard() if gametype < 3 then d$ = getcard() if gametype < 3 then e$ = getcard() for a= 1 to players cards$(a,5 )= a$ cards$(a,6 )= b$ cards$(a,7 )= c$ cards$(a,8 )= d$ cards$(a,9 )= e$ cards$(a,1 )= getcard() cards$(a,2 )= getcard() if gametype=2 then cards$(a,3)= getcard() if gametype=2 then cards$(a,4)= getcard() if gametype=3 then cards$(a,3)= getcard() if gametype=3 then cards$(a,4)= getcard() if gametype=3 then cards$(a,5)= getcard() next a endfunction
function getcard() `c = 99 if deck(0) < 53 then inc deck(0) if deck(0) = 53 then card$ = "empty" if deck(0) < 53 then c = deck(deck(0)) if deck(0) = 53 then goto skippy if deck(deck(0)) = 0 then card$ = "2h" if deck(deck(0)) = 1 then card$ = "3h" if deck(deck(0)) = 2 then card$ = "4h" if deck(deck(0)) = 3 then card$ = "5h" if deck(deck(0)) = 4 then card$ = "6h" if deck(deck(0)) = 5 then card$ = "7h" if deck(deck(0)) = 6 then card$ = "8h" if deck(deck(0)) = 7 then card$ = "9h" if deck(deck(0)) = 8 then card$ = "th" if deck(deck(0)) = 9 then card$ = "jh" if deck(deck(0)) = 10 then card$ = "qh" if deck(deck(0)) = 11 then card$ = "kh" if deck(deck(0)) = 12 then card$ = "ah" if deck(deck(0)) = 13 then card$ = "2d" if deck(deck(0)) = 14 then card$ = "3d" if deck(deck(0)) = 15 then card$ = "4d" if deck(deck(0)) = 16 then card$ = "5d" if deck(deck(0)) = 17 then card$ = "6d" if deck(deck(0)) = 18 then card$ = "7d" if deck(deck(0)) = 19 then card$ = "8d" if deck(deck(0)) = 20 then card$ = "9d" if deck(deck(0)) = 21 then card$ = "td" if deck(deck(0)) = 22 then card$ = "jd" if deck(deck(0)) = 23 then card$ = "qd" if deck(deck(0)) = 24 then card$ = "kd" if deck(deck(0)) = 25 then card$ = "ad" if deck(deck(0)) = 26 then card$ = "2c" if deck(deck(0)) = 27 then card$ = "3c" if deck(deck(0)) = 28 then card$ = "4c" if deck(deck(0)) = 29 then card$ = "5c" if deck(deck(0)) = 30 then card$ = "6c" if deck(deck(0)) = 31 then card$ = "7c" if deck(deck(0)) = 32 then card$ = "8c" if deck(deck(0)) = 33 then card$ = "9c" if deck(deck(0)) = 34 then card$ = "tc" if deck(deck(0)) = 35 then card$ = "jc" if deck(deck(0)) = 36 then card$ = "qc" if deck(deck(0)) = 37 then card$ = "kc" if deck(deck(0)) = 38 then card$ = "ac" if deck(deck(0)) = 39 then card$ = "2s" if deck(deck(0)) = 40 then card$ = "3s" if deck(deck(0)) = 41 then card$ = "4s" if deck(deck(0)) = 42 then card$ = "5s" if deck(deck(0)) = 43 then card$ = "6s" if deck(deck(0)) = 44 then card$ = "7s" if deck(deck(0)) = 45 then card$ = "8s" if deck(deck(0)) = 46 then card$ = "9s" if deck(deck(0)) = 47 then card$ = "ts" if deck(deck(0)) = 48 then card$ = "js" if deck(deck(0)) = 49 then card$ = "qs" if deck(deck(0)) = 50 then card$ = "ks" if deck(deck(0)) = 51 then card$ = "as" skippy: endfunction (card$)
function shuffledeck() deck(0) = 0 deck(1) = 222 deck(51) = 222 randomize timer() for a = 1 to 52 d = 0 repeat c= rnd(51) d=1 for b= 1 to a-1 if c = deck(b) then d=0 next b until d = 1 deck(a)= c next a endfunction
function showholecards(player,gametype) if gametype=1 then print cards$(player,1) + " " +cards$(player,2) if gametype=2 then print cards$(player,1) + " " +cards$(player,2)+ " " +cards$(player,3)+ " " +cards$(player,4) if gametype=3 then print cards$(player,1) + " " +cards$(player,2)+ " " +cards$(player,3)+ " " +cards$(player,4)+ " " +cards$(player,5) endfunction
function checkhand(player) ` work in progress endfunction
Joined: Apr '09
Location: Australia
Age: 40 (M)
Posts: 6483
Ugh, basic is a pretty horrid language, do you know any others? Something OO is much better IMHO..
Also, this:
function getcard() `c = 99 if deck(0) < 53 then inc deck(0) if deck(0) = 53 then card$ = "empty" if deck(0) < 53 then c = deck(deck(0)) if deck(0) = 53 then goto skippy if deck(deck(0)) = 0 then card$ = "2h" if deck(deck(0)) = 1 then card$ = "3h" if deck(deck(0)) = 2 then card$ = "4h" if deck(deck(0)) = 3 then card$ = "5h" if deck(deck(0)) = 4 then card$ = "6h" if deck(deck(0)) = 5 then card$ = "7h" if deck(deck(0)) = 6 then card$ = "8h" if deck(deck(0)) = 7 then card$ = "9h" if deck(deck(0)) = 8 then card$ = "th" if deck(deck(0)) = 9 then card$ = "jh" if deck(deck(0)) = 10 then card$ = "qh" if deck(deck(0)) = 11 then card$ = "kh" if deck(deck(0)) = 12 then card$ = "ah" if deck(deck(0)) = 13 then card$ = "2d" if deck(deck(0)) = 14 then card$ = "3d" if deck(deck(0)) = 15 then card$ = "4d" if deck(deck(0)) = 16 then card$ = "5d" if deck(deck(0)) = 17 then card$ = "6d" if deck(deck(0)) = 18 then card$ = "7d" if deck(deck(0)) = 19 then card$ = "8d" if deck(deck(0)) = 20 then card$ = "9d" if deck(deck(0)) = 21 then card$ = "td" if deck(deck(0)) = 22 then card$ = "jd" if deck(deck(0)) = 23 then card$ = "qd" if deck(deck(0)) = 24 then card$ = "kd" if deck(deck(0)) = 25 then card$ = "ad" if deck(deck(0)) = 26 then card$ = "2c" if deck(deck(0)) = 27 then card$ = "3c" if deck(deck(0)) = 28 then card$ = "4c" if deck(deck(0)) = 29 then card$ = "5c" if deck(deck(0)) = 30 then card$ = "6c" if deck(deck(0)) = 31 then card$ = "7c" if deck(deck(0)) = 32 then card$ = "8c" if deck(deck(0)) = 33 then card$ = "9c" if deck(deck(0)) = 34 then card$ = "tc" if deck(deck(0)) = 35 then card$ = "jc" if deck(deck(0)) = 36 then card$ = "qc" if deck(deck(0)) = 37 then card$ = "kc" if deck(deck(0)) = 38 then card$ = "ac" if deck(deck(0)) = 39 then card$ = "2s" if deck(deck(0)) = 40 then card$ = "3s" if deck(deck(0)) = 41 then card$ = "4s" if deck(deck(0)) = 42 then card$ = "5s" if deck(deck(0)) = 43 then card$ = "6s" if deck(deck(0)) = 44 then card$ = "7s" if deck(deck(0)) = 45 then card$ = "8s" if deck(deck(0)) = 46 then card$ = "9s" if deck(deck(0)) = 47 then card$ = "ts" if deck(deck(0)) = 48 then card$ = "js" if deck(deck(0)) = 49 then card$ = "qs" if deck(deck(0)) = 50 then card$ = "ks" if deck(deck(0)) = 51 then card$ = "as" skippy: endfunction (card$)
should probably just be an array.. that's an awful lot of "IF" statements for what should just be an array initialized to 52, not sure in basic, but surely you can define an array something like
string[52] deck {"2c",3c",4c",... }
------------ If you need a hand with anything, I'm pretty good with quite a lot of languages, I know:
C, C++, C#, Java, Perl, Python, plus a few others not as well..I did a bit of basic and visual basic about 10 years ago.. All languages are pretty similar anyway - I can normally learn a new one in about 24hrs.. It's mostly just the syntax that changes..
What exactly do you want your program to do when it's finished?
Joined: Nov '11
Location: United Kingdom
Age: 40 (M)
Posts: 747
yeah im a bit slow so im trying to keep it as simple as possible so might try and figure out arrays later as the shuffled deck is stored in random numerical values 0=51 in deck(1-52) with deck(0) being the current posistion in the deck all the "if" statments are to turn the number into a value and suit and it was the easiest way for me as ive not programmed anything in a long time. had some expeience on c++ but that was a long time ago
i would be looking to add some internet commands to it so it can connect and play with friends and mabee try and develop strong computer opponents. and obviously some graphics. i want to make an app for the iphone or android and one idea i had is to make an app version of the game "s******d" err "s**t head"as ive never seen one so its an open market (until somone reads this and beats me too it)
Joined: Mar '11
Location: Canada
Age: 44 (M)
Posts: 1490
That looks an awful lot like Qbasic, something I spent many hours fiddling with back on my familys good old 286, mostly because it was pretty much all we really had on it aside from Quicken and word perfect lol. From what I remember, it was pretty limited, especially when it came to defining array variables, and program size.
IIRC programs/memory addresses couldn't exceed 64k. Not suprising given most computers at that time only had 1MB of ram, most of which was allocated to low level hardware access and good old DOS lol.
Joined: Oct '09
Location: United Kingdom
Age: 57 (M)
Posts: 667
Hi. I think you should start taking more drugs. When I was at school basic had just been developed, and dark basic was something you did in the dark with your girlfriend!!! He He
Joined: Apr '09
Location: Australia
Age: 40 (M)
Posts: 6483
Posted by takingdrugs: yeah im a bit slow so im trying to keep it as simple as possible so might try and figure out arrays later as the shuffled deck is stored in random numerical values 0=51 in deck(1-52) with deck(0) being the current posistion in the deck all the "if" statments are to turn the number into a value and suit and it was the easiest way for me as ive not programmed anything in a long time. had some expeience on c++ but that was a long time ago
i would be looking to add some internet commands to it so it can connect and play with friends and mabee try and develop strong computer opponents. and obviously some graphics. i want to make an app for the iphone or android and one idea i had is to make an app version of the game "s******d" err "s**t head"as ive never seen one so its an open market (until somone reads this and beats me too it)
Switching to an array is much better - it's indexed from 0. So instead of that massive function you have with a million if statements, instead you just initialise the array and then your function would only be about 2 lines of code, one to generate the random integer from 0-51 and another to retrieve the array at index value [random].
Anyway - like I said, I'm pretty good with code and know how to do graphics, networking, databases connections, logic, file input/output, etc. If you need a hand with something, let me know or post here.
But I highly recommend taking the time to switch to an OO language, also - if you want to port to smartphones, think about what languages THEY use - C# is one.. and it's REALLY easy too (basically the same as java, includes garbage collection,etc).
Joined: Jan '11
Location: United States
Age: 60 (M)
Posts: 3361
Personaly I think you got to start somewhere and if it's interesting to you enough to pursue writing the program using basic functions you should stick to it. It's your's so do it how you feel comfortable in doing something I've always thought. Yes there's better ways and always will be, but this is your baby so do it your way. like the king said, "And I did it my way".
I think constructive criticism is worth reading / listening to. Sarcasm or negative comments are something that will always be around, but it the wise one who takes this and turns it into constructive achievements.
Joined: Apr '09
Location: Australia
Age: 40 (M)
Posts: 6483
Posted by Greenmohave: Personaly I think you got to start somewhere and if it's interesting to you enough to pursue writing the program using basic functions you should stick to it. It's your's so do it how you feel comfortable in doing something I've always thought. Yes there's better ways and always will be, but this is your baby so do it your way. like the king said, "And I did it my way".
I think constructive criticism is worth reading / listening to. Sarcasm or negative comments are something that will always be around, but it the wise one who takes this and turns it into constructive achievements.
Quite true.
Also - I recently installed a free copy of Windows 8 (developers preview).
Not sure if MS are still offering this - but if they are - it's worth checking out. You can get Windows * + Visual Studio for free - and the application development on there is really top notch. The APIs are really easy to use, there's heaps of MS stuff you can plug into directly that make networking, etc a LOT easier. And it support a LOT of different languages, so you can pick something you're comfortable with.
They have a whole tonne of tutorials, etc up on their developers site too.
Means your poker app would straight away be compatible with Windows 8 and any MS smart-phone / Tablet / etc too
Why not program a poker bot and share with all mobsters...Off course, it going to be BRM mobsters secret.... ...Just joking... I don't understand this kind of program because its not my field but i think your repeating the commands...array would be better as what jess suggested...anyway, Good work though and GL on your poker software....Please post finished software...so that we can have a try...