Deduplicate Shuffle Logic - #249
Open
foohyfooh wants to merge 7 commits into
Open
Conversation
Use the shuffle functions directly in places where it won't affect the readability of the existing line too much
mercury233
requested changes
Aug 9, 2026
- Fix Fisher-Yates shuffle algorithm - Fix Yubel recursive reference to ShuffleList
There was a problem hiding this comment.
Pull request overview
Centralizes duplicated deck shuffle logic in AIUtil.
Changes:
- Adds shared list/card shuffle helpers.
- Migrates 16 deck executors to shared helpers.
- Simplifies two Thunder Dragon swaps.
The deduplication is useful, but the shared shuffle is biased and three tuple swaps violate required C# 6 compatibility.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Game/AI/AIUtil.cs |
Adds shared shuffle helpers. |
Game/AI/Decks/YubelExecutor.cs |
Uses shared shuffling. |
Game/AI/Decks/VoicelessExecutor.cs |
Removes local shuffle helper. |
Game/AI/Decks/TrickstarExecutor.cs |
Uses shared target/place shuffling. |
Game/AI/Decks/ThunderDragonExecutor.cs |
Uses shared shuffling and tuple swaps. |
Game/AI/Decks/SwordsoulExecutor.cs |
Replaces local card shuffling. |
Game/AI/Decks/SalamangreatExecutor.cs |
Centralizes zone-order shuffling. |
Game/AI/Decks/SacredBeastExecutor.cs |
Delegates shuffling to AIUtil. |
Game/AI/Decks/RyzealExecutor.cs |
Delegates shuffling to AIUtil. |
Game/AI/Decks/MalissExecutor.cs |
Delegates both shuffle helpers. |
Game/AI/Decks/LabrynthExecutor.cs |
Delegates shuffling to AIUtil. |
Game/AI/Decks/ExosisterExecutor.cs |
Replaces local target shuffling. |
Game/AI/Decks/DogmatikaExecutor.cs |
Delegates card shuffling. |
Game/AI/Decks/BE2025Executor.cs |
Removes duplicate shuffle implementations. |
Game/AI/Decks/ArchfiendExecutor.cs |
Removes duplicate shuffle implementations. |
Game/AI/Decks/ApophisExecutor.cs |
Delegates shuffling to AIUtil. |
Game/AI/Decks/AlbazExecutor.cs |
Delegates shuffling to AIUtil. |
Suppressed comments (1)
Game/AI/Decks/ThunderDragonExecutor.cs:1377
- This tuple/deconstruction swap is C# 7 syntax and is unsupported by the repository's required C# 6/older Mono toolchain. Use the prior temporary-variable swap so the project remains buildable on supported compilers.
(link_materials[i], link_materials[0]) = (link_materials[0], link_materials[i]);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+583
to
+584
| int index = Program.Rand.Next(result.Count); | ||
| (result[n], result[index]) = (result[index], result[n]); |
| ClientCard temp = copy_cards[0]; | ||
| copy_cards[0] = copy_cards[i]; | ||
| copy_cards[i] = temp; | ||
| (copy_cards[i], copy_cards[0]) = (copy_cards[0], copy_cards[i]); |
Collaborator
There was a problem hiding this comment.
It do pass the build, will test it later.
mercury233/libWindbot@788e68b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move shuffle changes out of PR #248