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
Author Archives: dgookin
Know Your GPA
This semester has been brutal! You’ve had five classes, three of which are required for your major and two electives that turned out to be tougher than you anticipated. Yet, you pulled through the term without dropping a single course. You now have your grades and want to know your GPA for the semester.
Continue reading
Evaluating Poker Hands (Poker IV)
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
Drawing A Hand of Cards (Poker III)
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
The Playing Card Structure (Poker II)
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
Next Tuesday – Solution
One way to discover next Tuesday’s date is just to wait. You could code that solution in C, which would be silly, but I hope that you instead chose to use some time functions to derive your answer.
Continue reading
Draw Five Cards (Poker I)
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
Next Tuesday
What’s today?
The reply could be the day of a week, such as Sunday. That’s how I first answer the question. The more detailed answer is the day of the month, which isn’t often on my mind — unless it’s an important day like a birthday or some event.
Continue reading
Structures and Arrays, Part III
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
Structures and Arrays, Part II
When it comes to structures and pointers, the structure-pointer notation is used only when the structure itself is allocated as a pointer (block of memory), not when a structure member is a pointer. Let me review from last week’s Lesson:
Continue reading