elo-ratings 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +23 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/elo-ratings.gemspec +148 -0
- data/ext/bayeselo/.gitignore +4 -0
- data/ext/bayeselo/CBradleyTerry.cpp +670 -0
- data/ext/bayeselo/CBradleyTerry.h +137 -0
- data/ext/bayeselo/CCDistribution.cpp +135 -0
- data/ext/bayeselo/CCDistribution.h +44 -0
- data/ext/bayeselo/CCDistributionCUI.cpp +104 -0
- data/ext/bayeselo/CCDistributionCUI.h +38 -0
- data/ext/bayeselo/CCondensedResults.cpp +253 -0
- data/ext/bayeselo/CCondensedResults.h +64 -0
- data/ext/bayeselo/CDiscretization.h +40 -0
- data/ext/bayeselo/CDistribution.cpp +123 -0
- data/ext/bayeselo/CDistribution.h +58 -0
- data/ext/bayeselo/CDistributionCollection.cpp +34 -0
- data/ext/bayeselo/CDistributionCollection.h +29 -0
- data/ext/bayeselo/CEloRatingCUI.cpp +1046 -0
- data/ext/bayeselo/CEloRatingCUI.h +67 -0
- data/ext/bayeselo/CIndirectCompare.h +28 -0
- data/ext/bayeselo/CJointBayesian.cpp +111 -0
- data/ext/bayeselo/CJointBayesian.h +38 -0
- data/ext/bayeselo/CLUDecomposition.cpp +154 -0
- data/ext/bayeselo/CLUDecomposition.h +36 -0
- data/ext/bayeselo/CMatrix.cpp +48 -0
- data/ext/bayeselo/CMatrix.h +35 -0
- data/ext/bayeselo/CMatrixIO.cpp +27 -0
- data/ext/bayeselo/CMatrixIO.h +17 -0
- data/ext/bayeselo/CPredictionCUI.cpp +393 -0
- data/ext/bayeselo/CPredictionCUI.h +50 -0
- data/ext/bayeselo/CResultSet.cpp +245 -0
- data/ext/bayeselo/CResultSet.h +50 -0
- data/ext/bayeselo/CResultSetCUI.cpp +355 -0
- data/ext/bayeselo/CResultSetCUI.h +44 -0
- data/ext/bayeselo/CTimeIO.cpp +58 -0
- data/ext/bayeselo/CTimeIO.h +19 -0
- data/ext/bayeselo/CVector.cpp +110 -0
- data/ext/bayeselo/CVector.h +42 -0
- data/ext/bayeselo/EloDataFromFile.cpp +120 -0
- data/ext/bayeselo/EloDataFromFile.h +21 -0
- data/ext/bayeselo/README +8 -0
- data/ext/bayeselo/ReadLineToString.cpp +32 -0
- data/ext/bayeselo/ReadLineToString.h +18 -0
- data/ext/bayeselo/chtime.cpp +56 -0
- data/ext/bayeselo/chtime.h +61 -0
- data/ext/bayeselo/chtimer.h +27 -0
- data/ext/bayeselo/clktimer.cpp +178 -0
- data/ext/bayeselo/clktimer.h +29 -0
- data/ext/bayeselo/consolui.cpp +538 -0
- data/ext/bayeselo/consolui.h +154 -0
- data/ext/bayeselo/const.cpp +79 -0
- data/ext/bayeselo/const.h +42 -0
- data/ext/bayeselo/date.cpp +96 -0
- data/ext/bayeselo/date.h +44 -0
- data/ext/bayeselo/debug.h +58 -0
- data/ext/bayeselo/elomain.cpp +26 -0
- data/ext/bayeselo/extconf.rb +6 -0
- data/ext/bayeselo/list.h +367 -0
- data/ext/bayeselo/listi.h +125 -0
- data/ext/bayeselo/move.cpp +249 -0
- data/ext/bayeselo/move.h +139 -0
- data/ext/bayeselo/pgn.h +62 -0
- data/ext/bayeselo/pgnlex.cpp +432 -0
- data/ext/bayeselo/pgnlex.h +105 -0
- data/ext/bayeselo/pgnstr.cpp +126 -0
- data/ext/bayeselo/piece.h +44 -0
- data/ext/bayeselo/player.h +31 -0
- data/ext/bayeselo/position.h +89 -0
- data/ext/bayeselo/random.cpp +114 -0
- data/ext/bayeselo/random.h +63 -0
- data/ext/bayeselo/rb_bayeselo.cpp +76 -0
- data/ext/bayeselo/readstr.cpp +51 -0
- data/ext/bayeselo/readstr.h +19 -0
- data/ext/bayeselo/square.h +61 -0
- data/ext/bayeselo/str.cpp +81 -0
- data/ext/bayeselo/str.h +71 -0
- data/ext/bayeselo/version.cpp +30 -0
- data/ext/bayeselo/version.h +28 -0
- data/ext/bayeselo/version_number.h +1 -0
- data/lib/bayeselo.rb +6 -0
- data/lib/bayeselo/bayeselo.rb +11 -0
- data/lib/bayeselo/c_bayeselo.rb +7 -0
- data/test/bayeselo/test_bayeselo.rb +33 -0
- data/test/bayeselo/test_c_bayeselo.rb +84 -0
- data/test/helper.rb +18 -0
- metadata +226 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// CResultSetCUI.h
|
|
4
|
+
//
|
|
5
|
+
// Remi Coulom
|
|
6
|
+
//
|
|
7
|
+
// December, 2004
|
|
8
|
+
//
|
|
9
|
+
////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#ifndef CResultSetCUI_Declared
|
|
11
|
+
#define CResultSetCUI_Declared
|
|
12
|
+
|
|
13
|
+
#include "consolui.h" // CConsoleUI
|
|
14
|
+
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
class CResultSet;
|
|
18
|
+
|
|
19
|
+
class CResultSetCUI : public CConsoleUI // rscui
|
|
20
|
+
{
|
|
21
|
+
private: //////////////////////////////////////////////////////////////////
|
|
22
|
+
static const char * const tszCommands[];
|
|
23
|
+
|
|
24
|
+
CResultSet &rs;
|
|
25
|
+
std::vector<std::string> &vecName;
|
|
26
|
+
|
|
27
|
+
unsigned ComputePlayerWidth() const;
|
|
28
|
+
|
|
29
|
+
protected: ////////////////////////////////////////////////////////////////
|
|
30
|
+
virtual int ProcessCommand(const char *pszCommand,
|
|
31
|
+
const char *pszParameters,
|
|
32
|
+
std::istream &in,
|
|
33
|
+
std::ostream &out);
|
|
34
|
+
|
|
35
|
+
virtual void PrintLocalPrompt(std::ostream &out);
|
|
36
|
+
|
|
37
|
+
public: ///////////////////////////////////////////////////////////////////
|
|
38
|
+
CResultSetCUI(CResultSet &rsInit,
|
|
39
|
+
std::vector<std::string> &vecNameInit,
|
|
40
|
+
CConsoleUI *pcui = 0,
|
|
41
|
+
int openmode = OpenModal);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
#endif
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// CTimeIO.cpp
|
|
4
|
+
//
|
|
5
|
+
// Remi Coulom
|
|
6
|
+
//
|
|
7
|
+
// August 1996
|
|
8
|
+
//
|
|
9
|
+
////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#include "CTimeIO.h"
|
|
11
|
+
#include "chtime.h"
|
|
12
|
+
|
|
13
|
+
#include <iostream>
|
|
14
|
+
#include <iomanip>
|
|
15
|
+
#include <sstream>
|
|
16
|
+
|
|
17
|
+
////////////////////////////////////////////////////////////////////////////
|
|
18
|
+
// output operator
|
|
19
|
+
////////////////////////////////////////////////////////////////////////////
|
|
20
|
+
std::ostream &operator<<(std::ostream &ostr, const CTime &time)
|
|
21
|
+
{
|
|
22
|
+
char cOldFill = ostr.fill('0');
|
|
23
|
+
int OldWidth = ostr.width(2);
|
|
24
|
+
|
|
25
|
+
ostr << std::setw(2) << time.GetHours() << ':';
|
|
26
|
+
ostr << std::setw(2) << time.GetMinutes() << ':';
|
|
27
|
+
ostr << std::setw(2) << time.GetSeconds() << ',';
|
|
28
|
+
ostr << std::setw(2) << time.GetHundredths();
|
|
29
|
+
|
|
30
|
+
ostr.width(OldWidth);
|
|
31
|
+
ostr.fill(cOldFill);
|
|
32
|
+
|
|
33
|
+
return ostr;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
////////////////////////////////////////////////////////////////////////////
|
|
37
|
+
// input operator
|
|
38
|
+
////////////////////////////////////////////////////////////////////////////
|
|
39
|
+
std::istream &operator>>(std::istream &istr, CTime &time)
|
|
40
|
+
{
|
|
41
|
+
char szBuffer[12];
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
int i = 0;
|
|
45
|
+
for (; i < (int)sizeof(szBuffer) - 1; i++)
|
|
46
|
+
{
|
|
47
|
+
int c = istr.peek();
|
|
48
|
+
if (c == ' ' || c == '\n' || istr.eof())
|
|
49
|
+
break;
|
|
50
|
+
szBuffer[i] = c;
|
|
51
|
+
istr.ignore();
|
|
52
|
+
}
|
|
53
|
+
szBuffer[i] = 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
time.Set(szBuffer);
|
|
57
|
+
return istr;
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// CTimeIO.h
|
|
4
|
+
//
|
|
5
|
+
// Remi Coulom
|
|
6
|
+
//
|
|
7
|
+
// August, 1996
|
|
8
|
+
//
|
|
9
|
+
////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#ifndef CTimeIO_Declared
|
|
11
|
+
#define CTimeIO_Declared
|
|
12
|
+
|
|
13
|
+
#include <iosfwd>
|
|
14
|
+
class CTime;
|
|
15
|
+
|
|
16
|
+
std::ostream &operator<<(std::ostream &ostr, const CTime &time);
|
|
17
|
+
std::istream &operator>>(std::istream &istr, CTime &time);
|
|
18
|
+
|
|
19
|
+
#endif
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// CVector.cpp
|
|
4
|
+
//
|
|
5
|
+
// Remi Coulom
|
|
6
|
+
//
|
|
7
|
+
// September, 2000
|
|
8
|
+
//
|
|
9
|
+
////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#include "CVector.h"
|
|
11
|
+
|
|
12
|
+
////////////////////////////////////////////////////////////////////////////
|
|
13
|
+
// Constructor
|
|
14
|
+
////////////////////////////////////////////////////////////////////////////
|
|
15
|
+
CVector::CVector(int SizeInit) :
|
|
16
|
+
Size(0)
|
|
17
|
+
{
|
|
18
|
+
SetSize(SizeInit);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
////////////////////////////////////////////////////////////////////////////
|
|
22
|
+
// Set Size
|
|
23
|
+
////////////////////////////////////////////////////////////////////////////
|
|
24
|
+
void CVector::SetSize(int NewSize)
|
|
25
|
+
{
|
|
26
|
+
if (Size)
|
|
27
|
+
{
|
|
28
|
+
delete[] pd;
|
|
29
|
+
Size = 0;
|
|
30
|
+
}
|
|
31
|
+
if (NewSize > 0)
|
|
32
|
+
pd = new double[Size = NewSize];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
////////////////////////////////////////////////////////////////////////////
|
|
36
|
+
// Assignment operator
|
|
37
|
+
////////////////////////////////////////////////////////////////////////////
|
|
38
|
+
CVector &CVector::operator=(const CVector &v)
|
|
39
|
+
{
|
|
40
|
+
if (&v != this)
|
|
41
|
+
{
|
|
42
|
+
if (Size != v.GetSize())
|
|
43
|
+
SetSize(v.GetSize());
|
|
44
|
+
for (int i = Size; --i >= 0;)
|
|
45
|
+
pd[i] = v[i];
|
|
46
|
+
}
|
|
47
|
+
return *this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
////////////////////////////////////////////////////////////////////////////
|
|
51
|
+
// Copy constructor
|
|
52
|
+
////////////////////////////////////////////////////////////////////////////
|
|
53
|
+
CVector::CVector(const CVector &v) :
|
|
54
|
+
Size(0)
|
|
55
|
+
{
|
|
56
|
+
*this = v;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
////////////////////////////////////////////////////////////////////////////
|
|
60
|
+
// Zero
|
|
61
|
+
////////////////////////////////////////////////////////////////////////////
|
|
62
|
+
void CVector::Zero()
|
|
63
|
+
{
|
|
64
|
+
for (int i = Size; --i >= 0;)
|
|
65
|
+
pd[i] = 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
////////////////////////////////////////////////////////////////////////////
|
|
69
|
+
// Scale
|
|
70
|
+
////////////////////////////////////////////////////////////////////////////
|
|
71
|
+
void CVector::Scale(double x)
|
|
72
|
+
{
|
|
73
|
+
for (int i = Size; --i >= 0;)
|
|
74
|
+
pd[i] *= x;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
////////////////////////////////////////////////////////////////////////////
|
|
78
|
+
// Add
|
|
79
|
+
////////////////////////////////////////////////////////////////////////////
|
|
80
|
+
void CVector::Add(const double *pdp)
|
|
81
|
+
{
|
|
82
|
+
for (int i = Size; --i >= 0;)
|
|
83
|
+
pd[i] += pdp[i];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
////////////////////////////////////////////////////////////////////////////
|
|
87
|
+
// Add scaled
|
|
88
|
+
////////////////////////////////////////////////////////////////////////////
|
|
89
|
+
void CVector::AddScaled(const double *pdp, double x)
|
|
90
|
+
{
|
|
91
|
+
for (int i = Size; --i >= 0;)
|
|
92
|
+
pd[i] += x * pdp[i];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
////////////////////////////////////////////////////////////////////////////
|
|
96
|
+
// Set from a pointer
|
|
97
|
+
////////////////////////////////////////////////////////////////////////////
|
|
98
|
+
void CVector::Set(const double *px)
|
|
99
|
+
{
|
|
100
|
+
for (int i = Size; --i >= 0;)
|
|
101
|
+
pd[i] = px[i];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
////////////////////////////////////////////////////////////////////////////
|
|
105
|
+
// Destructor
|
|
106
|
+
////////////////////////////////////////////////////////////////////////////
|
|
107
|
+
CVector::~CVector()
|
|
108
|
+
{
|
|
109
|
+
SetSize(0);
|
|
110
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// CVector.h
|
|
4
|
+
//
|
|
5
|
+
// Remi Coulom
|
|
6
|
+
//
|
|
7
|
+
// September, 2000
|
|
8
|
+
//
|
|
9
|
+
////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#ifndef Math_CVector_Declared
|
|
11
|
+
#define Math_CVector_Declared
|
|
12
|
+
|
|
13
|
+
class CVector // v
|
|
14
|
+
{
|
|
15
|
+
private: /////////////////////////////////////////////////////////////////
|
|
16
|
+
double *pd;
|
|
17
|
+
int Size;
|
|
18
|
+
|
|
19
|
+
public: //////////////////////////////////////////////////////////////////
|
|
20
|
+
CVector(int SizeInit = 0);
|
|
21
|
+
CVector(const CVector &v);
|
|
22
|
+
CVector &operator=(const CVector &v);
|
|
23
|
+
|
|
24
|
+
int GetSize() const {return Size;}
|
|
25
|
+
void SetSize(int NewSize);
|
|
26
|
+
|
|
27
|
+
operator double * () {return pd;}
|
|
28
|
+
operator const double * () const {return pd;}
|
|
29
|
+
|
|
30
|
+
double operator[](int i) const {return pd[i];}
|
|
31
|
+
double &operator[](int i) {return pd[i];}
|
|
32
|
+
|
|
33
|
+
void Zero();
|
|
34
|
+
void Scale(double x);
|
|
35
|
+
void Add(const double *pdp);
|
|
36
|
+
void AddScaled(const double *pdp, double x);
|
|
37
|
+
void Set(const double *px);
|
|
38
|
+
|
|
39
|
+
~CVector();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
#endif
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// R�mi Coulom
|
|
4
|
+
//
|
|
5
|
+
// December, 2004
|
|
6
|
+
//
|
|
7
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
#include "EloDataFromFile.h"
|
|
9
|
+
#include "pgnlex.h"
|
|
10
|
+
#include "pgn.h"
|
|
11
|
+
#include "str.h"
|
|
12
|
+
#include "CResultSet.h"
|
|
13
|
+
|
|
14
|
+
#include <map>
|
|
15
|
+
#include <string>
|
|
16
|
+
#include <iostream>
|
|
17
|
+
|
|
18
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
// Skip a game
|
|
20
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
static void SkipGame(CPGNLex &pgnlex)
|
|
22
|
+
{
|
|
23
|
+
int Token = pgnlex.GetToken();
|
|
24
|
+
|
|
25
|
+
while (Token != CPGNLex::TOK_EOF)
|
|
26
|
+
{
|
|
27
|
+
int TokenPrev = Token;
|
|
28
|
+
Token = pgnlex.ReadNextToken();
|
|
29
|
+
|
|
30
|
+
if (TokenPrev == CPGNLex::TOK_GameTermination ||
|
|
31
|
+
Token == CPGNLex::TOK_EOF ||
|
|
32
|
+
(TokenPrev != CPGNLex::TOK_TagClose &&
|
|
33
|
+
TokenPrev != CPGNLex::TOK_BOF &&
|
|
34
|
+
Token == CPGNLex::TOK_TagOpen))
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
42
|
+
// Read all data for Elo calculation
|
|
43
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
44
|
+
void EloDataFromFile(CPGNLex &pgnlex,
|
|
45
|
+
CResultSet &rs,
|
|
46
|
+
std::vector<std::string> &vNames)
|
|
47
|
+
{
|
|
48
|
+
int Players = 0;
|
|
49
|
+
int Ignored = 0;
|
|
50
|
+
|
|
51
|
+
//
|
|
52
|
+
// Add current players to the name map
|
|
53
|
+
//
|
|
54
|
+
std::map<std::string, int> NameMap;
|
|
55
|
+
for (int i = vNames.size(); --i >= 0;)
|
|
56
|
+
{
|
|
57
|
+
std::pair<const std::string, int> Pair(vNames[i], i);
|
|
58
|
+
NameMap.insert(Pair);
|
|
59
|
+
Players++;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//
|
|
63
|
+
// Loop over games
|
|
64
|
+
//
|
|
65
|
+
while (1)
|
|
66
|
+
{
|
|
67
|
+
CSTR str;
|
|
68
|
+
int fTheEnd = CPGN::ReadSTR(str, pgnlex);
|
|
69
|
+
SkipGame(pgnlex);
|
|
70
|
+
|
|
71
|
+
if (!fTheEnd)
|
|
72
|
+
{
|
|
73
|
+
//
|
|
74
|
+
// Ignore unknown results
|
|
75
|
+
//
|
|
76
|
+
int r = str.GetResult();
|
|
77
|
+
if (r < 0 || r > 2)
|
|
78
|
+
Ignored++;
|
|
79
|
+
else
|
|
80
|
+
{
|
|
81
|
+
std::string sWhite(str.GetWhite());
|
|
82
|
+
std::string sBlack(str.GetBlack());
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
std::pair<const std::string, int> Pair(sWhite, Players);
|
|
86
|
+
if (NameMap.insert(Pair).second)
|
|
87
|
+
{
|
|
88
|
+
Players++;
|
|
89
|
+
vNames.push_back(sWhite);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
{
|
|
93
|
+
std::pair<const std::string, int> Pair(sBlack, Players);
|
|
94
|
+
if (NameMap.insert(Pair).second)
|
|
95
|
+
{
|
|
96
|
+
Players++;
|
|
97
|
+
vNames.push_back(sBlack);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
int WhitePlayer = NameMap.find(sWhite)->second;
|
|
102
|
+
int BlackPlayer = NameMap.find(sBlack)->second;
|
|
103
|
+
|
|
104
|
+
rs.Append(WhitePlayer, BlackPlayer, r);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (rs.GetGames() % 1000 == 0 || fTheEnd)
|
|
109
|
+
{
|
|
110
|
+
std::cerr << rs.GetGames() << " game(s) loaded, ";
|
|
111
|
+
std::cerr << Ignored << " game(s) with unknown result ignored.\r";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (fTheEnd)
|
|
115
|
+
{
|
|
116
|
+
std::cerr << '\n';
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// R�mi Coulom
|
|
4
|
+
//
|
|
5
|
+
// December, 2004
|
|
6
|
+
//
|
|
7
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
#ifndef EloDataFromFile_Declared
|
|
9
|
+
#define EloDataFromFile_Declared
|
|
10
|
+
|
|
11
|
+
#include <vector>
|
|
12
|
+
#include <string>
|
|
13
|
+
|
|
14
|
+
class CPGNLex;
|
|
15
|
+
class CResultSet;
|
|
16
|
+
|
|
17
|
+
void EloDataFromFile(CPGNLex &pgnlex,
|
|
18
|
+
CResultSet &rs,
|
|
19
|
+
std::vector<std::string> &vNames);
|
|
20
|
+
|
|
21
|
+
#endif
|
data/ext/bayeselo/README
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// ReadLineToString.cpp
|
|
4
|
+
//
|
|
5
|
+
// R�mi Coulom
|
|
6
|
+
//
|
|
7
|
+
// April, 2006
|
|
8
|
+
//
|
|
9
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
#include "ReadLineToString.h"
|
|
11
|
+
|
|
12
|
+
#include <iostream>
|
|
13
|
+
|
|
14
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
15
|
+
// Read a line to a string
|
|
16
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
17
|
+
void ReadLineToString(std::string &s, std::istream &in)
|
|
18
|
+
{
|
|
19
|
+
s.clear();
|
|
20
|
+
while (1)
|
|
21
|
+
{
|
|
22
|
+
char c;
|
|
23
|
+
if (in.get(c))
|
|
24
|
+
{
|
|
25
|
+
if (c == '\n')
|
|
26
|
+
break;
|
|
27
|
+
s += c;
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|