4 ms·
Unfortunately this program doesn't play legal chess. When I played the program it did not move its king out of attack when checked. And yes, I've played enough
by slm_HN 12y ago
Unfortunately this program doesn't play legal chess. When I played the program it did not move its king out of attack when checked. And yes, I've played enough chess to know an illegal move when I see one.
- ionforce 12y ago> And yes, I've played enough chess to know an illegal move when I see one. It's not like Chess is some weird, esoteric game where there is a gray area of whether or not moves are legal or not. Maybe I'm biased. I'm currently working on a toy chess engine myself.
- slm_HN 12y ago>It's not like Chess is some weird, esoteric game where there is a gray area of whether or not moves are legal or not. Actually it is exactly like that. If you play tournament chess, like USCF tournaments, then there's no doubt what the rules are. However if you play casual chess, like with some random guy in the park, then be prepared for some misunderstandings. Some things casual players think are rules: Pawns move two squares only on the first move of the *game* not the first move of the pawn You can't promote a pawn the move after it arrives on the 7th rank, you have to wait a move Perpetual check is illegal (somewhat like the Ko rule in go) Capturing En Passant is generally not known So when I'm playing a stranger I always ask if they've played any tournaments, not to gauge how strong they are, but to see if they'll know the rules of chess.
- Buttons840 12y agoI haven't played in any chess tournaments, but I started doing this myself after my cousin captured my bishop with an en passant. The game was ruined by the ensuing argument...
- SeanDav 12y agoYou can only capture a pawn En passant and only if the pawn moves 2 squares in 1 go.
- gamegoblin 12y agoPerhaps an en passant lead to a position in which the bishop could not avoid being captured. If not, OPs cousin is indeed wrong.
- Buttons840 12y agoYeah, my cousin thought if his pawn was on the 5th row he could capture any piece next to it by performing an "en passant". Of course, it wasn't a proper en passant, but the way he moved his pawn was the same, it's just he was capturing a bishop instead of another pawn.
- true_religion 12y ago> Capturing En Passant I actually did not know this one, and I thought I played enough Chess to know all the rules.
- Tloewald 12y agoI've known the rule since i was a kid, but i've never seen it in an actual game.
- gamegoblin 12y agoEn passant is a bit funny in that, once you learn it, it's tempting to use it when it would actually be better not to. When I played tournaments in high school, most players knew about it, but most players were still quite amateur, so one could offer up a position in which the opponent could perform an en passant, but the en passant was actually fairly detrimental, and more often than not the opponent will take it, because "hey cool I can do that weird pawn move".
- girvo 12y agoOh good, I'm glad I'm not the only one who did that in tournaments when I was in school!
- nebulous1 12y agoYeah, but it isn't a grey area, the rules are well defined and actually pretty easy to understand. I've had people not know the rules before, but they wouldn't call themselves experienced.
- baddox 12y agoI don't know if I would consider people being blatantly ignorant of the rules evidence that the rules are a "grey area." I learned how pieces move and capture from a children's book in third grade, and I distinctly remember it covering those rules, except for the third, which I have never heard of. As far as I know, these rules are extremely standardized in most or all areas of the world where chess is known. I have heard about some special rules for competitions that can differ, like timing limitations and end-game rules. I'm also aware of many variations of chess, but those are always clearly discussed as variants.
- ketralnis 12y ago> Pawns move two squares only on the first move of the game not the first move of the pawn Can you elaborate on this? I've never seen any claim to this effect, only that a pawn on its starting rank has the option of moving two squares (but cannot use that to jump over or capture a piece) (e.g. as stated http://en.wikipedia.org/wiki/Pawn_(chess) http://en.wikipedia.org/wiki/Pawn_(chess)). Are these different claims or am I misunderstanding? > You can't promote a pawn the move after it arrives on the 7th rank, you have to wait a move Same here. "The new piece replaces the pawn on the same square, as part of the same move" (e.g. http://en.wikipedia.org/wiki/Promotion_(chess) http://en.wikipedia.org/wiki/Promotion_(chess)) I'm only showing wikipedia cites to indicate that if these are wrong they are widely spread, and hoping that you have better cites.
- SeanDav 12y agoHe was demonstrating a misconception. The truth is pawns can move 2 squares on their first move at any point in the game.
- datashaman 12y agoNot understanding the rules of something, doesn't make the rules a 'gray area'. That makes the understanding a gray area. The rules are very explicit.
- gamegoblin 12y agoAs an experienced chess player, there are some situations in which people who know the rules still might get tripped up on. For example, consider the situation: K R r _ _ _ k _ _ Can `k` move to the right? Someone who isn't familiar with this situation might think so, because `R` is pinned to `K` by `r`, but it turns out that even though `R` can't move to the square right of `k`, `R` can still give check to it, so the move would be illegal. Then you also get people who don't know about rules regarding castling through check, etc. Basically what I'm getting at is, there are moves that even people who casually play chess might misunderstand, so OP was implying that they were not one of these people.
- ionforce 12y agoSorry, could you describe what the colors and pieces are? I'm unclear as to what you are illustrating. Edit: Thanks for the clarifications. lowercase = one color, uppercase = other color. K = king, R = rook The question is... does the rook R still provide attack/check even though it is pinned by rook r to King K? The answer is yes.
- nebulous1 12y agoI think he's saying there are two kings and two rooks, one color in capitals and the other in lower case. His situation is correct, however I don't think any experienced chess player would not know that.
- gamegoblin 12y agoI use that example specifically because it came up on /r/chess the other day, and I've had newer players ask me once or twice. I agree that an experienced player should know, but casual players may not.
- gamegoblin 12y agoLowercase and capitals, just like the python program in the post uses.
- 12y ago
- erikb 12y agoThis is a clear bug. I bet the author would appreciate if you open a ticket on the project page.
- Houshalter 12y agoDoesn't that just mean that you win? Why is it important that it's not legal?
- superuser2 12y agoNo. While in check, the only legal moves are those that take you out of check. It is checkmate (and you lose) if and only if there is no legal move that would take you out of check. Also, a move that would place yourself in check is never legal.
- Houshalter 12y agoYes I understand that. But why is it an issue, can't you just take his king in the next move? Either way he's forfeit the game.
- superuser2 12y agoHe is required to make a move that takes him out of check. If he tries to make some other move, you inform him that it's illegal and roll it back. Also you never actually take the king, you just get the point where you could and it has no escape.
- Newky 12y agoReporting a bug, or a pull request with a failing test would help the author no doubt. It would also add some credence to your argument which lacks any reproduction details.
- thomasahle 12y agoAuthor here. I'm sorry things are not working out. I'd be very interested if you could open a report with the position involved. Sunfish move generation is tested pretty thoroughly, generating tens of millions of positions and comparing with other engines. But of course it's still young and glitches may happen :)