Comments (14)
It's generally not feasible to prevent all illegal (as in proof-game solving) positions. So instead, we allow all positions that meet very basic validity requirements. There are interesting positions among those, so that's nice. This is the status quo, and now also required for backwards compatibility.
Now a tricky problem: Stockfish, on paper, assumes strict legality, and does not care what happens if it is asked to analyse/play a position that violates this (producing illegal moves, bad evals, crashes, UB). So can we safely pass a given position to current and future Stockfish versions? Not feasible to answer.
Instead, we checked the currently used implementation(s) of Stockfish for the assumptions it currently actually makes. This leads to the following (somewhat arbitrary looking) criteria for valid checks, as implemented in https://docs.rs/shakmaty/0.25.0/src/shakmaty/position.rs.html#2906-2937:
- There can be at most two checkers
- If the last move was a two-step pawn advance, as indicated by the en passant square, then the pushed pawn must be the only checker, or it has uncovered check by a single sliding piece
- Multiple checkers cannot be aligned on the same file/rank/diagonal
It seems likely that these criteria are pretty stable.
They should be implemented in scalachess, too. I think the proper place is the strict validation of
scalachess/src/main/scala/Situation.scala
Line 53 in 34bd38d
Related: lichess-org/lila#9817
from scalachess.
This is client-side validation from https://github.com/niklasf/chessops. When we're done here we should review it all for consistency.
from scalachess.
I think you can tick off anti chess because there are no checks at all.
from scalachess.
Is this closable?
from scalachess.
What's the purpose of supporting illegal checks?
from scalachess.
Is this feature expected for standard chess only?
from scalachess.
We should implement this for all variants (one by one). And the most important one is standard.
from scalachess.
Since the goal of this issue is to make situation validation compatible with stockfish, do we need to implement it for the other variants like AntiChess? As I understand, stockfish only evaluates standard chess position or assumes the position it receives is for standard chess.
from scalachess.
We use fairy stockfish for variants. So it would be nice to have those validation as well.
But they can be different from Standard. Not sure Shakmaty, implement those or not. If it does, we can just port from it :D
from scalachess.
Also, I think the logic for standard can be reused for crazy house.
from scalachess.
Also for Horde, I think the standard rule should also work. If the variant already has validation to make sure that white does not have a king, then we can just check if the standard rule for impossible checks is violated for the black king. The double pawn push from the first rank does not count as an en passant.
from scalachess.
Yeah, I think you're right, that makes only Atomic (as always) left.
from scalachess.
I read the rules for Atomic chess, and as I understand it, the rules do not change for checks, the only different rules from standard are related to captures and king being side by side. Technically, the standard logic for impossible checks should work too.
OOPS: When the kings are connected, checks do not apply.
from scalachess.
I noticed that there is already some validation for some these impossible check positions. For example I cannot continue playing this game or analyse it in horde chess. How does Lila do this validation if its not from scala chess?
https://lichess.org/editor/5r2/8/4k2R/8/3pP3/8/PPPP1PPP/2PPPPP1_b_-_e3_0_1?variant=horde&color=whitefrom scalachess.
Related Issues (20)
- test failures (ForsythTest, HashTest)
- Fix En Passant in Horde for pawns in rank 1 HOT 1
- Use Scalacheck for testing pgn parser HOT 4
- Reject pgn files that have invalid tags format HOT 1
- PGN cleanup may break comments HOT 1
- Master doesn't currently compile HOT 2
- variant: DFRC HOT 1
- timeout vs insufficient material in NvN antichess HOT 1
- Publish in a sbt repository HOT 1
- Expose situationAfter via MoveOrDrop HOT 5
- Rename `Pos` to `Square` HOT 2
- Migrate specs2 to munit HOT 3
- How do I get started? HOT 3
- Consider if we should stop using `TotalWrapper` for `OpaqueBitboard` for performance gain HOT 3
- rename `OpeningFen`
- Regression with regard to castling rights of inner rooks HOT 3
- Make all endgame drills same color HOT 1
- Generalize Pgn
- Export `Node[A]` or chess tree to different format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalachess.