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

willMoveLeaveKingInCheck optimization by avoiding recalculating AttackableBoard #61

Open
Vadman97 opened this issue Apr 10, 2019 · 1 comment
Labels
help wanted Extra attention is needed performance

Comments

@Vadman97
Copy link
Owner

Might be related to #22

RIght now, when we build moves in GetMoves, we try each more and calculate AttackableBoard for each move. This is really slow (O(n^4) wrt. number of squares of board)

If we do #22, this may be much better. Alternatively maybe we can get the AttackableBoard without recalculating, just by somehow applying the attackable positions of a new move and then undoing after trying the move but idk if this is possible

@Vadman97 Vadman97 added help wanted Extra attention is needed performance labels Apr 10, 2019
@Vadman97 Vadman97 added this to the ready for demo milestone Apr 10, 2019
@dadhia
Copy link
Collaborator

dadhia commented Apr 10, 2019

I can pick up this issue. We can actually completely get rid of the cache in this way. Simply save the previous board, apply the change and keep going from there. We will need to have 4 bits per location so an extra 4*64 = 256 -> 32 bytes for the board. Might be a tricky refactor but definitely doable. Thoughts?

@Vadman97 Vadman97 removed this from the Ready for Demo milestone Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed performance
Projects
None yet
Development

No branches or pull requests

2 participants