Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index retourné pour le roi #2

Open
lilireli opened this issue Aug 24, 2016 · 0 comments
Open

Index retourné pour le roi #2

lilireli opened this issue Aug 24, 2016 · 0 comments

Comments

@lilireli
Copy link

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant