Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review of AlphaBetaEngine #4

Open
lekcyjna123 opened this issue Jul 22, 2023 · 0 comments
Open

Review of AlphaBetaEngine #4

lekcyjna123 opened this issue Jul 22, 2023 · 0 comments

Comments

@lekcyjna123
Copy link

lekcyjna123 commented Jul 22, 2023

"Algorithm will not inspect nodes that are worse than already inspected nodes".
You probably meant that algorithm will not inspect nodes which won't be seen in optimal game. Because you don't know if the node is worse than already inspected before you inspect them.

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L60

What tuple? Tuple of ints? tuple of floats? Add this to typing info.

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L94-L100

This should be probably separate function. Whole evaluation and scoring part should be separate from the alpha-betha.

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L96

Magic numbers. Make them a const's with meaningful names.

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L104
Why not simply board.legal_moves?

You duplicate functionality in _get_engine_move and _alpha_beta_puring. When you invoke _get_engine_move with 0 legal moves then you have the same end conditions as in _aplha_beta_puring. Another example:

        for move in legal_moves:
            board.push(move)
            <evaluate>
            board.pop()

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L107
King in the checkers?

https://github.com/michalskibinski109/py-draughts/blob/bc030b1a312cc44ee39ec9e7f70b8f23d9255cdb/draughts/engine.py#L10
An alternative is to use Protocol from typing.

Some other ideas for future:

  • alpha beta with monte carlo tree search
  • reusing subtree from the last evaluation to reduce computation time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant