fsmosca / chess-artist

A python script that can annotate chess games in pgn file with static evaluation or search score of an engine, can annotate an epd file with acd, acs, bm, and ce opcodes, can test engine with epd test suite and can generate chess puzzles.
GNU General Public License v3.0
69 stars 18 forks source link

generate simple puzzle #80

Closed ghost closed 3 years ago

ghost commented 3 years ago

i have simple game [Event "?"] [Site "?"] [Date "????.??.??"] [Round "?"] [White "?"] [Black "?"] [Result "1/2-1/2"] [PlyCount "7"]

  1. e4 e5 2. Bc4 Bc5 3. Qh5 d6 4. Qd1 1/2-1/2

how can i use --job createpuzzle to make epd to show 4Qf7# as puzzle, thanks

fsmosca commented 3 years ago

It cannot, its current algorithm cannot recognize such position.

Use chess chiller instead.

ghost commented 3 years ago

what command to use with chiller to get 4Qf7# to epd file

fsmosca commented 3 years ago

python chess-chiller.py --inpgn sample.pgn --engine stockfish.exe --threads 1 --hash 128

Save that game to sample.pgn file. Get stockfish engine. Install requirements of chess chiller.

ghost commented 3 years ago

command ok for run chiller but no epd file made, need other options maybe

fsmosca commented 3 years ago

I review the code in chess-chiller and it will only start checking the moves in the game from move 16. So it was not able to check the moves because the sample pgn is only up to move 4. I am revising this now and will upload later with settable start move number.

Another issue with chess-chiller is that if the move is not complicated and the move is a capture it will not save the position as a puzzle.

Command line from updated chess-chiller but not yet uploaded.

python chess-chiller.py --inpgn ./PGN/sample.pgn --engine ./Engine/stockfish_10_x64.exe --threads 1 --hash 128 --log  debug --analysis-start-move 2 --maxtime 5

Log from that sample pgn.

2021-01-27 17:39:46,472 [MainThread] [analyze_game] [INFO ] > game move       : h5d1 (Qd1)
2021-01-27 17:39:46,472 [MainThread] [analyze_game] [INFO ] > complexity      : 0
2021-01-27 17:39:46,472 [MainThread] [analyze_game] [INFO ] > best move 1     : h5f7, best score 1: 31999
2021-01-27 17:39:46,472 [MainThread] [analyze_game] [INFO ] > best move 2     : d2d4, best score 2: 367
2021-01-27 17:39:46,473 [MainThread] [analyze_game] [INFO ] > scorediff       : 31632
2021-01-27 17:39:46,473 [MainThread] [analyze_game] [WARNI] > Skip this pos, bm1 is a capture and pos complexity is below 2

It sees the best move h5f7 but was not saved.

In order for the position to be saved, I need to disable the complexity requirement. I add --disable-complexity flag in the command line.

python chess-chiller.py --inpgn ./PGN/sample.pgn --engine ./Engine/stockfish_10_x64.exe --threads 1 --hash 128 --log  debug --analysis-start-move 2 --maxtime 5 --disable-complexity

The outputs epd and pgn files:

rnbqk1nr/ppp2ppp/3p4/2b1p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - bm Qxf7#; ce 31999; sm Qd1; acd 21; acs 5; fmvn 4; hmvc 0; pv Qxf7#; c0 "? - ?, ?, ?, ????.??.??, R?"; c1 "Complexity: 0"; c2 "bestscore2: 367"; c3 "Analyzing engine: Stockfish 10 64";
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]
[FEN "rnbqk1nr/ppp2ppp/3p4/2b1p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 0 4"]
[PlyCount "7"]

4. Qxf7# *

I will upload the latest chess-chiller later or tomorrow after some documentations.

fsmosca commented 3 years ago

See latest chess-chiller it is now updated.

Your typical command line:

python chess-chiller.py --inpgn mysample.pgn --engine ./Engine/stockfish_10_x64.exe --threads 1 --hash 128 --analysis-start-move 2 --maxtime 5 --disable-complexity
ghost commented 3 years ago

thank you maybe have command option save position before blunder [Event "?"] [Site "?"] [Date "????.??.??"] [Round "?"] [White "?"] [Black "?"] [Result "1-0"] [SetUp "1"] [FEN "rnbqk1nr/pppp1ppp/8/2b1p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR b KQkq - 0 3"] [PlyCount "2"]

3... d6 4. Qxf7# 1-0

fsmosca commented 3 years ago

Could you post your new issue in chess chiller repository.

Perhaps we can close this issue now.

ghost commented 3 years ago

ok thank you