Thread: Poker simulator

  1. #1
    Registered User
    Join Date
    Jan 2018
    Posts
    2

    Poker simulator

    I am new to coding and I have to built a poker simulator for school. I already have a shuffling function, deal function, and display function. I have been stuck at the compare function of who wins. I am trying to start at a easy one such as a pair but I donít know where to start. If someone can please send like a sample of what you would do or a hint on how to start the comparisons it would help a lot! I havenít learned qsort yet but my only tools I have learned are up to matrixís, arrays if that helps show what level I am at in coding.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,013
    You need a function that has the input value of an poker hand.
    The output value is likely needed to be the following; but, I have not played poker in decades.
    highest suit
    highest rank
    highest ?? two pair or three of a kind, etc.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Jan 2018
    Posts
    2
    Quote Originally Posted by stahta01 View Post
    You need a function that has the input value of an poker hand.
    The output value is likely needed to be the following; but, I have not played poker in decades.
    highest suit
    highest rank
    highest ?? two pair or three of a kind, etc.

    Tim S.
    I already have the cp hand and players hand displayed. All I need is the comparisons of who wins that round but I donít know how to do it

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,629
    Write a whole series of functions
    - isFlush
    - isFourOfAKind
    - IsTwoPair
    Etc

    Pass in a hand, and return true or false.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Purchase Simulator
    By vishal udani in forum C Programming
    Replies: 1
    Last Post: 02-04-2014, 10:42 AM
  2. Simulator
    By MasterAchilles in forum C Programming
    Replies: 10
    Last Post: 11-30-2008, 10:31 PM
  3. blackjack simulator
    By fsufan22 in forum C++ Programming
    Replies: 10
    Last Post: 03-20-2008, 03:16 PM
  4. A Better Format Simulator
    By toonlover in forum C++ Programming
    Replies: 2
    Last Post: 01-07-2006, 06:14 PM
  5. Networking Simulator
    By sandieman in forum C Programming
    Replies: 0
    Last Post: 10-23-2005, 02:00 PM

Tags for this Thread