marcusbuffett / command-line-chess

A python program to play chess against an AI in the terminal.
MIT License
500 stars 162 forks source link

Some ideas #49

Open PGTBoos opened 2 years ago

PGTBoos commented 2 years ago

Was looking at the code i'm on a jupyter notebook though. Could it be converted to it? , I've still not cracked the looking ahead for moves..

Though for your code.

ClasherKasten commented 2 years ago

Could it be converted to it? ,

No, I don't see a good, practical reason converting this project to a Jupyter notebook. Is there a good reason why you would like to have it converted to a Jupyter notebook?

Maybe an idea, what if all the potential moves was just selected from list(board.legal_moves)

I noticed that board has no attribute legal_moves. Could you please point to a file and line number where you can find that? Or is this an intentionally introduced new attribute? If so, please describe how it should look and behave.

Bishop/Knight values, how about adjusting it during the game a single bishop is less then a pair its not just comparing number off bishops vs knights, their value change slightly. (i'd even prefer 2 knights end games).

This is a good idea, if you wanna do it and have time for it, you can open a PR.

Not sure if you allready do this If you check several moves ahead, one doesnt need to recalculate if a specific move is indeed played, top results can be cashed and if so one can expand on previous results, which might even then get a bonus 1 level deeper.

I didn't see this kind of behaviour anywhere in the code. It sounds like a good idea too, but I guess the problem will be that right now it wont change much, as you can read in the README.md under Technical stuff it's a very basic and slow AI. So my apprehension is that it needs to much time for often recalculations when the AI wrong predicts the best moves and with a too low lookahead cache the AI can recalculate things fast enough that we don't need it (As seen on the screenshots, 2 moves lookahead is ok to calculate but 3 and above is very time consuming and eventually for this it could make sense to use a cache. But if we choose a number higher than 3, players would wait too long for recalculations).

Not sure if you take it in the calculation, diagonal pawn walls, might get a higher peace value.

This is again a very interesting idea. if you wanna do it and have time for it, you can open a PR.

PGTBoos commented 2 years ago

What is a PR ? For me it be nice on jupyter since all neural network lives there at my pc. Might attract other Devs too if published like that.

Outlook voor Android downloadenhttps://aka.ms/ghei36


From: ClasherKasten @.> Sent: Friday, October 14, 2022 4:27:10 PM To: marcusbuffett/command-line-chess @.> Cc: PGTBoos @.>; Author @.> Subject: Re: [marcusbuffett/command-line-chess] Some ideas (Issue #49)

Could it be converted to it? ,

No, I don't see a good, practical reason converting this project to a Jupyter notebook. Is there a good reason why you would like to have it converted to a Jupyter notebook?

Maybe an idea, what if all the potential moves was just selected from list(board.legal_moves)

I noticed that board has no attribute legal_moves. Could you please point to a file and line number where you can find that? Or is this an intentionally introduced new attribute? If so, please describe how it should look and behave.

Bishop/Knight values, how about adjusting it during the game a single bishop is less then a pair its not just comparing number off bishops vs knights, their value change slightly. (i'd even prefer 2 knights end games).

This is a good idea, if you wanna do it and have time for it, you can open a PR.

Not sure if you allready do this If you check several moves ahead, one doesnt need to recalculate if a specific move is indeed played, top results can be cashed and if so one can expand on previous results, which might even then get a bonus 1 level deeper.

I didn't see this kind of behaviour anywhere in the code. It sounds like a good idea too, but I guess the problem will be that right now it wont change much, as you can read in the README.md under Technical stuff it's a very basic and slow AI. So my apprehension is that it needs to much time for often recalculations when the AI wrong predicts the best moves and with a too low lookahead cache the AI can recalculate things fast enough that we don't need it (As seen on the screenshots, 2 moves lookahead is ok to calculate but 3 and above is very time consuming and eventually for this it could make sense to use a cache. But if we choose a number higher than 3, players would wait too long for recalculations).

Not sure if you take it in the calculation, diagonal pawn walls, might get a higher peace value.

This is again a very interesting idea. if you wanna do it and have time for it, you can open a PR.

— Reply to this email directly, view it on GitHubhttps://github.com/marcusbuffett/command-line-chess/issues/49#issuecomment-1279085172, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFQQOG3IZ7BZBJEK3RAC2QDWDFUT5ANCNFSM6AAAAAARFIAPDY. You are receiving this because you authored the thread.Message ID: @.***>

ClasherKasten commented 2 years ago

What is a PR ?

PR means Pull Request.

For me it be nice on jupyter since all neural network lives there at my pc.

It might be better for you because you wanna integrate sonething, but would be a pain for me to maintain. e.G.: Jupyter Notebooks can not be reviewed as .py files. It is much harder with Jupyter Notebooks. Also as far as I understood, Jupyter Notebooks don't really have the concept of "modules". Every piece of code essentially would have to be written twice: once for the normal python code, once for the Jupyter Notebook.

Also I think Jupyter would force people to use a workflow not everyone uses or wants to use.

Might attract other Devs too if published like that.

That's a good point, but unfortunately I don't think that it is worth the additional work for maintaining it.

If you want to have a Jupyter Notebook version of this project, please do it on your own, but I don't gonna do the extra maintaining work and also I don't wanna load extra work on the contributors when they have to write their code two times.

PGTBoos commented 2 years ago

Ok fair point, 2 versions is indeed a lot of work to maintain.

PGTBoos commented 2 years ago

Oh and about legal moves this is how I do it at my current chess jupyter notebook.

!pip install chess import chess

board = chess.Board() board.turn == chess.WHITE print(str(board)) list(board.legal_moves) move = list(board.legal_moves)[0] # take the first move (with no score calucalation at all) print(move.uci())

ClasherKasten commented 2 years ago

!pip install chess is wrong. The package name is cl-chess, so the correct command would be !pip install cl-chess.

Sorry, but i forgot to mention that the PyPI package didn't get updated for quite a while. To use latest changes, I would recommend to install from source (through cloning the repository and pip install <path-to-cloned-repository>).

ericborgos commented 1 year ago

After some experimentation, I got it to work in Google Colab. Here's the code: !git clone https://github.com/marcusbuffett/command-line-chess %cd /content/command-line-chess !pip install . !chess

ClasherKasten commented 1 year ago

For only installing it, and not needing the code, cloning isn't required, because pip can install from git repositories. See documentation for this here