Skip to content

Double pawn moves are considered captures by Move.is_capture() #26

@SloPro

Description

@SloPro
#include <iostream>
#include "position.h"
using namespace std;

int main()
{
    initialise_all_databases();
    zobrist::initialise_zobrist_keys();

    Position pos;
    Position::set(DEFAULT_FEN, pos);
    cout << pos << endl;

    MoveList<WHITE> moves(pos);
    for (const auto &m : moves)
    {
        cout << "     " << m << " iscapture: " << m.is_capture() << " flags: " << m.flags() << endl;
    }

    return 0;
}

Generates the following:

...
     f2f3 iscapture: 0 flags: 0
     g2g3 iscapture: 0 flags: 0
     h2h3 iscapture: 0 flags: 0
     a2a4 iscapture: 1 flags: 1
     b2b4 iscapture: 1 flags: 1
     c2c4 iscapture: 1 flags: 1
     d2d4 iscapture: 1 flags: 1
     e2e4 iscapture: 1 flags: 1
     f2f4 iscapture: 1 flags: 1
     g2g4 iscapture: 1 flags: 1
     h2h4 iscapture: 1 flags: 1

As you can see, move.is_capture() returns true for double pawn moves despite the flag being correctly set to MoveFlags::DOUBLE_PUSH (= 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions