gideonlouw
gideonlouw

Reputation: 427

chessboardjs how to set black to move first?

I'm using the chessboardjs JavaScript library. I load the position with the following code:

var board = new ChessBoard('board');
board.start(false);
var currentPosition = FENSTRING; //'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R';
board.position(currentPosition, false);

Now I want black to move first. How can I do this ? I read all the documentation on http://www.chessboardjs.com and can not find a way to tell the board so black must move first.

Upvotes: 2

Views: 368

Answers (2)

Chris Oakman
Chris Oakman

Reputation: 318

chessboardjs is "just a board" and has no knowledge of the game of chess. ie: who's turn it is, what moves are legal, etc

(disclaimer: I am the author of chessboardjs)

Upvotes: 2

Amit Joki
Amit Joki

Reputation: 59242

That's against the very rule of the game, Chess. Only white makes the first move, and that is how it should be, because that's how it is designed to be.

Black never makes the first move.

You could however alter the images of the pieces as it is how they're managed in the link you've given, and try to make it look like Black is making the first move.

Upvotes: 0

Related Questions