TEXAS HOLDEM POKER

HI EVERYONE. I HAVE TO CREATE A TEXAS HOLDEM POKER GAME IN JAVA FOR A COLLEGE PROJECT. I AM HAPPY WITH MY GUI'S BUT MY IMMEDIATE PROBLEM IS DEALING THE CARDS. I AM UNDECIDED AS TO HOW TO DO THIS.

IS IT POSSIBLE TO PLACE THE PICTURES OF ALL 52 CARDS INTO AN ARRAY AND THEN RANDOMLY GENERATE 2 PICTURES TO BE DISPLAYED ON THE GUI WHEN I PRESS THE "DEAL" BUTTON. THIS WILL THEN ACT AS THE OPENING HAND FOR PLAYER A AND FROM HERE THEY CAN DECIDE IF THEY WISH TO FOLD OR RAISE ETC.

ANY HELP WOULD BE GREATLY APPRECIATED

[535 byte] By [GuitarHer0a] at [2007-10-2 11:34:34]
# 1
>ANY HELP WOULD BE GREATLY APPRECIATEDCheck your caps lock key as it seems to be stuck.
IanSchneidera at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 2
Look at ArrayList and Collections.shuffle()
es5f2000a at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 3
Are you also going to write a program to analyze the images to see which cards you dealt to each player?
dubwaia at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 4
yes i plan to analyse the cards once they are dealt. im not sure of the best way of doing this but im gonna assign points for each card and compare likeness eg. two cards of the same suit or two kings etc. any ideas?
GuitarHer0a at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 5

Don't worry about the GUI at first. I know it's the fun part, but you need to get your game logic down first.

a) model the deck of cards

class Card {

// has a suite (0,1,2,3)

// has a type (1 to 13 where 11,12,13 are J, Q, K)

}

class Deck {

// has an ArrayList of Card objects

}

b) make a controller for the Deck

class DeckController {

// has a Deck

// has a constuctor that accepts a new Deck

// has a public void shuffleDeck() method

// has a public Card getCardOffTop() method which returns a Card and removes it from the Deck

}

c) write a command line client that creates a DeckController and deals cards -- your'll probably want Player objects and a PlayerController object, PileOfChips object, PileOfChipsController, and so on.

d) once you have your Controllers and Models doing everything necessary to play poker, *then* just build a GUI that manipulates the Controllers. (Mapping an image filename to a Card will be the easiest part of your project.)

By the way, this design pattern is called MVC (model, view, controller -- where view is you GUI).

Good luck -- sounds like a fun project!

boxlighta at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 6

> yes i plan to analyse the cards once they are dealt.

> im not sure of the best way of doing this but im

> m gonna assign points for each card and compare

> likeness eg. two cards of the same suit or two kings

> etc. any ideas?

The point is that you are thinking about this backwards. In your post you suggest that you are gong to pass out random images to the users. How will your code determine what hands they have? Using the picture is a pretty lousy way to do that for a bunch of reasons.

Take boxlights advice. Get the logic in first. Make a card class. Each instance will represent a distinct card in the deck. Make a Deck class. Then once you have got the logic down, assigning a picture to each card is trivial. The hardest part of this is going to be 1. determining which hand(s) win (ties are possible) 2. Managing the betting (order, amounts, caps, all-ins) pot splits and side pots.

dubwaia at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 7
thanks for all the help and advice. ill give it a go
GuitarHer0a at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...
# 8
hi, hey i need you tu send me an email if yo see this, my mail is pablolagas@hotmail.com, if you use msn messenger just add me if you don't please send me an email because i have to ask you something
lagola at 2007-7-13 5:02:45 > top of Java-index,Security,Event Handling...