Comments (9)
Thank you. I'll fix it soon.
from stockfish.
I tried your example:
wrong_fen = '3kk3/8/8/8/8/8/8/3KK3 w - - 0 0'
s = Stockfish()
print('stockfish created')
s.set_fen_position(wrong_fen)
print('board position set')
move = s.get_best_move()
print('best move is {}'.format(move))
Output:
stockfish created
board position set
best move is d1c1
But even more problematic is that the call get_best_move doesn't return at all
I can't confirm it
from stockfish.
I guess we got different behaviors because we are on different systems. I am on Fedora 32, using Stockfish 10 and Python 3.8.
Anyway, in your case you got a "best move" in return, but I think there should be some exception instead, because the board has 4 kings, hence it is an impossible position.
from stockfish.
Anyway, in your case you got a "best move" in return, but I think there should be some exception instead, because the board has 4 kings, hence it is an impossible position.
but stockfish engine returns best move, doesn't it?
from stockfish.
In my case it doesn't return anything and it hangs forever.
If in your case it returned a move, I don't understand how that would be correct, since there is a forbidden position on the board.
from stockfish.
Is this test case correct?
from stockfish.
I admit I am no expert in chess engines.
However it seems inappropriate to me to expect a move like "d1e2" given a wrong board position. In my opinion, it would be more appropriate if an exception was raised when attempting to set a wrong position.
from stockfish.
an exception was raised when attempting to set a wrong position
This package is not chess engine, it's only the wrapper for stockfish chess engine
If stockfish dont rise an excpetion for wrong position, I think we should not do it also.
from stockfish.
I understand this is a wrapper. Chess engines generally communicate to the user through the UCI, hence they cannot raise exceptions. This wrapper communicates to its users through python, so it would be possible to raise an exception. I understand this is a design choice and you are free to make your own decision.
from stockfish.
Related Issues (20)
- Option to get board visual from either side HOT 2
- FR - Include chess notation entry HOT 2
- FR - Translate move string to human readable description of the move HOT 1
- top_moves returning empty list stockfish 15 HOT 2
- Improving some small things about self.depth HOT 1
- Stockfish 15 Errors on Linux HOT 4
- could use help implementing this HOT 2
- Jupyter Notebook HOT 2
- Improve the is_fen_valid function HOT 1
- Get best move from current position HOT 1
- Compatibility with chess library HOT 2
- [Meta] The future of this project (Please read this before opening new issues or PRs)
- can't use stockfish_mv in google colab HOT 1
- get_evaluation() implemented wrong HOT 2
- Error in stockfish\models.py in __del__, _put HOT 2
- does_current_engine_version_have_wdl_option() not work on stockfish variant
- stockfish derivatives not work when analyze pgn HOT 16
- take longer time compare with chess module HOT 5
- Stockfish crashes on invalid position instead of error mesasge HOT 5
- will_move_be_a_capture throws exeption when converting pawn
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 stockfish.