Java Chess Programming Video #19 The Player (Part III)

preview_player
Показать описание

Chess Code Repository :

IDE:

Reading Material:
Рекомендации по теме
Комментарии
Автор

This project is definitely going to be the star project on my resume. Thanks for such wonderful content!!

chinmaysoni
Автор

Really it's a great tutorial. Thanks for your work!!

jefalcon
Автор

If the King is in check and doesnt have escape moves, he can still be covered by a friendly piece from check.

НиколайБеляков-шл
Автор

I understand the purpose of isInCheck method, but why would you construct the player every time and pass it all in. Constructor is just once for player, and then it is Game class which checks some kind of state. Otherwise isInCheck method itself in Player class can do this logic if you like, or Game or Board class could calculate this.

renarsdilevka
Автор

king might not have a legal escape move but other pieces can guard the chack and save the day. so i think the checkmate ligic here is kinda faulty. hoping it will be noticed the next videos in the playlist.

krinjon
Автор

Yes but stale mate is when you can only move the king as only piece either other pieces are blocked or you have only king on the board and in same time you are under attack in any of king moves. So calling hasEscapeMoves method on Player when his king is not under a check, in my opinion, does not make a lot of sense.

renarsdilevka
Автор

Yes, you are right, we can not have a boolean isInCheckMate field, but we can have a Boolean hasEscapeMoves field, so we don't have to calculate it all the time:
protected Boolean hasEscapeMoves; // null
...
private boolean hasEscapeMoves() {
if (hasEscapeMoves != null) {
return hasEscapeMoves;
}
for (Move move : this.legalMoves) {
if {
return hasEscapeMoves = true;
}
}
return hasEscapeMoves = false;
}

lajos-berenyi
Автор

if i watch your videos till 28 will it be sufficient to play chess on compiler window

dheerajagrawal
Автор

I can't understand the MoveTransition class.. what does it do please? :(

m_r.o