cardgame.cpp File Reference

GNU cgicc Card Game application. More...

#include <iostream>
#include <vector>
#include <iterator>
#include <string>
#include <cstdlib>
#include <ctime>
#include <sstream>
#include <fstream>
#include <queue>
#include "cgicc/CgiDefs.h"
#include "cgicc/Cgicc.h"
#include "cgicc/HTTPHTMLHeader.h"
#include "cgicc/HTMLClasses.h"
#include "cgicc/HTTPCookie.h"

Go to the source code of this file.


namespace  CardGameTools


struct  datasplayer
 A data model for the player. More...
struct  datasgame
 A data model for the games. More...


#define COOKIE_FILE_NAME   "sessions.tmp"
#define GAME_FILE_NAME   "games.tmp"
#define MAX_GAME   10


string CardGameTools::convertStructToString (datasplayer *pPlayer)
 Generate a data in a single line from the data of the player.
datasplayerCardGameTools::convertStringToStuct (string pPlayer)
 Generate a datasgame struct from a single line.
string CardGameTools::getNUMCookie (std::vector< HTTPCookie > pCookieVector)
 Get the cookie of the game from the list of the cookies.
string CardGameTools::getValue (string pName)
 Get all personnal information from the cookie's Id.
string CardGameTools::getFileGame (string pName)
 Get all game information from the name of the player.
datasgameCardGameTools::getGame (string pName)
 Convert the data to the datasgame struct.
void CardGameTools::writeValue (string pName, string pValue)
 Write data in the cookie file.
void CardGameTools::writeFileGame (string pName, string pValue)
 Write data in the game file.
void CardGameTools::writeGame (datasplayer *pPlayer, datasgame *pGame)
 Write datasgame struct in the game file.
string CardGameTools::generateUnicCookie ()
 generate an unique id
int CardGameTools::countGame ()
 Read the game file and count the number of games.
vector< string > * CardGameTools::loadAndMixCards ()
 Generate a mixed cards list.
int CardGameTools::calculateCard (string pCard)
 Return the value of the card.
datasgameCardGameTools::createGame (datasplayer *vPlayer)
 Create a game from the data of the player.
void CardGameTools::drawCards (vector< string > *cardList)
 Draw the cards list.
void CardGameTools::writeWinner (datasplayer *vPlayer, datasgame *pGame)
 Draw the winner informations.
void CardGameTools::drawInfos (datasplayer *vPlayer)
 Draw player informations.
void CardGameTools::drawPlayers (datasgame *pGame)
 Draw players game informations.
void CardGameTools::drawCardInPlay (datasgame *pGame)
 Draw the cards in the table.
void CardGameTools::drawPlayerCards (datasplayer *vPlayer)
 Draw the cards of the player.
void CardGameTools::playACard (datasplayer *vPlayer, datasgame *readedGame, string *card)
 The algorithm when a card is played.
void CardGameTools::turnPlayers (datasplayer *vPlayer, datasgame *readedGame)
 Change the hand in the game.
bool CardGameTools::testCard (datasplayer *vPlayer, datasgame *readedGame, string *card)
 Test if the card is playable.
void CardGameTools::IAPlay (datasgame *readedGame, int pId)
 AI algorithme for one AI player.
void CardGameTools::gameRules (datasplayer *vPlayer, string *action, string *card)
 The rules Algorithm.
int main (int argc, char **argv)
 The main function.

Detailed Description

GNU cgicc Card Game application.

Tests and demonstrates access of form data, cookie, persistance using the GNU cgicc library.

Definition in file cardgame.cpp.

Function Documentation

int main ( int  argc,
char **  argv 

The main function.

argc : the number of parameters y
argv : The parameters
The value of the program (Ok, Not Ok, error ,...)

Definition at line 1479 of file cardgame.cpp.

References CardGameTools::convertStringToStuct(), CardGameTools::convertStructToString(), COOKIE_NAME, CardGameTools::gameRules(), CardGameTools::generateUnicCookie(), cgicc::CgiEnvironment::getCookieList(), cgicc::Cgicc::getElement(), cgicc::Cgicc::getElements(), cgicc::Cgicc::getEnvironment(), CardGameTools::getNUMCookie(), CardGameTools::getValue(), datasplayer::identifiant, CardGameTools::writeFileGame(), and CardGameTools::writeValue().

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Sat Jan 19 21:15:58 2008 for cgicc by doxygen 1.5.1