////
//
// This file declares functions that illustrate the kinds of card-related
// processing that will be done in programmming assignments 5 and 6.
//
// NOTE: this is a C++ header file, containing only function declarations, but
// no definitions. The companion file card-play.cpp, q.v., contains the
// the definitions of the functions declared here.
//
////
#ifndef card_play_included
#define card_play_included
#include "Boolean.h"
#include <fstream.h>
const int DECK_SIZE = 52; // Number of cards in a deck
const int CARD_STR_LEN = 4; // Number of chars in the string rep of a card
////
//
// Function ReadCardAsString inputs a single card from the terminal and returns
// the card as a string in the reference parameter. The format of the card is
// as described in the program 5 writeup. This function does no validity
// checking of the card spelling, it simply inputs it as a string of two or
// three characters.
//
////
void ReadCardAsString(
char card[CARD_STR_LEN] // Returned card string
);
////
//
// Function ReadCardAsIntAndChar inputs a single card from the terminal and
// returns the card as a two-part value in the face_value and suit reference
// parameters. The format of the card is as described in the program 5
// writeup. The face_value is an integer between 1 and 13. The values 2
// through 10 represent the face value directly. The face value 1 is for an
// Ace, 11 for a Jack, 12 for a Queen, and 13 for a King. The suit is one of
// the characters 'S', 'H', 'D', or 'C'.
//
// This function performs validity checking of the input. Specifically, the
// first one or two characters must be a legal face value and the last
// character must be a legal suit. If the input is legal, the function returns
// TRUE, otherwise FALSE.
//
////
Boolean ReadCardAsIntAndChar(
int& face_value, // Returned face value
char& suit // Returned suit
);
////
//
// Function ReadFaceValue does the face value processing for function
// ReadCardAsIntOrChar, from which it is called.
//
////
void ReadFaceValue(
int& face_value // Returned face value
);
////
//
// Function ReadSuit does the suit processing for function ReadCardAsIntOrChar,
// from which it is called.
//
////
void ReadSuit(
char& suit // Returned suit
);
////
//
// Function ReadDeckFromFile reads a full card deck from the given input file.
// The file is assumed to contain DECK_SIZE legal cards. The deck is returned
// as an array of DECK_SIZE character strings in the deck reference parameter.
//
////
void ReadDeckFromFile(
ifstream& deck_file, // Input file
char deck[DECK_SIZE][CARD_STR_LEN] // Returned deck of cards
// ^^^^^^^^^ ^^^^^^^^^^^^
// ^^^^^^^^^ ^^^^^^^^^^^^ CARD_STR_LEN is the size of each array
// element (a card string)
// ^^^^^^^^^
// ^^^^^^^^^ DECK_SIZE is the size of the deck array
);
////
//
// Function DumpDeck simply dumps a deck of 52 cards to the terminal.
//
////
void DumpDeck(char deck[DECK_SIZE][CARD_STR_LEN]);
#endif