Skip to content

Fix hurry ahead bug + Performance Possible Moves #91

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

Merged
merged 10 commits into from
May 31, 2025
Merged

Conversation

YoEnte
Copy link
Contributor

@YoEnte YoEnte commented May 29, 2025

Description

Performance Possible Moves:
Some team made the discovery that the possible moves are extremly slow when handling cards (due to permutations)
-> made a much faster perform move which still generates the same moves (tested with eq() method)
-> kept old possible moves but renamed as reference and if somebody still wants to use it

Hurry Ahead Bug:
On some rare and weird occasions there where possible hurry ahead moves into goal violating the rules engine
-> added small and dirty fix
-> fix in rules engine always broke some other piece of code, therefore the small edge case fix

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Old and newly added tests
Via playing HUI

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@YoEnte YoEnte requested a review from maxblan May 29, 2025 22:04
@@ -35,6 +35,11 @@ impl Card {
cards: Vec<Card>,
) -> Result<(), PyErr> {
let distance = target_position as isize - player.position as isize;

if target_position == 64 && (player.carrots > 10 || player.salads > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should target_position == 64 && player.carrots > 10 && player.salads > 0, right?
The documentation writes the following:

Das Zielfeld darf nur betreten werden, wenn der Spieler höchstens zehn Karotten und keinen Salat besitzt.

I'm currently not 100% sure, but is the index of the goal not at 65? At least the constants.rs says so. Please verify.
Put these numbers in the constants.rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is 64, the index starts at 0, so we got the 65 in the constants... I used it like in hare.rs:72

@YoEnte YoEnte requested a review from maxblan May 31, 2025 17:10
@maxblan maxblan merged commit 6d9fd68 into master May 31, 2025
1 check passed
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.

2 participants