hasPlayerWon function
Returns true if playerIndex's own 4 pieces have all finished.
Implementation
bool hasPlayerWon(List<LudoPiece> pieces, int playerIndex) {
return pieces
.where((p) => p.playerIndex == playerIndex)
.every((p) => p.isFinished);
}