Code Monkey home page Code Monkey logo

deep-position-analysis's People

Contributors

zefresk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

scallybag

deep-position-analysis's Issues

--appending flag

Hi

It appears that --appending flag does nothing.

Also in a multgame pgn file, iterating process seems to freeze due to faulty nps evals (or cache?)
If I recreate .cache-db after each iter completes, process continues as it should...

Can you please take a look?
Thank you

M.N.

After finishing the analysis, the program can't save the results

Using python3 and installed the dependencies.

Launched liike this:
python3 dpa.py -p ~/soft/git/Stockfish/src/stockfish --pv=4 --depth 3 --ply-depth 5 two_knights_traxler.txt

The analysis seems to work fine, but when it tries to save the results it gives this error message:

Saving result.

Traceback (most recent call last):
  File "dpa.py", line 100, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "dpa.py", line 79, in main
    game = new_default_game(board, engine.name, args) # Create a gaame with the correct headers
  File "/home/emilio/soft/git/deep-position-analysis/files.py", line 67, in new_default_game
    stopping = (format_nodes(args.nodes,"{:1.0f}") +" nodes") if (args.nodes != None) else format_time(args.msec)
  File "/home/emilio/soft/git/deep-position-analysis/misc.py", line 33, in format_time
    if msec < 10**3: #ms
TypeError: '<' not supported between instances of 'NoneType' and 'int'

Bug found in the script

Hi,
This is a bug that I got when I tried to run the script.

D:\Chess\deep-position-analysis> python dpa.py --engine "stockfish2206.exe" --depth 2 'French Poisoned Pawn_Schwarz_2022.pgn' --appending --threshold 1.00 --cutoff 0.50 --nodes 10000000
D:\Chess\deep-position-analysis\dpa.py:5: DeprecationWarning: The chess.uci module is deprecated in favor of
chess.engine https://python-chess.readthedocs.io/en/latest/engine.html.

Please consider updating and open an issue
https://github.com/niklasf/python-chess/issues/new if your use case
is not covered by the new API.
import chess.uci
Setting-up engine
PGN input detected we will only analyze from last position(s) reached.
Traceback (most recent call last):
File "D:\Chess\deep-position-analysis\dpa.py", line 100, in
asyncio.run(main())
File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "D:\Chess\deep-position-analysis\dpa.py", line 58, in main
fens = fens_from_file(filename)
File "D:\Chess\deep-position-analysis\files.py", line 33, in fens_from_file
board.push(move)
File "C:\Program Files\Python310\lib\site-packages\chess_init_.py", line 1906, in push
move = self.to_chess960(move)
File "C:\Program Files\Python310\lib\site-packages\chess_init
.py", line 3252, in _to_chess960
if move.from_square == E1 and self.kings & BB_E1:
AttributeError: 'GameNode' object has no attribute 'from_square'

This is what I got when I tried to run the script.

Python 3.10.5
Python Chess 0.25.1

--refutation option

The new option --refutation would include bad moves and their refutation in the final analysis instead of just excluding them. These moves would still not be explored further.

Maybe I should make this the default behavior and use a --no-refutation parameter instead ?

branching options

Hi, cool program, I was wondering if as oppose to picking the top-PV moves, this could be set to choose moves based on a centipawn ranking. I was hoping to use this to calculate all the moves that lead to the shortest possible mate in a position.

Enhancements to the script

Hi,

As promised, I would like to suggest some enhancements to this project:

  1. I think the biggest revolution in the chess world would be if we create an ensemble learning method for chess as well. What do I mean by this? Let's say we take the two top engines of today - Leela and Stockfish. What if we asked both Leela and Stockfish to vote on different moves in a position (by vote I mean both eval and the choice number - 1st choice, 2nd choice etc). This way we can extend this logic further:

a) Suppose both the engines agree on a move, then explore it deeper and keep it as top choice.

b) If there is a disagreement - go linearly and try to understand at what point the evals converge. If the eval is positive for the side that we want to do the analysis for (White/Black) then we keep the line, else we remove it.

c) This scenario also has this use-case - suppose there is a move by Leela, which is known for liking different ideas, that is not completely refuted by Stockfish, then explore that idea in further detail.

  1. An extension of the 'chess voting classifier' that I proposed above - use multiple strong engines of today and order 3-4 moves based on individual votes. Do this for each level upto a certain depth in the search tree, then provide a final evaluation based on the top engine being used (Leela/Stockfish).

  2. Right now your script is doing an exponential branching if I am not wrong - if depth is 2 then at the 1st level we have two nodes and then two children for each node correct? So what we can do is that we add another feature that does a linear search i.e. no branches - just give a single line up to a certain ply.

All the enhancements I am suggesting is based on different chess GUI I have explored like Aquarium IDeA, Chessbase DPA (which I currently use) and Extreme Chess Analysis of Banksia GUI. I don't know if we can do all this, but I thought that starting from something is better than starting from nothing.

Would love to know what you think of this. Please label this as an enhancement.

Writing analysis output...

Hello,

When analyzing a pos in really higher depths (>30plies) writing final analysis from memory to a file can be extremely time consuming.

Case study
Some trivial rook ending: 3 connected pwns vs 3 isolated - long mating variations for Black
Starting FEN "8/8/5k2/2PR1ppp/8/2r1PK1P/8/8 b - - 0 56" (Best move f4)

dpa.py -p ./stockfish -d 24 -c ./sf.cfg --depth 30 --pv 10W3B -k 350W60B --threshold 25B g.pgn
(Using: 30 Threads & 16G mem)
......................................
Completed position analysis 1 of 1 from g.pgn in 2 hours 27 minutes 47 seconds.
Saving result.

Saving took ~5h (for ~26M output)!!!

Can this procedure be optimized?

Thank you
M.N.

Is the project still active?

Hi,
I am a strong CC player (2345 ICCF) who is looking at alternative approaches to analysis. I like your project and the idea behind it and had a few ideas to contribute. Is the project still active? I know a bit of coding as well so perhaps I can try to help there as well.
Thanks,
Tanmay Srinath.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.