Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Category Archives: Lesson

Post navigation

← Older posts
Newer posts →

The Poker Program

Posted on November 2, 2019 by dgookin
2

With all the hand-ranking functions complete (see last week’s Lesson), the final version of my poker program restores the randomizer, draws and sorts a hand, then outputs the hand’s value. It’s quite disappointing.
Continue reading →

Posted in Lesson | 2 Replies

One or Two Pairs (Poker VIII)

Posted on October 26, 2019 by dgookin
Reply

Matching two card values in a poker hand counts as a pair. It’s the lowest-ranking hand (above the non-ranked “high card”) and the most common. In my poker program, it’s also the last ranking hand tested.
Continue reading →

Posted in Lesson | Leave a reply

Four-of-a-Kind, Three-of-a-kind, and a Full House (Poker VII)

Posted on October 19, 2019 by dgookin
Reply

To effectively evaluate poker hands, the next sequence after a straight, straight flush, and flush draw (covered in last week’s Lesson) is to evaluate four-of-a-kind, then three-of-a-kind, and (while you’re at it) a full house.
Continue reading →

Posted in Lesson | Leave a reply

Flush, Straight, and Straight Flush Tests (Poker VI)

Posted on October 12, 2019 by dgookin
Reply

After pulling out any hands arranged in a straight pattern, covered in last week’s Lesson, the next logical test is for a flush. The flush draw is when all cards are of the same suit.
Continue reading →

Posted in Lesson | Leave a reply

Straight Draw (Poker V)

Posted on October 5, 2019 by dgookin
Reply

The first test for a hand of five cards is the straight, specifically an Ace-high straight followed by a standard straight. To perform this test, I’ve concocted a special version of the program, one that has a set of pre-drawn poker hands.
Continue reading →

Posted in Lesson | Leave a reply

Evaluating Poker Hands (Poker IV)

Posted on September 28, 2019 by dgookin
Reply

Last week’s Lesson brought the Poker program up to speed with regards to drawing a hand of 5 cards. The playing_card structure provides a convenient reference for each card, and the hand is sorted. Now comes the fun part: Determining the hand’s value.
Continue reading →

Posted in Lesson | Leave a reply

Drawing A Hand of Cards (Poker III)

Posted on September 21, 2019 by dgookin
Reply

Improving upon last week’s Lesson, this update to the playing card simulator offers one minor change: Multiple cards are pulled from the draw() function.
Continue reading →

Posted in Lesson | Leave a reply

The Playing Card Structure (Poker II)

Posted on September 14, 2019 by dgookin
Reply

Drawing cards from a deck is an activity requiring more effort than flagging an element in an array, which was demonstrated in last week’s Lesson. Such code works, but it’s best to set details about the card when it’s drawn, noting its face value and suit, for example. Such complex information is best placed into a structure.
Continue reading →

Posted in Lesson | Leave a reply

Draw Five Cards (Poker I)

Posted on September 7, 2019 by dgookin
Reply

To code a card game, you must start with the deck: 52 cards divided into 4 suits each consisting of 10 number cards and three face cards. Seems easy.
Continue reading →

Posted in Lesson | Leave a reply

Structures and Arrays, Part III

Posted on August 31, 2019 by dgookin
Reply

I’ve wrapped up most of the oddities about structure/pointer/array notation in the past two Lessons (Part I and Part II). All that’s left is for me to go insane and start allocating structures as pointers with all their members as pointers.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Extracting Data Chunks
  • C Blog 13th Anniversary
  • Colorful Data Chunks
  • A Little Bit Off the Sides – Solution
  • Working with Data Chunks

Recent Comments

  • dgookin on C Blog 13th Anniversary
  • M.Stumpfl on C Blog 13th Anniversary
  • Chris Webb on C Blog 13th Anniversary
  • M.Stumpfl on A Little Bit Off the Sides – Solution
  • dgookin on A Little Bit Off the Sides – Solution

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress