cfish logging?

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

cfish logging?

Post by mhull »

I'm running cfish from a linux console using polyglot as a CLI. I'd like to create a log of each game that includes score/PV/nodes/NPS and moves played. (The polyglot log used for debugging purposes would be way too much logging.)

What would be the appropriate incantations either for command line (polyglot and/or cfish) or config file?

I'd like to post the logs here for analysis and comment.
Matthew Hull
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

mhull wrote:I'm running cfish from a linux console using polyglot as a CLI. I'd like to create a log of each game that includes score/PV/nodes/NPS and moves played. (The polyglot log used for debugging purposes would be way too much logging.)

What would be the appropriate incantations either for command line (polyglot and/or cfish) or config file?

I'd like to post the logs here for analysis and comment.
I would love a log file akin to the old Glaurung log file for Cfish.
Something that showed the position, and also the analysis in SAN.

The uci notation, while nice for a computer, is icky[tm] for humans.
Give me SAN any day.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

I actually took a crack at it, but I do not know the Cfish data structures well enough to create a correct representation of the data (IOW, my try did not work).

Code: Select all

#include <assert.h>
#include <string.h>
#include <ctype.h>

#include "bitboard.h"
#include "material.h"
#include "misc.h"
#include "movegen.h"
#include "pawns.h"
#include "position.h"
#include "uci.h"

#include "evaluate.h"
#include "movepick.h"
#include "search.h"
#include "timeman.h"
#include "tt.h"

extern char *PieceToChar;

const char * move_to_san(Pos * pos, Move m, char san[16]) {
    unsigned san_cursor = 0;

    if (m == MOVE_NULL)
        return "(null)";

    Bitboard others, b;
    //char san[16] = {0};
    char *psan = san;
    uint32_t us = pos->sideToMove;
    Square from = from_sq(m);
    Square to = to_sq(m);
    Piece pc = piece_on(from);
    int pt = type_of_p(pc);
    char piecename;
    if (type_of_p(m) == CASTLING)
        psan = to > from ? "O-O" : "O-O-O";
    else
    {
        if (pt != PAWN)
        {
        	  piecename = PieceToChar[pc]; 
        	  piecename = toupper(piecename);// Upper case (e.g. even for black it is Nxg3, not nxg3)
            psan[san_cursor++] = piecename;

            // A disambiguation occurs if we have more then one piece of type 'pt'
            // that can reach 'to' with a legal move.
            others = b = (attacks_from(pc, to) & pieces_cp(us, pt)) ^ from;

            while (b)
            {
                Square s = pop_lsb(&b);

                if (!is_legal(pos, make_move(s, to)))
                    others ^= s;
            }

            if (!others)
            {   /* Disambiguation is not needed */
            }

            else if (!(others & file_bb(from)))
                psan[san_cursor++] = to_filechar(file_of(from));

            else if (!(others & rank_bb(from)))
                psan[san_cursor++] = to_rankchar(rank_of(from));

            else
            {
                psan[san_cursor++] = to_filechar(file_of(from));
                psan[san_cursor++] = to_rankchar(rank_of(from));
            }
        }
        else if (is_capture(pos,m))
            psan[san_cursor++] = to_filechar(file_of(from));

        if (is_capture(pos, m))
        {
            psan[san_cursor++] = 'x';
        }
        psan[san_cursor++] = to_filechar(file_of(to));
        psan[san_cursor++] = to_rankchar(rank_of(to));

        if (type_of_p(m) == PROMOTION)
        {
            char cpc = " pnbrqk"[promotion_type(m)];
            psan[san_cursor++] = '=';
            psan[san_cursor++] = toupper(cpc);;
        }
    }

    if (gives_check(pos, pos->st, m))
    {
        psan[san_cursor++] = '+';
        //StateInfo st;
        //pos->do_move(m, st, bGc);
        //san += MoveList<LEGAL>(pos->).size() ? "+" : "#";
        //pos->undo_move(m);
    }

    return san;
}

void print_pv(Pos *pos, Depth depth, Value alpha, Value beta)
{
	int elapsed = time_elapsed() + 1;
	RootMoves *rm = pos->rootMoves;
	int PVIdx = pos->PVIdx;
	int multiPV = min(option_value(OPT_MULTI_PV), rm->size);
	uint64_t nodes_searched = threads_nodes_searched();
	uint64_t tbhits = threads_tb_hits();
	char buf[16];

	for (int i = 0; i < multiPV; ++i) {
		int updated = (i <= PVIdx);

		if (depth == ONE_PLY && !updated)
			continue;

		Depth d = updated ? depth : depth - ONE_PLY;
		Value v = updated ? rm->move[i].score : rm->move[i].previousScore;

		int tb = TB_RootInTB && abs(v) < VALUE_MATE - MAX_PLY;
		if (tb) {
			int bound = option_value(OPT_SYZ_50_MOVE) ? 900 : 1;
			int rank = rm->move[i].TBRank;
			if (rank >= bound) v = VALUE_MATE - MAX_PLY - 1;
			else if (rank > 0) v = (max(3, rank - 800) * PawnValueEg) / 200;
			else if (rank == 0) v = VALUE_DRAW;
			else if (rank > -bound) v = (min(3, rank + 800) * PawnValueEg) / 200;
			else v = -VALUE_MATE + MAX_PLY + 1;
		}

		fprintf(gfile, "info depth %d seldepth %d multipv %d score %s",
			d / ONE_PLY, pos->maxPly, (int)i + 1, uci_value(buf, v));

		if (!tb && i == PVIdx)
			fprintf(gfile, "%s", v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");

		fprintf(gfile, " nodes %llu nps %llu", nodes_searched,
			nodes_searched * 1000 / elapsed);

		if (elapsed > 1000)
			fprintf(gfile, " hashfull %d", tt_hashfull());

		fprintf(gfile, " tbhits %llu  time %d pv", tbhits, elapsed);

		for (int idx = 0; idx < rm->move[i].pv_size; idx++)
		{
			char san[16] = { 0 };
			move_to_san(pos, rm->move[i].pv[idx], san);
			fprintf(gfile, " %s", san);
		}
		fprintf(gfile, "\n");
	}
	fflush(gfile);
}
With the following macros:

Code: Select all

#define to_filechar(n) (n - FILE_A + 'a')
#define to_rankchar(n) (n - RANK_1 + '1')
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: cfish logging?

Post by mhull »

Dann Corbit wrote:I actually took a crack at it, but I do not know the Cfish data structures well enough to create a correct representation of the data (IOW, my try did not work).

Code: Select all

#include <assert.h>
#include <string.h>
#include <ctype.h>

#include "bitboard.h"
#include "material.h"
#include "misc.h"
#include "movegen.h"
#include "pawns.h"
#include "position.h"
#include "uci.h"

#include "evaluate.h"
#include "movepick.h"
#include "search.h"
#include "timeman.h"
#include "tt.h"

extern char *PieceToChar;

const char * move_to_san(Pos * pos, Move m, char san[16]) {
    unsigned san_cursor = 0;

    if (m == MOVE_NULL)
        return "(null)";

    Bitboard others, b;
    //char san[16] = {0};
    char *psan = san;
    uint32_t us = pos->sideToMove;
    Square from = from_sq(m);
    Square to = to_sq(m);
    Piece pc = piece_on(from);
    int pt = type_of_p(pc);
    char piecename;
    if (type_of_p(m) == CASTLING)
        psan = to > from ? "O-O" : "O-O-O";
    else
    {
        if (pt != PAWN)
        {
        	  piecename = PieceToChar[pc]; 
        	  piecename = toupper(piecename);// Upper case (e.g. even for black it is Nxg3, not nxg3)
            psan[san_cursor++] = piecename;

            // A disambiguation occurs if we have more then one piece of type 'pt'
            // that can reach 'to' with a legal move.
            others = b = (attacks_from(pc, to) & pieces_cp(us, pt)) ^ from;

            while (b)
            {
                Square s = pop_lsb(&b);

                if (!is_legal(pos, make_move(s, to)))
                    others ^= s;
            }

            if (!others)
            {   /* Disambiguation is not needed */
            }

            else if (!(others & file_bb(from)))
                psan[san_cursor++] = to_filechar(file_of(from));

            else if (!(others & rank_bb(from)))
                psan[san_cursor++] = to_rankchar(rank_of(from));

            else
            {
                psan[san_cursor++] = to_filechar(file_of(from));
                psan[san_cursor++] = to_rankchar(rank_of(from));
            }
        }
        else if (is_capture(pos,m))
            psan[san_cursor++] = to_filechar(file_of(from));

        if (is_capture(pos, m))
        {
            psan[san_cursor++] = 'x';
        }
        psan[san_cursor++] = to_filechar(file_of(to));
        psan[san_cursor++] = to_rankchar(rank_of(to));

        if (type_of_p(m) == PROMOTION)
        {
            char cpc = " pnbrqk"[promotion_type(m)];
            psan[san_cursor++] = '=';
            psan[san_cursor++] = toupper(cpc);;
        }
    }

    if (gives_check(pos, pos->st, m))
    {
        psan[san_cursor++] = '+';
        //StateInfo st;
        //pos->do_move(m, st, bGc);
        //san += MoveList<LEGAL>(pos->).size() ? "+" : "#";
        //pos->undo_move(m);
    }

    return san;
}

void print_pv(Pos *pos, Depth depth, Value alpha, Value beta)
{
	int elapsed = time_elapsed() + 1;
	RootMoves *rm = pos->rootMoves;
	int PVIdx = pos->PVIdx;
	int multiPV = min(option_value(OPT_MULTI_PV), rm->size);
	uint64_t nodes_searched = threads_nodes_searched();
	uint64_t tbhits = threads_tb_hits();
	char buf[16];

	for (int i = 0; i < multiPV; ++i) {
		int updated = (i <= PVIdx);

		if (depth == ONE_PLY && !updated)
			continue;

		Depth d = updated ? depth : depth - ONE_PLY;
		Value v = updated ? rm->move[i].score : rm->move[i].previousScore;

		int tb = TB_RootInTB && abs(v) < VALUE_MATE - MAX_PLY;
		if (tb) {
			int bound = option_value(OPT_SYZ_50_MOVE) ? 900 : 1;
			int rank = rm->move[i].TBRank;
			if (rank >= bound) v = VALUE_MATE - MAX_PLY - 1;
			else if (rank > 0) v = (max(3, rank - 800) * PawnValueEg) / 200;
			else if (rank == 0) v = VALUE_DRAW;
			else if (rank > -bound) v = (min(3, rank + 800) * PawnValueEg) / 200;
			else v = -VALUE_MATE + MAX_PLY + 1;
		}

		fprintf(gfile, "info depth %d seldepth %d multipv %d score %s",
			d / ONE_PLY, pos->maxPly, (int)i + 1, uci_value(buf, v));

		if (!tb && i == PVIdx)
			fprintf(gfile, "%s", v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");

		fprintf(gfile, " nodes %llu nps %llu", nodes_searched,
			nodes_searched * 1000 / elapsed);

		if (elapsed > 1000)
			fprintf(gfile, " hashfull %d", tt_hashfull());

		fprintf(gfile, " tbhits %llu  time %d pv", tbhits, elapsed);

		for (int idx = 0; idx < rm->move[i].pv_size; idx++)
		{
			char san[16] = { 0 };
			move_to_san(pos, rm->move[i].pv[idx], san);
			fprintf(gfile, " %s", san);
		}
		fprintf(gfile, "\n");
	}
	fflush(gfile);
}
With the following macros:

Code: Select all

#define to_filechar(n) (n - FILE_A + 'a')
#define to_rankchar(n) (n - RANK_1 + '1')
Whoa, don't tell me you cranked that out just now!?

Getting this to work would be a great contribution to civilization.

As a workaround, I might use the linux script command to dump the all console activity to a log file, which would show the polyglot "tellall" kibs. But I would first need to cross-compile it (static build) for my vintage m68k machine and load it into the initramfs (ram disk for non-destructive linux boot under MacOS7).
Matthew Hull
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

mhull wrote:
Dann Corbit wrote:I actually took a crack at it, but I do not know the Cfish data structures well enough to create a correct representation of the data (IOW, my try did not work).

Code: Select all

#include <assert.h>
#include <string.h>
#include <ctype.h>

#include "bitboard.h"
#include "material.h"
#include "misc.h"
#include "movegen.h"
#include "pawns.h"
#include "position.h"
#include "uci.h"

#include "evaluate.h"
#include "movepick.h"
#include "search.h"
#include "timeman.h"
#include "tt.h"

extern char *PieceToChar;

const char * move_to_san(Pos * pos, Move m, char san[16]) {
    unsigned san_cursor = 0;

    if (m == MOVE_NULL)
        return "(null)";

    Bitboard others, b;
    //char san[16] = {0};
    char *psan = san;
    uint32_t us = pos->sideToMove;
    Square from = from_sq(m);
    Square to = to_sq(m);
    Piece pc = piece_on(from);
    int pt = type_of_p(pc);
    char piecename;
    if (type_of_p(m) == CASTLING)
        psan = to > from ? "O-O" : "O-O-O";
    else
    {
        if (pt != PAWN)
        {
        	  piecename = PieceToChar[pc]; 
        	  piecename = toupper(piecename);// Upper case (e.g. even for black it is Nxg3, not nxg3)
            psan[san_cursor++] = piecename;

            // A disambiguation occurs if we have more then one piece of type 'pt'
            // that can reach 'to' with a legal move.
            others = b = (attacks_from(pc, to) & pieces_cp(us, pt)) ^ from;

            while (b)
            {
                Square s = pop_lsb(&b);

                if (!is_legal(pos, make_move(s, to)))
                    others ^= s;
            }

            if (!others)
            {   /* Disambiguation is not needed */
            }

            else if (!(others & file_bb(from)))
                psan[san_cursor++] = to_filechar(file_of(from));

            else if (!(others & rank_bb(from)))
                psan[san_cursor++] = to_rankchar(rank_of(from));

            else
            {
                psan[san_cursor++] = to_filechar(file_of(from));
                psan[san_cursor++] = to_rankchar(rank_of(from));
            }
        }
        else if (is_capture(pos,m))
            psan[san_cursor++] = to_filechar(file_of(from));

        if (is_capture(pos, m))
        {
            psan[san_cursor++] = 'x';
        }
        psan[san_cursor++] = to_filechar(file_of(to));
        psan[san_cursor++] = to_rankchar(rank_of(to));

        if (type_of_p(m) == PROMOTION)
        {
            char cpc = " pnbrqk"[promotion_type(m)];
            psan[san_cursor++] = '=';
            psan[san_cursor++] = toupper(cpc);;
        }
    }

    if (gives_check(pos, pos->st, m))
    {
        psan[san_cursor++] = '+';
        //StateInfo st;
        //pos->do_move(m, st, bGc);
        //san += MoveList<LEGAL>(pos->).size() ? "+" : "#";
        //pos->undo_move(m);
    }

    return san;
}

void print_pv(Pos *pos, Depth depth, Value alpha, Value beta)
{
	int elapsed = time_elapsed() + 1;
	RootMoves *rm = pos->rootMoves;
	int PVIdx = pos->PVIdx;
	int multiPV = min(option_value(OPT_MULTI_PV), rm->size);
	uint64_t nodes_searched = threads_nodes_searched();
	uint64_t tbhits = threads_tb_hits();
	char buf[16];

	for (int i = 0; i < multiPV; ++i) {
		int updated = (i <= PVIdx);

		if (depth == ONE_PLY && !updated)
			continue;

		Depth d = updated ? depth : depth - ONE_PLY;
		Value v = updated ? rm->move[i].score : rm->move[i].previousScore;

		int tb = TB_RootInTB && abs(v) < VALUE_MATE - MAX_PLY;
		if (tb) {
			int bound = option_value(OPT_SYZ_50_MOVE) ? 900 : 1;
			int rank = rm->move[i].TBRank;
			if (rank >= bound) v = VALUE_MATE - MAX_PLY - 1;
			else if (rank > 0) v = (max(3, rank - 800) * PawnValueEg) / 200;
			else if (rank == 0) v = VALUE_DRAW;
			else if (rank > -bound) v = (min(3, rank + 800) * PawnValueEg) / 200;
			else v = -VALUE_MATE + MAX_PLY + 1;
		}

		fprintf(gfile, "info depth %d seldepth %d multipv %d score %s",
			d / ONE_PLY, pos->maxPly, (int)i + 1, uci_value(buf, v));

		if (!tb && i == PVIdx)
			fprintf(gfile, "%s", v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");

		fprintf(gfile, " nodes %llu nps %llu", nodes_searched,
			nodes_searched * 1000 / elapsed);

		if (elapsed > 1000)
			fprintf(gfile, " hashfull %d", tt_hashfull());

		fprintf(gfile, " tbhits %llu  time %d pv", tbhits, elapsed);

		for (int idx = 0; idx < rm->move[i].pv_size; idx++)
		{
			char san[16] = { 0 };
			move_to_san(pos, rm->move[i].pv[idx], san);
			fprintf(gfile, " %s", san);
		}
		fprintf(gfile, "\n");
	}
	fflush(gfile);
}
With the following macros:

Code: Select all

#define to_filechar(n) (n - FILE_A + 'a')
#define to_rankchar(n) (n - RANK_1 + '1')
Whoa, don't tell me you cranked that out just now!?
It's impressive until you see that I was just trying to write a C version of this C++ code that works properly with Stockfish:

Code: Select all

/*
  Stockfish, a UCI chess playing engine derived from Glaurung 2.1
  Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
  Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad

  Stockfish is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  Stockfish is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <cassert>
#include <iomanip>
#include <sstream>
#include <stack>

#include "movegen.h"
#include "notation.h"
#include "position.h"

using namespace std;

static const char* PieceToChar[COLOR_NB] = { " PNBRQK", " pnbrqk" };

/// move_to_san() takes a position and a legal Move as input and returns its
/// short algebraic notation representation.

const string move_to_san(const Position& pos, Move m) {

    if (m == MOVE_NONE)
        return "(none)";

    if (m == MOVE_NULL)
        return "(null)";


//   assert(MoveList<LEGAL>(pos).contains(m));

    Bitboard others, b;
    string san;
    Color us = pos.side_to_move();
    Square from = from_sq(m);
    Square to = to_sq(m);
    Piece pc = pos.piece_on(from);
    PieceType pt = type_of(pc);

    if (type_of(m) == CASTLING)
        san = to > from ? "O-O" : "O-O-O";
    else
    {
        if (pt != PAWN)
        {
            san = PieceToChar[WHITE][pt]; // Upper case

            // A disambiguation occurs if we have more then one piece of type 'pt'
            // that can reach 'to' with a legal move.
            others = b = (pos.attacks_from(pc, to) & pos.pieces(us, pt)) ^ from;

            while (b)
            {
                Square s = pop_lsb(&b);
                if (!pos.legal(make_move(s, to)))
                    others ^= s;
            }

            if (!others)
            {   /* Disambiguation is not needed */
            }

            else if (!(others & file_bb(from)))
                san += to_char(file_of(from));

            else if (!(others & rank_bb(from)))
                san += to_char(rank_of(from));

            else
                san += to_string(from);
        }
        else if (pos.capture(m))
            san = to_char(file_of(from));

        if (pos.capture(m))
            san += 'x';

        san += to_string(to);

        if (type_of(m) == PROMOTION)
            san += string("=") + PieceToChar[WHITE][promotion_type(m)];
    }

    bool bGc = pos.gives_check(m);
    if (bGc)
    {
        san += "+";
        //StateInfo st;
        //pos.do_move(m, st, bGc);
        //san += MoveList<LEGAL>(pos).size() ? "+" : "#";
        //pos.undo_move(m);
    }

    return san;
}


/// pretty_pv() formats human-readable search information, typically to be
/// appended to the search log file. It uses the two helpers below to pretty
/// format the time and score respectively.

static string format(int64_t msecs) {

    const int MSecMinute = 1000 * 60;
    const int MSecHour   = 1000 * 60 * 60;

    int64_t hours   =   msecs / MSecHour;
    int64_t minutes =  (msecs % MSecHour) / MSecMinute;
    int64_t seconds = ((msecs % MSecHour) % MSecMinute) / 1000;

    stringstream ss;

    if (hours)
        ss << hours << ':';

    ss << setfill('0') << setw(2) << minutes << ':' << setw(2) << seconds;

    return ss.str();
}

static string format(Value v) {

    stringstream ss;

    if (v >= VALUE_MATE_IN_MAX_PLY)
        ss << "#" << (VALUE_MATE - v + 1) / 2;

    else if (v <= VALUE_MATED_IN_MAX_PLY)
        ss << "-#" << (VALUE_MATE + v) / 2;

    else
        ss << setprecision(2) << fixed << showpos << double(v) / PawnValueEg;

    return ss.str();
}

string pretty_pv(Position& pos, int depth, Value value, int64_t msecs) {

    const uint64_t K = 1000;
    const uint64_t M = 1000000;

    std::stack<StateInfo> st;
    string san, str, padding;
    stringstream ss;

    ss << setw(2) << depth << setw(8) << format(value) << setw(8) << format(msecs);

    if (pos.nodes_searched() < M)
        ss << setw(8) << pos.nodes_searched() / 1 << "  ";

    else if (pos.nodes_searched() < K * M)
        ss << setw(7) << pos.nodes_searched() / K << "K  ";

    else
        ss << setw(7) << pos.nodes_searched() / M << "M  ";

    str = ss.str();

    return str;
}
Getting this to work would be a great contribution to civilization.

As a workaround, I might use the linux script command to dump the all console activity to a log file, which would show the polyglot "tellall" kibs. But I would first need to cross-compile it (static build) for my vintage m68k machine and load it into the initramfs (ram disk for non-destructive linux boot under MacOS7).
[/code]
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: cfish logging?

Post by MikeB »

Dann I'm interested in the c++ version - how does it work and how is it enabled in SF? Will it work in engine vs engine play?

Thanks,

Mike
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

MikeB wrote:Dann I'm interested in the c++ version - how does it work and how is it enabled in SF? Will it work in engine vs engine play?

Thanks,

Mike
I have created my own UCI option to record the analysis to disk.

I need this so that I can accurately parse the records and store them in a SQL Server database.

Any other method (such as reading logs of programs like Arena or Shredder or Chess Assistant) and combining the analysis with the records is fraught with peril. For some reason, all of these methods occasionally get disconnected from the correct synchronization and I get bad data.

So the only thing I really trust is my own output to disk. I can make sure that the write operations are not buffered and also that the analysis is coupled to the correct record without having to stitch things together.

I simply modified the old Glaurung code so that it works with the current version of Stockfish.

Unfortunately, it only works with Stockfish and not with ASMFish or CFish.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

I should mention that I keep it in synchronization with the current version of stockfish with a diff engine (and a little hand editing, as needed).
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

