uci communication with Fritz

Discussion of chess software programming and technical issues.

Moderator: Ras

Carbec
Posts: 162
Joined: Thu Jan 20, 2022 9:42 am
Location: France
Full name: Philippe Chevalier

uci communication with Fritz

Post by Carbec »

hello,

When I want to start a game, I send this :

Code: Select all

    // print engine info
    std::cout << "id name Zangdar " << VERSION << std::endl;
    std::cout << "id author Philippe Chevalier" << std::endl;
    std::cout << "uciok" << std::endl;
This works well with arena, but not with fritz. In the latter case, on the author name is displayed.
I tried to replace std::endl with "\n", with no effect.

Any idea ?
User avatar
phhnguyen
Posts: 1524
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: uci communication with Fritz

Post by phhnguyen »

Do you mean the GUI is missing showing the first line from your engine?

I don't have a Fritz, but from my experience, some chess GUIs start processing engine output a bit late, causing the loss of some first few lines.

You may:
- ignore that since it is not a big deal
- delay starting sending information out for a short period (a few milliseconds or a second)
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
Carbec
Posts: 162
Joined: Thu Jan 20, 2022 9:42 am
Location: France
Full name: Philippe Chevalier

Re: uci communication with Fritz

Post by Carbec »

Hello,

No, the module don't load at all. Fritz stays at the window that define a module.
The author name is ok, but there is nothing in the program name.
If I click "validate", nothing happens.
This the code I use. I looked at other engines, and I think i did ok.

Code: Select all

void Uci::run()
{
    std::string token;
    std::string line;

    Search* search = new Search();

    // print engine info
    std::cout << "id name Zangdar " << VERSION << std::endl;
    std::cout << "id author Philippe Chevalier" << std::endl;
    std::cout << "uciok" << std::endl;

    // main loop
    while(getline(std::cin, line))
    {
        std::istringstream is(line);

        token.clear();
        is >> std::skipws >> token;

        //-------------------------------------------- gui -> engine

        if (token == "uci")
        {
            // print engine info
            std::cout << "id name Zangdar " << VERSION << std::endl;
            std::cout << "id author Philippe Chevalier" << std::endl;
            std::cout << "uciok" << std::endl;
        }
        else if (token == "isready")
        {
            // synchronize the engine with the GUI
            std::cout << "readyok" << std::endl;
            continue;
        }
        else if (token == "position")
        {
            // set up the position described in fenstring
            search->position(is);
        }
        else if (token == "ucinewgame")
        {
            // the next search (started with "position" and "go") will be from
            // a different game.
            search->new_game();
        }
...
Carbec
Posts: 162
Joined: Thu Jan 20, 2022 9:42 am
Location: France
Full name: Philippe Chevalier

Re: uci communication with Fritz

Post by Carbec »

Hello,

Here the answer for anyone that have the same problem.
My engine works in 2 modes : cli and uci. The first thing I did was to ask which command the user wanted.
So when I launched my program with Fritz, it received a string like : "What do you want ?".
Not an uci command !! I corrected this behaviour, and it works now.
Thanks to Arena, that show all messages.