/* This file is part of cardwords
(c) 1998 1999 Tobias Peters
see file COPYING for the copyright terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// cardwords_pile.hh
#ifndef CARDWORDS_PILE_HH
#define CARDWORDS_PILE_HH
// The pile is the repository of cards.
#include "cardwords_cardcontainer1dim.hh"
class CardWords_Pile : public CardWords_CardContainer1Dim {
public:
// Selects a randomly chosen card:
CardWords_Card *
produce_card(void) const;
// The constructor takes one argument: An istream where it
// reads the card specs from.
// The total number of cards in the game is also expected (first)
// in the istream.
// The necessary cards will be allocated on the heap.
CardWords_Pile(istream & cardSpecs);
// Since the pile creates the cards, here is the place to ask what
// cards are in the game:
void
print_cardSpecs (ostream &) const;
// The format of this output is suitable to act as the input for the
// constructor
virtual ~CardWords_Pile();
size_t get_cardCount(void);
private:
const Machine_Char * cardSpecs;
size_t cardCount;
};
inline size_t
CardWords_Pile::get_cardCount(void)
{
return cardCount;
}
#endif
/*
There is no more code in this File. I will describe the format:
The input/output consists of tokens separated by white space.
A Token can (and does) contain whitespace. The very first token
is an int in decimal representation. This int is the total
number of cards.
All the following tokens have the form
[x #]
This is the same as the output produced by ostream << CardWords_Card
(see file cardwords_card.cc), if wildcards have not been assigned a
meaning previously.
A wildcard has the token "[ 0]". Replace the 0 with any other value
you want that wildcard to have.
There is (yet?) no way to add a count - one token stands for one
card.
*/