Skip to content

Index retourné pour le roi #2

@lilireli

Description

@lilireli

Bonjour,

Merci beaucoup pour le livre, très riche en explications.

J'ai cependant un doute sur la fonction findKing qui est censée renvoyer un index mais qui d'après le code renvoie un boolean à travers le return true ?

size_t findKing(ChessBoard const & board, Color color){
    assert(color == colorBlack || color == colorWhite );
    KingIdentifier identifier(color);
    for(size_t index = 0; index < 64; ++index){
        if(identifier.check(board.pieceAt(index))){
            return true;
        }
    }
    /* Nous ne devrions jamais arriver ici, mais sait-on
     * jamais ...
     */
    assert(!"no king found, what did you do?");
    return 64;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions