Hi, first time poster.
This is about getting an opening name from a transposed position
I've been working on a Chess React app for a while which provides stats, including win rates for openings.
I've created a JSON file of about 60000 lines which has lots of chess openings.
My code reads the games PGN, matches the first part of it to my JSON and returns that opening.
I've created seperate "game" logic in another project that converts the PGN to a FEN position. (I don't want to use this seperate code in my react app as it's quite large on its own.)
The issue is, my code will only recognise the opening if the PGN matches, meaning that the moves must be in a correct order
It will recognise this as the Italian Game, Blackburne Shilling Gambit:
1.e4 e5 2.Nf3 Nc6 3.Bc4 Nd4
But it will recognise this as a Bishops opening:
1.e4 e5 2.Bc4 Nc6 3.Nf3 Nd4
Despite the FEN being the same
I'm looking for ways to get them both to say the correct opening, as well as all other openings.
An idea would be to get every possible FEN and put the opening name to that, but considering the number of board positions that exist, that doesn't seem possible.
If this is more vague, I can definitely elaborate
Uhh... How do you post images? 😅 I can't really explain this without a visual aid haha