/********************************************************** File: poker.h Description: A program that simulates a simple poker game to serve as an example of using the Scatter and Gather functions from MPI. Author: Dana Vrajitoru Organization: IUSB Date: October 14, 2004 ***********************************************************/ #ifndef POKER_H #define POKER_H const int hand_size = 5; // Main poker playing function. void Poker_play(int proc_id, int nb_proc); // Print all the cards in the hand and the process id. void Print_hand(int *my_hand, int proc_id); // Find the id of the process that has the highest score and display // it as the winner. If there's a tie, you should also report that. void Find_winner(int *all_scores, int nb_proc); // Generates a random card. The cards are identified by numbers // between 0 and 13 and each of them can only appear 4 times in the // game. The function should be called with the reset parameter being // true once at the begining of a new game. The default value for the // reset parameter is false. int Draw_card(bool reset = false); // Computes the score of the hand by sorting the cards first and then // calling the other functions bellow. int Score(int *hand); // For the following functions, the hand should have at least 5 // elements and only 5 will be used even if there are more. We will // assume that the cards have been sorted before the functions are // called. The functions should be called in decreasing order of // importance, such that the function "Pair" for example should not // worry if the hand is in fact a "3 of a kind". // Verifies if the hand has 4 of a kind cards, meaning 4 cards with // the same number. bool Four_of_a_kind(int *hand); // Verifies if the hand is a full house, meaning 3 cards of a kind // plus a pair of a different number. bool Full_house(int *hand); // Verifies if the cards are in sequence. bool Straight(int *hand); // Verifies if the hand has 3 of a kind cards, meaning 3 cards with // the same number. bool Three_of_a_kind(int *hand); // Verifies if there are 2 pairs of cards in the hand. bool Two_pairs(int *hand); // Verifies if there are 2 pairs of cards in the hand. bool Pair(int *hand); #endif