Jump to content

C# Poker Game Help

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Hello there,

I am trying to make a simple poker game, not using windows forms or things like that. I was wondering how to start of the constructors to shuffle the cards, deal the cards (Get a random 'card' from an enumerator).

Here is what I have so far:

using System;


public enum CARDSUIT

{

	clubs = 1,

	diamonds = 2,

	hearts = 3,

	spades = 4

}


public enum CARDVALUE

{

	Ace = 1,

	two = 2,

	three = 3,

	four = 4,

	five = 5,

	six = 6,

	seven = 7,

	eight = 8,

	nine = 9,

	ten = 10,

	jack = 11,

	queen = 12,

	king = 13

}


public enum POKERSCORE

{

	None,

	Pair,

	TwoPair,

	ThreeOfAKind,

	Straight,

	Flush,

	FullHouse,

	FourOfAKind,

	StraightFlush,

	RoyalFlush

}


I would like the game to be able to show how much money the player and computer have, and subtract from the total when ever they place a bet.

Hope you can help me :D

#2
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Hello Ascension, for the money thing, why not just make to double variables, one for the player and one for the computer, set it to start out to... well how much money whatever they bet and subtract, so a simple method would work like:

double _playermoney;

public double bet(double subtractthis)
{
return _playermoney - subtracthis;
}

Hope this helps.

#3
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Great Thanks. Also how would I go about dealing the cards to the players.

Thanks.

#4
garywestek

garywestek

    Newbie

  • Members
  • Pip
  • 1 posts
yes thats would work

#5
Ryan Marfone

Ryan Marfone

    Newbie

  • Members
  • PipPip
  • 11 posts
As far as dealing the cards is concerned...I would take a look at the System.Random() method.

#6
rhythm

rhythm

    Newbie

  • Members
  • Pip
  • 2 posts

Ascension said:

Great Thanks. Also how would I go about dealing the cards to the players.

Thanks.

create a player class, each player has a collection of cards, name, chip count, etc. somewhere you would maintain a collection of current players. when you deal, just add each successive card to the next player, until each player has the correct number of cards. the other methods for interaction between players would be written similarily.

think about all of the elements of the problem and the relationships between them. then try to design classes that make sense based on these relationships. this is the hard part, if you do this well writing the program becomes easy.

#7
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Okay. Thank You for that. Ill post my outcome.