GithubHelp home page GithubHelp logo

Comments (4)

sshivaji avatar sshivaji commented on May 22, 2024

Never mind, looks like calling status() after setting fen does the trick, might be worth making this happen by default

from python-chess.

niklasf avatar niklasf commented on May 22, 2024

Yeah, error handling can sometimes be a difficult thing to get right.

It was easier not to automatically check the status after set_fen, because then it is very simple to keep the guarantee, that set_fen does not leave the board in a half updated state.

For example:

board = chess.Bitboard()
try:
    board.set_fen("syntactically-invalid-fen")
except:
    # Now the board is guaranteed to not have changed
    pass

I'll keep this issue to look into this again sometime.

from python-chess.

sshivaji avatar sshivaji commented on May 22, 2024

I also like that set_fen allows you to setup a position partially (useful
for doing setup board). Maybe a separate process_fen(fen) method might be
useful. This method can throw exceptions if there is something wrong.

This method might be eaiser than set_fen and then checking status() for any
problems.

On Mon, Nov 24, 2014 at 8:43 AM, Niklas Fiekas [email protected]
wrote:

Yeah, error handling can sometimes be a difficult thing to get right.

It was easier not to automatically check the status after set_fen, because
then it is very simple to keep the guarantee, that set_fen does not leave
the board in a half updated state.

For example:

board = chess.Bitboard()
try:
board.set_fen("invalid-fen")
except:
# Now the board is guaranteed to not have changed
pass

I'll keep this issue to look into this again sometime.


Reply to this email directly or view it on GitHub
#16 (comment).

from python-chess.

sshivaji avatar sshivaji commented on May 22, 2024

Will close issue as there are more important things to address

from python-chess.

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.