I just checked the Lichess board editor tool and it won’t let you continue analyzing with an engine if you have an illegal board setup (like the two kings adjacent to each other).
I haven’t tried this yet, but I think you can set up and analyze board positions that are legal but that could never be reached in a real game (e.g, having nine pawns of one color).
Oh, I was thinking board positions that could never be reached in a real game. Actually, I have no idea what the technical definition of a legal board state is, haha.
Well, there are chess problems that are specifically composed so that a solver can work out the right moves to achieve checkmate. For a lot of these composed chess positions, it’s virtually impossible for to get them in a real game but that’s not the point. Engines can analyze these but they can get tripped up depending on how the problem was designed.[1] The legality of the board state seems like a different concept. An engine can’t be used to analyze a position of where the Black king is in check and it is White’s turn to move. It doesn’t matter if you got to that board state by composing it or by making a sequence of previously legal moves.
[1]: https://chess.stackexchange.com/questions/23837/solvable-stu...