I am building a chess GUI, which is supposed to talk to Stockfish. I have heard that I have to generate a FEN-string, to tell Stockfish about the move that has been made. So the question is, how do I do this? I have really met a dead end here.. I am using the Eclipse IDE.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I am not sure what you have done or in what programming language, but since you are using the Eclipse IDE, I'm suggesting it is Java.
A hot tips for making the Stockfish to work is by looking at this video: https://www.youtube.com/watch?list=PLQV5mozTHmacMeRzJCW_8K3qw2miYqd0c&v=vuvTFNreykk
The Stackoverflow linked in the video: Using the Universal Chess Interface
So to tackle your question:
Well, the simple solution would be to look for already implemented projects making FEN-strings. I know there are a lot of them. If you want a simple, yet clumsy way of making a FEN-string in Java I made you this:
Note: This implementation believes that you have your entire board in a String[][] (I didn't make the trouble making it more advanced at these late hours)
Note 2: It does not make the entire FEN-string. It is missing the Active color, Castling availability, En passant, Halfmove clock and the Fullmove number, but I'm sure you will be able to implement that easily
Output:
I don't want to repeat my answers. Please review what I had posted: