GithubHelp home page GithubHelp logo

Comments (14)

niklasf avatar niklasf commented on June 12, 2024 3

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

def playable(strict: Boolean): Boolean =

Related: lichess-org/lila#9817

from scalachess.

niklasf avatar niklasf commented on June 12, 2024 2

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.

Oziomajnr avatar Oziomajnr commented on June 12, 2024 1

I think you can tick off anti chess because there are no checks at all.

from scalachess.

Oziomajnr avatar Oziomajnr commented on June 12, 2024 1

Is this closable?

from scalachess.

ErdoganSeref avatar ErdoganSeref commented on June 12, 2024

What's the purpose of supporting illegal checks?

from scalachess.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

Is this feature expected for standard chess only?

from scalachess.

lenguyenthanh avatar lenguyenthanh commented on June 12, 2024

We should implement this for all variants (one by one). And the most important one is standard.

from scalachess.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

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.

lenguyenthanh avatar lenguyenthanh commented on June 12, 2024

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.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

Also, I think the logic for standard can be reused for crazy house.

from scalachess.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

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.

lenguyenthanh avatar lenguyenthanh commented on June 12, 2024

Yeah, I think you're right, that makes only Atomic (as always) left.

from scalachess.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

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.

Oziomajnr avatar Oziomajnr commented on June 12, 2024

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?

image https://lichess.org/editor/5r2/8/4k2R/8/3pP3/8/PPPP1PPP/2PPPPP1_b_-_e3_0_1?variant=horde&color=white

from scalachess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.