All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Typedefs | Enumerations | Functions | Variables
count-win-loss.cc File Reference
#include "osl/container/moveVector.h"
#include "osl/record/csaRecord.h"
#include "osl/record/checkDuplicate.h"
#include <boost/algorithm/string/trim.hpp>
#include <boost/functional/hash.hpp>
#include "boost/foreach.hpp"
#include "boost/format.hpp"
#include "boost/multi_array.hpp"
#include <boost/program_options.hpp>
#include <fstream>
#include <iostream>
#include <vector>
Include dependency graph for count-win-loss.cc:

Go to the source code of this file.

Typedefs

typedef osl::stl::hash_map
< std::string, unsigned int,
boost::hash< std::string > > 
players_t
 
typedef boost::multi_array
< unsigned int, 4 > 
array_t
 

Enumerations

enum  GameResult {
  BLACK_WIN = 0, WHITE_WIN, OTHERS, BLACK_WIN = 0,
  WHITE_WIN, OTHERS
}
 

Functions

array_t winloss (boost::extents[MAX_PLAYERS][MAX_PLAYERS][2][3])
 
const std::string & getPlayerName (const unsigned int id)
 
unsigned int setPlayer (const std::string &player)
 
void increment (unsigned int black, unsigned int white, GameResult gr)
 
GameResult getGameResult (const std::string &csa_file, const osl::vector< osl::Move > &moves)
 
void readFile (const std::string &csa_file, osl::record::CheckDuplicate &duplicates)
 
void printTotal (std::ostream &out)
 
void printResult (std::ostream &out)
 
int main (int argc, char **argv)
 

Variables

static const unsigned int MAX_PLAYERS = 20
 < max players More...
 
static players_t players
 player_a, player_b, a's black 0 or white 1, [wins, losses, others] More...
 

Typedef Documentation

typedef boost::multi_array<unsigned int, 4> array_t

Definition at line 23 of file count-win-loss.cc.

typedef osl::stl::hash_map<std::string, unsigned int, boost::hash<std::string> > players_t

Definition at line 19 of file count-win-loss.cc.

Enumeration Type Documentation

enum GameResult
Enumerator
BLACK_WIN 
WHITE_WIN 
OTHERS 
BLACK_WIN 
WHITE_WIN 
OTHERS 

Definition at line 26 of file count-win-loss.cc.

Function Documentation

GameResult getGameResult ( const std::string &  csa_file,
const osl::vector< osl::Move > &  moves 
)

Definition at line 88 of file count-win-loss.cc.

References BLACK_WIN, OTHERS, and WHITE_WIN.

Referenced by readFile().

const std::string& getPlayerName ( const unsigned int  id)

Definition at line 33 of file count-win-loss.cc.

Referenced by printResult(), and printTotal().

void increment ( unsigned int  black,
unsigned int  white,
GameResult  gr 
)

Definition at line 66 of file count-win-loss.cc.

References BLACK_WIN, OTHERS, WHITE_WIN, and winloss().

Referenced by readFile().

int main ( int  argc,
char **  argv 
)
void printResult ( std::ostream &  out)

Definition at line 172 of file count-win-loss.cc.

References getPlayerName(), and winloss().

Referenced by main().

void printTotal ( std::ostream &  out)

Definition at line 140 of file count-win-loss.cc.

References getPlayerName(), and winloss().

Referenced by main().

void readFile ( const std::string &  csa_file,
osl::record::CheckDuplicate duplicates 
)
unsigned int setPlayer ( const std::string &  player)

Definition at line 45 of file count-win-loss.cc.

References MAX_PLAYERS.

Referenced by osl::hash::HashKey::HashKey(), and readFile().

array_t winloss ( boost::extents  [MAX_PLAYERS][MAX_PLAYERS][2][3])

Variable Documentation

const unsigned int MAX_PLAYERS = 20
static

< max players

player and his/her id

Definition at line 16 of file count-win-loss.cc.

Referenced by setPlayer().

players_t players
static

player_a, player_b, a's black 0 or white 1, [wins, losses, others]

Definition at line 20 of file count-win-loss.cc.

Referenced by osl::game_playing::GameManager::setComputerPlayer().