healeycodes / andoma

♟️ A chess engine with alpha-beta pruning, piece-square tables, move ordering, and command-line UI.
https://healeycodes.com/building-my-own-chess-engine/
MIT License
150 stars 27 forks source link

Cute chess #25

Open GyatsoYT opened 1 year ago

GyatsoYT commented 1 year ago

Whenever I try to add it to cute chess it says cannot run engine and doesn't add it why does this error comes .. I use python main.py in the command dialogue box and the directory of bot files in working directory dialogue box.. if anyone can help me fix this ASAP it would be really helpful

tissatussa commented 1 year ago

Andoma thinks too long and often its "connection stalls" in CuteChess .. this project seems buggy, sorry. Are you looking for a properly working engine based on python?

tissatussa commented 1 year ago

Btw. i have no error when adding Andoma v0.1.1 to CuteChess v1.2.0 like this :

andoma-in-cutechess

[ i'm on Xubuntu 22.04 ]

GyatsoYT commented 1 year ago

Btw. i have no error when adding Andoma v0.1.1 to CuteChess v1.2.0 like this :

andoma-in-cutechess

[ i'm on Xubuntu 22.04 ]

i am on windows and the following thing happens on using the command python main.py Screenshot (125) Screenshot (126)

tissatussa commented 1 year ago

i see the directory seperator character of your Working Directory value is a "\" (which is typical Windows indeed), but your "Default Location" value has "/" characters !? Maybe this is not the cause of your error though ..

another thing to consider : at my Linux the command 'python' refers to Python2, not Python3 .. try using python3 ./main.py as command, it might help .. anyway, what happens when executing the command in terminal ? (not the CuteChess GUI)

GyatsoYT commented 1 year ago

i see the directory seperator character of your Working Directory value is a "\" (which is typical Windows indeed), but your "Default Location" value has "/" characters !? Maybe this is not the cause of your error though ..

All of the paths are represented by \ which I don't understand why but it is what it is..

another thing to consider : at my Linux the command 'python' refers to Python2, not Python3 .. try using python3 ./main.py as command, it might help ..

In windows I think to run python commands we need to use python "file" and btw I tried python3 and there is no difference it still is the sam error.

anyway, what happens when executing the command in terminal ? (not the CuteChess GUI)

When I execute the command in terminal it works as intended I write uci the bot says uciok and stuff...

tissatussa commented 1 year ago

now it's unclear to me how to help .. here are my gathered Python engines, maybe you could try to add one of those to CuteChess and see if same error occurs :

some-python-based-engines

tissatussa commented 1 year ago

at this moment i see two other options which might help to solve the problem on your Windows :

Btw. as i'm on Linux i don't know if this applies to Windows as such..

tissatussa commented 1 year ago

i just discovered something : i get the same error when adding such python engine, using CuteChess v1.3.1 .. but my previous comments all apply to v1.2.0, which does NOT gives the error !? .. so maybe CuteChess v1.3.1 has a bug concerning this..

GyatsoYT commented 1 year ago

i just discovered something : i get the same error when adding such python engine, using CuteChess v1.3.1 .. but my previous comments all apply to v1.2.0, which does NOT gives the error !? .. so maybe CuteChess v1.3.1 has a bug concerning this..

Where can I find v1.2.0?

tissatussa commented 1 year ago

Where can I find v1.2.0?

see https://github.com/cutechess/cutechess/releases/tag/1.2.0 its assets also include a Windows setup.exe

tissatussa commented 1 year ago

Btw. for a rather long time v1.2.0 was the latest stable version .. i have very few problems with it, and i'm still using it, because (indeed) v1.3.x seems to be buggy (also with other issues) .. maybe it's time for you to create an Issue at the CuteChess project GitHub pages.

GyatsoYT commented 1 year ago

Btw. for a rather long time v1.2.0 was the latest stable version .. i have very few problems with it, and i'm still using it, because (indeed) v1.3.x seems to be buggy (also with other issues) .. maybe it's time for you to create an Issue at the CuteChess project GitHub pages.

Yea I will surely report the problem after I check if 1.2.0 works for me or not cz I haven't tested it..

GyatsoYT commented 1 year ago

Btw. for a rather long time v1.2.0 was the latest stable version .. i have very few problems with it, and i'm still using it, because (indeed) v1.3.x seems to be buggy (also with other issues) .. maybe it's time for you to create an Issue at the CuteChess project GitHub pages.

using the v1.2.0 works for me i can add the engine now but whenever i try to play a game it just ends in an instance any quick fix?

tissatussa commented 1 year ago

try to start the CuteChess GUI by terminal, e.g. $ /home/roelof/Apps/CuteChess_1.2.0/projects/gui/cutechess-compiled and see if some error is echood when the game-ending occurs ..

GyatsoYT commented 1 year ago

try to start the CuteChess GUI by terminal, e.g. $ /home/roelof/Apps/CuteChess_1.2.0/projects/gui/cutechess-compiled and see if some error is echood when the game-ending occurs ..

i fixed the error now but i want to increase the depth how can i do that from the code? i increased it to 20 first and then started a game and i waited for like 10 mins for it to make a move but it didnt then i changed it to 5 and it made a move in 4-5 minutes i dont think thats good for a chess engine any idea how can i constantly analyse at 20 depth without getting performance like this....

tissatussa commented 1 year ago

at the bottom of communication.py is a function called get_depth() .. it has depth 3 as default, you can change it here. Btw. my experience is depth 5 is max..

tissatussa commented 1 year ago

remember Andoma is a very simple and weak engine .. there are plenty of other good engines, why stick with Andoma? It's slow and buggy also .. do you prefer a python engine ?

GyatsoYT commented 1 year ago

remember Andoma is a very simple and weak engine .. there are plenty of other good engines, why stick with Andoma? It's slow and buggy also .. do you prefer a python engine ?

yes i prefer a python engine and want to develop on that. i dont want very fast engine i want an accurate engine which takes reasonable amount of time to search at a depth of 20. and if i can do that on andoma i will start developing upon this and also optimizing the code in process...

tissatussa commented 1 year ago

Python is not fast .. it's not the preferred language to create a chess engine .. some developers do, but often only because they know the language and just want to experiment, not aiming to build an "accurate" engine .. using high depths involves searching and evaluating an exponentially increasing number of nodes, which takes time, esp. when pruning is simple or poor .. Python scripts can run much faster by using pypy, you should certainly try that also and see the difference .. besides that, compiling a Python script by pyinstaller is a valuable alternative, as i stated before .. recently i learned Nim, as an alternative to Python, because this language can be compiled into a fast binary and Nim strongly resembles the Python syntax and is fun to learn and use.

tissatussa commented 1 year ago

my best Python engine tip is D-House, see https://github.com/alvinypeng/d-house it's an "UCI chess engine coded in pure Python with no external libraries" and it runs in CuteChess. it can also run in SCID, recently i did a test with several engines in this position :

r1bqk2r/pp1n2bp/2p3p1/4pp2/2P5/2N1PNP1/PPQ2PP1/2KR1B1R w kq - 0 12

just to see if they find bestmove : g4 ! according to StockFish and many other very good engines, this position CLEARLY has only 1 best move, which is hard to find for many engines, including 2700+ ones, but D-House finds it ! according to the author it's based on Berserk, a famous strong open source engine.

Btw. the creator of D-House is hard to be contacted .. i wrote an Issue on his GitHub project but until now i got no response..

D-House-PY

GyatsoYT commented 1 year ago

my best Python engine tip is D-House, see https://github.com/alvinypeng/d-house it's an "UCI chess engine coded in pure Python with no external libraries" and it runs in CuteChess. it can also run in SCID, recently i did a test with several engines in this position :

r1bqk2r/pp1n2bp/2p3p1/4pp2/2P5/2N1PNP1/PPQ2PP1/2KR1B1R w kq - 0 12

just to see if they find bestmove : g4 ! according to StockFish and many other very good engines, this position CLEARLY has only 1 best move, which is hard to find for many engines, including 2700+ ones, but D-House finds it ! according to the author it's based on Berserk, a famous strong open source engine.

Btw. the creator of D-House is hard to be contacted .. i wrote an Issue on his GitHub project but until now i got no response..

D-House-PY

i wanna make a good chess engine do yo want to like help me in the process? like we can code together e.t.c

tissatussa commented 1 year ago

watch these video(s), they're very well done regarding coding, story and video edit:

Coding Adventure: Chess https://www.youtube.com/watch?v=U4ogK0MIzqk

and read the description .. recently there's also a second video about this engine building.

GyatsoYT commented 1 year ago

watch these video(s), they're very well done regarding coding, story and video edit:

Coding Adventure: Chess https://www.youtube.com/watch?v=U4ogK0MIzqk

and read the description .. recently there's also a second video about this engine building.

That was one of the videos I watched before chess programming.

Look I am a Chess player who often plays some tournaments and wins so yea and also I also knew a little bit of coding so I thought I would make an engine...

Btw can you tell me where I can learn nim I checked about it and it's awesome language do you have any resources through which I can learn? I prefer visual learning btw...

Thanks for all your help I understand now that I cannot reach the level I desire through python.

tissatussa commented 1 year ago

Nim Tutorial Videos https://www.youtube.com/playlist?list=PLYBJzqz8zpWaiGbFcSdlh08zlpe8Tl_Gh

simple chess engine in Nim : https://github.com/mdoege/nimTUROCHAMP here i also contributed with some Issues, but i'm not programming any engine, just experimenting..

GyatsoYT commented 1 year ago

Nim Tutorial Videos https://www.youtube.com/playlist?list=PLYBJzqz8zpWaiGbFcSdlh08zlpe8Tl_Gh

simple chess engine in Nim : https://github.com/mdoege/nimTUROCHAMP here i also contributed with some Issues, but i'm not programming any engine, just experimenting..

The tutorial is still ongoing will it cover the important topics that I need to know for programming a engine and also how much similar it is to python... I checked nims packages I didn't find anything related to chess like we have python chess in python and chess.js in javascript.which makes the development easy but nim doesn't have one so yea it's gonna take good amount of time... Will I be able to make an accurate chess engine in it? Like stockfish which finds accurate move by taking less time.

tissatussa commented 1 year ago

..it's gonna take good amount of time..

yeah, years probably ..

you can import python modules into Nim .. you will not need a full chess framework to create your chess engine, start simple and explore the subject .. by programming all elements yourself you will learn a lot, eg. magic bitboards etc.

good luck !

GyatsoYT commented 1 year ago

..it's gonna take good amount of time..

yeah, years probably ..

you can import python modules into Nim ..

How? you will not need a full chess framework to create your chess engine, start simple and explore the subject .. by programming all elements yourself you will learn a lot, eg. magic bitboards etc.

Already working on it.... good luck !