Skip to content

Conversation

@Apricot-S
Copy link
Collaborator

close #74

The cache in HandDivider has been removed for now.

@Nihisil
Copy link
Contributor

Nihisil commented Nov 4, 2025

sorry, I have missed your PR

The cache in HandDivider has been removed for now.

do we have plans to return it back? the main reason why it was added because we had a lot of calculations for the same hand during the real game loop

it is not clear should cache to be the part of the lib or the part of the code that is using lib, but probably having it in lib helps

@Apricot-S
Copy link
Collaborator Author

Apricot-S commented Nov 4, 2025

@Nihisil
Thank you for the review and your helpful feedback.

I tried introducing @lru_cache, but the arguments are not hashable, so it could not be applied as-is.
If we convert the arguments to tuples inside the function and delegate to an _impl method decorated with @lru_cache, it would work, but in that case we would need to add a custom __eq__() implementation to Meld.
Do you have any ideas on this?
If not, I’m considering reverting only HandDivider.divide_hand() back to an instance method.

@Apricot-S
Copy link
Collaborator Author

As a side note, I'm aware that the current divide approach is not very efficient. For reference, I've collected four more efficient algorithms in a repository here: https://github.com/Apricot-S/block-decomposition. This might be useful background material for future improvements.

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

Successfully merging this pull request may close these issues.

[Feature Proposal] Change instance methods to static methods

2 participants