![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: May 2002
Posts: 8,120
|
JavaScript programmers...
I've finished my very first JavaScript program for my final exam. It's very basic and I would like to continue on it farther. Right now all it does is shuffle and deal a deck of cards. The next step I would like to do is for it to recognize poker hands. Could anyone give me the thought process for doing so?
I think it will be very complex. For each card I would have to split it into a value and suit. I would also have to separate the players hand with a variable for each card to be able to compare. Thoughts? https://drive.google.com/open?id=1qz...kuCfTgBsB7vUfk
__________________
https://www.flow.page/savethechildren |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Biker Gnome
Industry Role:
Join Date: Mar 2004
Location: cell#324
Posts: 23,200
|
I remember learning Java, we did some weird programming just to say we could do it. Wish I could help. I learned enough to change existing programs to do what I wanted to. Maybe find a JavaScript poker program and open it for inspiration, just don't copy it
__________________
Carbon is not the problem, it makes up 0.041% of our atmosphere , 95% of that is from Volcanos and decomposing plants and stuff. So people in the US are responsible for 13% of the carbon in the atmosphere which 95% is not from Humans, like cars and trucks and stuff and they want to spend trillions to fix it while Solar Panel plants are powered by coal plants think about that |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,588
|
Quote:
Googling poker hands and their value would be a normal thought process. ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Industry Role:
Join Date: May 2002
Posts: 8,120
|
Quote:
I would have then have to break down each card into value and suit. I'd also have to break down each card in the players hand. Xn1 = 3 ; Xs1 = C Xn2 = 4 ; Xs2 = D Xn3 = 3 ; Xs3 = S Xn4 = T ; Xs4 = C Xn5 = K ; Xs5 = D Then I'd have to compare Xn1 to Xn2,3,4,5. Xn2 to Xn3,4,5. Xn3 to Xn4,5. Xn4 to Xn5. For each Xn that matches another variable, N, would increment telling the # "of a kind". Likewise a flush would be easy to tell if comparing all the Xs and S = 5. This seems easy enough but more complicated when I try to think through for a straight or full house or two pair. Also what do you mean by googling poker hands and their value? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,588
|
Programming is not about the language you use; it's about figuring out how to do this stuff on your own.
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: May 2002
Posts: 8,120
|
Thanks Yoda.
__________________
https://www.flow.page/savethechildren |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Making PHP work
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,588
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
So Fucking Banned
Join Date: Jun 2005
Posts: 3,770
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | ||
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,386
|
Quote:
![]() Quote:
![]() ![]()
__________________
Obey the Cowgod |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Too lazy to set a custom title
Industry Role:
Join Date: Oct 2014
Posts: 11,652
|
Give all winning poker hands a numeric value starting with 999 for a royal flush downward to 50 for a pair. Keeping a original numeric value for the card itself... 1-14, remembering aces are high and low card depending on application. (ace high straight beats a king high straight)
Then you can also evaluate high card on a draw. You will have a bunch of math evaluations on/for condition, especially the ace. Java is probably the right choice for this stuff because of it's flexibility and minimal code. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
So Fucking Banned
Join Date: Jun 2005
Posts: 3,770
|
I use this for Poker dev, poker-eval. Very fast from c. Saves a lot of effort. Can recommend.
|
![]() |
![]() ![]() ![]() ![]() ![]() |