Dann Corbit wrote:I should mention that I keep it in synchronization with the current version of stockfish with a diff engine (and a little hand editing, as needed).
Also, it is standard C++, so it should compile fine for Mac or Solaris or Android or whatever.

Might not be a good idea on Android, since they typically do not have a lot of space and I have logging turned on by default.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: cfish logging?

Post by Dann Corbit »

For each position, the analysis looks like this:

Code: Select all

Searching: 2r4k/3np1bp/p1q3p1/P2np3/N1pp2PP/5P2/1P2PB2/R2Q1RK1 w - - 0 1
infinite: 0 ponder: 0 time: 0 increment: 0 moves to go: 0

 1   -0.40   00:00      38  b3 
 2   -0.86   00:00      89  e3 dxe3 Bg3 
 3   -1.06   00:00     169  Kh1 Rb8 Rc1 
 4   -1.02   00:00     248  Nb6 N7xb6 axb6 Qxb6 
 5   -0.76   00:00     673  g5 Nf4 Bg3 Ne6 Ra2 
 6   -1.07   00:00     883  e3 dxe3 Bg3 Nf4 Bxf4 exf4 
 7   -1.08   00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4 Qxb6 e3 Nd3 exd4 exd4 Bg3 Nxb2 gxh5 gxh5 Kh2 Nd3 Qxe7 Qb5 Qe4 Rf8 Rfb1 Qf5 Rxa6 Qxe4 fxe4 c3 Rc6 Ne5 Rc5 Ng4+ Kh3 Kg8 Bd6 Re8 e5 Nxe5 Bxe5 Bxe5 Rd1 Kf7 Kg2 Re6 Kf3 Kg6 Rc8 
31   -0.46   02:50 113799K  Qc2 h5 Nb6 N7xb6 axb6 Nf4 Qe4 Qxb6 e3 Nd3 exd4 exd4 Bg3 Nxb2 gxh5 gxh5 Kh2 Nd3 Qxe7 Qb5 Qe4 Rf8 Rfb1 Qf5 Rxa6 Qxe4 fxe4 c3 Rc6 Ne5 Rc5 Ng4+ Kh3 Kg8 Bd6 Re8 e5 Nxe5 Bxe5 Bxe5 Rd1 Kf7 Kg2 Re6 Kf3 Kg6 Rc8 
Nodes: 113799637
Nodes/second: 669389
Best move: Qc2
Ponder move: h5
The NPS is always wrong. I think it is being reported for one thread, but I don't care about it, so I never try to fix it.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.