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

Algorithm implemention, (rust) #2

Closed
5 tasks done
Abishevs opened this issue Jan 8, 2024 · 1 comment · Fixed by #10
Closed
5 tasks done

Algorithm implemention, (rust) #2

Abishevs opened this issue Jan 8, 2024 · 1 comment · Fixed by #10
Assignees

Comments

@Abishevs
Copy link
Owner

Abishevs commented Jan 8, 2024

@Abishevs

@LeoAllStar

  • Perfect Riffle shuffle
  • RIffle shuffle (efter gilbert-shanon-reeds-model)

__Ingen

  • Fisher yates (Wheel design?)
@Abishevs
Copy link
Owner Author

Abishevs commented Jan 8, 2024

Pile shuffle insparation code for fixing max cards per bin:

# Distribute N cards to random bins
        t_last_dispense = time.time()
        last_bin = -1
        cards_in_bin = [0] * len(cfg.bin_heights_load_mm)
        for _ in range(cards_per_shuffle_loop):
            # Select bin index, ugly brute force but it's fine shutup
            while True:
                bin_index = random.randint(0, len(cfg.bin_heights_load_mm) - 1)
                if cards_in_bin[bin_index] < cfg.max_cards_per_bin and bin_index is not last_bin:
                    last_bin = bin_index
                    cards_in_bin[bin_index] += 1
                    break

cfg.max_cards_per_bin = 10

Github link

Abishevs added a commit that referenced this issue Jan 8, 2024
Abishevs pushed a commit that referenced this issue Jan 11, 2024
LeoAllStar added a commit that referenced this issue Jan 12, 2024
Abishevs added a commit that referenced this issue Jan 13, 2024
* ahan

* Test Commit

* Commit #2

* fix: #2, cards are now placed into piles correctly.

---------

Co-authored-by: Leo A <leo.altebro@elev.ga.ntig.se>
Abishevs added a commit that referenced this issue Jan 13, 2024
@Abishevs Abishevs linked a pull request Jan 13, 2024 that will close this issue
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 a pull request may close this issue.

2 participants