1
0
Fork 0

Do not use <algorithm> in to_fen()

Seems there are some problems on HP-UX compiler.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
sf_2.3.1_base
Marco Costalba 2011-01-29 13:14:01 +01:00
parent 188700d7f1
commit f3e0b32def
1 changed files with 12 additions and 11 deletions

View File

@ -17,7 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <cassert>
#include <cstring>
#include <fstream>
@ -77,8 +76,6 @@ namespace {
// Bonus for having the side to move (modified by Joona Kiiski)
const Score TempoValue = make_score(48, 22);
bool isZero(char c) { return c == '0'; }
struct PieceLetters : public std::map<char, Piece> {
PieceLetters() {
@ -341,7 +338,7 @@ const string Position::to_fen() const {
Square sq;
char emptyCnt = '0';
for (Rank rank = RANK_8; rank >= RANK_1; rank--)
for (Rank rank = RANK_8; rank >= RANK_1; rank--, fen += '/')
{
for (File file = FILE_A; file <= FILE_H; file++)
{
@ -349,19 +346,23 @@ const string Position::to_fen() const {
if (square_is_occupied(sq))
{
fen += emptyCnt;
if (emptyCnt != '0')
{
fen += emptyCnt;
emptyCnt = '0';
}
fen += pieceLetters.from_piece(piece_on(sq));
emptyCnt = '0';
} else
emptyCnt++;
}
fen += emptyCnt;
fen += '/';
emptyCnt = '0';
if (emptyCnt != '0')
{
fen += emptyCnt;
emptyCnt = '0';
}
}
fen.erase(std::remove_if(fen.begin(), fen.end(), isZero), fen.end());
fen.erase(--fen.end());
fen += (sideToMove == WHITE ? " w " : " b ");
if (st->castleRights != CASTLES_NONE)