Classes | Namespaces | Macros | Functions
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 <algorithm>`
`#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.

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

## Namespaces
namespace | CardGameTools
| Contain all the functions to the coding game.

## Macros
#define | COOKIE_NAME "ELPIELOJUEGO"
#define | COOKIE_FILE_NAME "sessions.tmp"
#define | GAME_FILE_NAME "games.tmp"
#define | MAX_GAME 10

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

## 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.

## Macro Definition Documentation

## ◆ COOKIE_FILE_NAME

#define COOKIE_FILE_NAME "sessions.tmp"

Definition at line 46 of file cardgame.cpp.

## ◆ COOKIE_NAME

#define COOKIE_NAME "ELPIELOJUEGO"

Definition at line 45 of file cardgame.cpp.

## ◆ GAME_FILE_NAME

#define GAME_FILE_NAME "games.tmp"

Definition at line 47 of file cardgame.cpp.

## ◆ MAX_GAME

#define MAX_GAME 10

Definition at line 48 of file cardgame.cpp.

## Function Documentation

## ◆ main()

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

The main function.

Parameters

  argc | : the number of parameters y
  argv | : The parameters

Returns
  The value of the program (Ok, Not Ok, error ,...)

Definition at line 1483 of file cardgame.cpp.

References CardGameTools::generateUnicCookie(), cgicc::CgiEnvironment::getCookieList(), cgicc::Cgicc::getElement(), cgicc::Cgicc::getElements(), cgicc::Cgicc::getEnvironment(), CardGameTools::getNUMCookie(), CardGameTools::getValue(), and cgicc::HTTPHeader::setCookie().