Open steinitz-zz opened 9 years ago
Nice, my first user! So keep me informed who your work is going. Are your changes available anywhere? You have not forked my repo, so I don't have the chance to see your changes. I will look at it as soon I see your ideas in code.
And hopefully I will finish the work (edit mode is not finished yet) this year, had too much work lately in the company (and too many hours spent on chess.com and lichess.org).
Ah, good, your first user. I like it.
I am happy to provide the changes directly to you, if you are interested. You may want to use them. However, I've made many, many formatting changes, so I'm not sure if a fork or pull request would be appropriate. Specifically, I can read and understand code better when it's like this:
function ()
{
if (condition)
{
console.log ("1");
}
else
{
console.log ("2");
}
}
but many people find that annoying, or worse -- I saw someone propose putting people to death who format like I do :)
Feel free to send me a private email: steve at dtctc dot com
I was able to debug the Guess the Move issue with the first move (the solution seems slightly drastic :) ). The fixed version is now running at chesstraining.meteor.com . Again, I'd be delighted to provide the entire Meteor project directly to you. Feel free to contact me at steve at dtctc dot com If you are interested. In the meantime, you can download the modified pgnvjs.js here: https://gist.github.com/steinitz/7ddcbbd8fdd9f2f436b3
The project is too much changed (for Meteor) for a pull request. I suppose I could make a special project for the purpose of a pull request, but perhaps it would be better if you were to look over my changes first. My non-standard (but beautiful :) ) formatting, the fact that Meteor has problems with 'use strict' and other issues may make a pull request inappropriate. I welcome your thoughts.
In any case, please accept my sincere appreciation for your fine work.
Hi,
I have noticed that the pgn of, say Bxb4 is displayed as Bb4. I'd like to have the 'x'. Did you intentionally remove the x or is it an artifact of chess.js or pgn.js?
Thanks for any hints.
Cheers,
Steve
ps. I have a much changed version of pgnvjs.js for you if you are interested.
Hi,
I made two simple mods to pgn.js to add 'x' for captures. Here are the details.
In eachMoveVariation, save the flags from chess.js:
...
var fen = game.fen();
move.fen = fen;
move.notation.flags = pgn_move.flags; // SJS - save this to know to draw a capture symbol, 'x'.
$.each (move.variations,
...
Then modify san() as follows:
var san = function (notation)
{
if (typeof notation.row == 'undefined')
{
return notation.notation; // move like O-O and O-O-O
}
var fig = $.t(notation.fig);
var capture = notation.flags == game.FLAGS.CAPTURE ? 'x' : ''; // SJS - add 'x' for captures
var disc = notation.disc ? notation.disc : "";
var check = notation.check ? notation.check : "";
var prom = notation.promotion ? notation.promotion : "";
return fig + disc + capture + notation.col + notation.row + prom + check; // SJS - capture
};
Cheers
See issue #5 which I have added to separate this issue from the missing capture symbol. I have taken your input, and searched for the "best" place to insert the right code then. Will make some tests, and then publish my changes soon.
Hi @mliebelt,
Thanks for sharing such great stuff. Are you still working on this issue? I would like to integrate such behavior into Anki (user guessing the next moves which is noted in pgn and computer replying with the next move in the pgn).
There are some working solutions for Anki, but rather old or buggy.
@khoramshahi Do you have a reference to Anki, I never heard of it. I cannot say when I will have time to work on that issue, but the requirements should be easy:
Am I missing anything here?
There is a great tool to generate Lichess style PUZZLES
from PGN
file, which works really well.
https://github.com/linrock/chess-puzzle-maker
The puzzle output from this is the PGN file starting with FEN
position and the first move is basically a BLUNDER
, which refutation should be found as a puzzle.
So, all your @mliebelt assumptions, like "No variations, only one line" holds, but moreover:
Dunno, what is the state of this issue, the requirements looks really straightforward.
I am absolutely new to PgnViewerJS
, so I can easily misinterpret the ideas. If I decide to implement it, am I right the new modus, like pgnPuzzle
, is to be introduced?
@Bebul Thank you a lot for investing time in that topic. I think you are right. Here is what I would do if I would tackle that issue:
pgnPuzzle
.The changes will be only in the viewer module, no changes to reader.
I wish you good luck in your challenge!
After finishing the puzzle I have disabled mooving pieces, so the chessground
is frozen, unless user returns by prevMove
. Implementation looks good, because using hasMode('puzzle')
makes changes impossible to break other functionality which is most important.
But I must still do:
PGN
with possibility to navigate nextPuzzle
What I dunno is creating documentation and examples. I have puzzle.html
as example with one generated by https://github.com/linrock/chess-puzzle-maker
I am looking forward to finishing it and making PULL Request soon.
First of all thank you @mliebelt for this wonderful package and all your work. I have tried to contribute by implementing a guess-the-move mode. I am happy to hear any feedback and further help on this issue as well as on other parts of the package.
@ppeloton Thank you a lot for providing that functionality. I have to check it (hopefully on weekend), but on first sight it should be doable. If it seems to be ok, I will create a new version that includes your new mode, and check as well the documentation how that could be expanded. If that is all ok, I will publish a new version that includes your changes.
I have merged it, and yes, it may be a first step in the right direction. I think we should now define, what "Guess the move" should support. At the moment, the implementation is there, but there is no additional support for this mode. So the following list could be a starting point, and it contains also things I see in the example / implementation then:
So I leave that ticket open, but will include your change in the next release coming soon.
Things to do before doing a new release then:
I was working on the Configuration Builder, and it works quite well.
@mliebelt: Great! I agree, it is a starting point and there are many things one can improve and add to this functionality (happy to help here!).
I continued testing the feature a little bit, there seems to be still a bug as the fen in the that.mypgn object does not seem to get updated properly. If you move a piece two times in a row, the whole puzzle freezes sometimes - e.g. take the puzzle.html
I provided in the PR and play first the move f4 and then fxe5, after which the puzzle freezes. The reason seem to bet that the fen in mypgn is not up-to-date and one cannot get the proper piece information in the function onSnapEnd
. I have not figured out yet how to fix it. Maybe you can have a look as you know the package better.
@mliebelt: Great! I agree, it is a starting point and there are many things one can improve and add to this functionality (happy to help here!).
I continued testing the feature a little bit, there seems to be still a bug as the fen in the that.mypgn object does not seem to get updated properly. If you move a piece two times in a row, the whole puzzle freezes sometimes - e.g. take the
puzzle.html
I provided in the PR and play first the move f4 and then fxe5, after which the puzzle freezes. The reason seem to bet that the fen in mypgn is not up-to-date and one cannot get the proper piece information in the functiononSnapEnd
. I have not figured out yet how to fix it. Maybe you can have a look as you know the package better.
I just made a pull request to fix the issue above. I assume in future it is better to open bugs/tickets for specific issues and keep this ticket for general discussions.
@mliebelt: I just added a few sentences for a simple documentation. Regarding the future enhancements I would suggest to do this together with the issue #175. E.g. it would make sense to give hints via API in my opinion and to leave users of the package the freedom to define how to handle those hints in the UI (of course there could be a default UI implementation for hints in this package as well)
Hi mliebelt,
I thought you might be interested to know that I've used your fine work as a foundation for a Guess The Move prototype. I integrated PgnViewerJS into Meteor (a story in itself), added some enhancements and deployed it (just for fun) to chesstraining.meteor.com
Note that it doesn't work on the first move (e4), after that it's ok. I'll fix that soon.
Thanks for making public your excellent work. I'd be interested in your comments. You're welcome to the modified code.
All the best,
Steve