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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-12-2019, 09:19 AM   #1
GFED
Confirmed User
 
GFED's Avatar
 
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
GFED is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 09:51 AM   #2
Vendzilla
Biker Gnome
 
Vendzilla's Avatar
 
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
Vendzilla is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 10:29 AM   #3
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,588
Quote:
Originally Posted by GFED View Post
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?

Googling poker hands and their value would be a normal thought process.

blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 11:06 AM   #4
GFED
Confirmed User
 
GFED's Avatar
 
Industry Role:
Join Date: May 2002
Posts: 8,120
Quote:
Originally Posted by blackmonsters View Post
Googling poker hands and their value would be a normal thought process.

I would think I'd have to split everything up. For instance let's say they players hand is "3C 4D 3S TC KD".

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?
GFED is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 12:51 PM   #5
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
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.

blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 01:35 PM   #6
GFED
Confirmed User
 
GFED's Avatar
 
Industry Role:
Join Date: May 2002
Posts: 8,120
Quote:
Originally Posted by blackmonsters View Post
Programming is not about the language you use; it's about figuring out how to do this stuff on your own.

Thanks Yoda.
GFED is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 02:57 PM   #7
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,588
Quote:
Originally Posted by GFED View Post
Thanks Yoda.
Yo mamma!

blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 03:04 PM   #8
ghjghj
So Fucking Banned
 
Join Date: Jun 2005
Posts: 3,770
http://www.mathcs.emory.edu/~cheung/...okerCheck.html
ghjghj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-12-2019, 08:13 PM   #9
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,386
Quote:
Originally Posted by blackmonsters View Post
Googling poker hands and their value would be a normal thought process.
Indeed. He all you need to know as a coder:



Quote:
Originally Posted by ghjghj View Post
Wow, must be written by some Einstein The code can be reduced in about 10x times... When I was a kid, I was writing games for programmable calculators because I wasn't able to a4d a computer (hello CurrentlySobber ;)) So I wrote a 40-50 byte code to emulate a landing of space module to non-atmospheric space bodies like Moon. The program was controlling such parameters as time, speed, gravitation, the oxygen reserve, the mass of remaining fuel, the mass of the space ship, the trust vector and even the specific impulse of the rocket engine (everything straightly to physical formulas - the same ones that were used by Luna-9 or Apollo-11 modules). And all that, including the game component which allowed you to pilot the space ship was fitted in a 40-50 byte program In those times we have counted every single bit of code.
__________________
Obey the Cowgod
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-13-2019, 11:17 AM   #10
VRPdommy
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.
VRPdommy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-13-2019, 11:57 AM   #11
ghjghj
So Fucking Banned
 
Join Date: Jun 2005
Posts: 3,770
Quote:
Originally Posted by CyberSEO View Post
Wow, must be written by some Einstein
I use this for Poker dev, poker-eval. Very fast from c. Saves a lot of effort. Can recommend.
ghjghj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
card, javascript, process, complex, hand, players, compare, variable, separate, suit, split, basic, continue, farther, exam, final, programmers, finished, program, step, recognize, poker, hands, cards, shuffle
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.