Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse pgn without moves #604

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Conversation

HaonRekcef
Copy link
Contributor

@HaonRekcef HaonRekcef commented Mar 19, 2024

The user will now be able to import a PGN file even if it does not contain any moves. This functionality is already present in the old app and on the website. For instance:

[Variant "From Position"]
[FEN "r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 0 1"]

This position can now be analysed. One advantage of this over plain FEN is that PGN headers can also be imported.
I let the previous behaviour unchanged: If moves are present, at least the first move must be legal for the PGN analysable.
If there are no moves, there has to be a FEN header for it to be analysable.

@veloce
Copy link
Contributor

veloce commented Mar 20, 2024

Nice!

As a later improvement we could allow bare FEN input also. I guess it makes sense too.

@veloce veloce merged commit c1ca21c into lichess-org:main Mar 20, 2024
3 checks passed
@HaonRekcef
Copy link
Contributor Author

Nice!

As a later improvement we could allow bare FEN input also. I guess it makes sense too.

This is already possible.

@HaonRekcef HaonRekcef deleted the parse-pgn-without-moves branch March 20, 2024 08:27
@ijm8710
Copy link

ijm8710 commented Mar 20, 2024

@HaonRekcef hi haon, thanks for your merge request 3 quick questions

  1. Mainly would it help with importing something like this?

[Event "?"]
[FEN "1rk5/2pn1qb1/1pQ1p1pp/p2pP3/5P2/1N4P1/PPP4P/1RK2B2 b - - 0 1"]
[SetUp "1"]
[Date "2024.03.02"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]
[Site "https://chessify.page.link/main"]
*

I've noticed the above failed in the new app but would work in the old apps

  1. analyzing imported game from tools and clicking share/export does not pick up the game but just shows “?” for every field. Feel that's slightly related to work on the import function, is that unintentional?

  2. A bit unrelated but any idea if we should be able to run computer analysis on imported games? We can’t currently, not sure if that shout is a simpler fix to add by your or by Veloce when he's back from vacation.

Thanks

@HaonRekcef
Copy link
Contributor Author

Hi @ijm8710,

  1. Yes, you will be able to import this. In fact, if I remember correctly, it was your report on Discord that made me aware of this.
  2. I don't understandthe problem. Could you provide a more concrete example with steps to follow and recreate, preferably in a new issue?
  3. I don't think there's a way to run a server analysis on the lichess analysis board, or is there? This seems to be a part of the study feature, which is not implemented yet.

@ijm8710
Copy link

ijm8710 commented Mar 20, 2024

Hi @HaonRekcef

  1. :)
  2. I'm not reproducing it at this second. I'll just share in a new issue ticket once it happens again.
    Having said that, if I import

[Event "Online Game"]
[Site "Chess.com iPhone"]
[Date "2024.03.20"]
[Round "?"]
[White "KupGGS"]
[Black "Jackd222"]
[Result "0-1"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]
[WhiteElo "1247"]
[BlackElo "1278"]
[Termination "Jackd222 won by resignation"]

1.d4 Nf6 2.Nf3 g6 3.c4 Bg7 4.e3 O-O 5.Be2 d6 6.O-O c5 7.d5 Na6 8.Nc3 Bg4 9.h3 Bxf3 10.Bxf3 Nc7 11.a3 Re8 12.b4 e5 13.bxc5 e4 14.Be2 dxc5 15.f3 a6 16.fxe4 Nxe4 17.Nxe4 Bxa1 18.Nxc5 Rb8 19.Bd2 Bb2 20.Qb3 Bg7 21.Nxb7 Qc8 22.Nd6 Rxb3 23.Nxc8 Rxc8 24.Bg4 Re8 25.Ba5 Na8 26.Rf3 Rexe3 27.Rxe3 Rxe3 28.Kf2 Rxa3 29.Bb4 Ra4 30.Bc5 Rxc4 31.Be3 Bd4 32.Bxd4 Rxd4 33.Bf3 Rf4 34.d6 Nb6 35.g3 Rxf3+ 36.Kxf3 a5 37.Ke4 a4 38.Kd3 Kf8 39.Kc3 Ke8 40.Kb4 Kd7 41.g4 Kxd6 42.h4 Ke5 43.h5 Kf4 44.hxg6 hxg6 45.g5 Kxg5 46.Ka3 Kf5 47.Kb2 g5 48.Kc2 g4 49.Kd1 a3 50.Ke2 a2 51.Kf1 a1=Q+ 52.Kg2 Qb2+ 53.Kf1 Qc1+ 54.Kg2 Qd2+ 55.Kg3 Qe1+ 56.Kh2 Qf2+ 57.Kh1 Qh4+ 58.Kg1 g3 59.Kg2 Kg4 60.Kf1 Qh2 61.Ke1 Qf2+ 62.Kd1 g2 63.Kc1 {0-1}
The share & export option seems to lock up. If I import li games, most are scrollable, not sure if it's a bug that this one you can't scroll down that screen.

  1. Ah I just figured in the old lichess app, any imported games had a button option to "request computer analysis" so I figured we should be able to similarly run analysis for games imported in the new app.
    If that's a separate feature altogether, understood, but just figured since import was built and analysis engine was built that it would basically be the equivalent of just enabling analysis on imported games as well but if that's part of study feature, I understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants