Skip to content

Weighted shuffle#56

Open
qadan wants to merge 10 commits intoauthorblues:mainfrom
qadan:weighted-shuffle
Open

Weighted shuffle#56
qadan wants to merge 10 commits intoauthorblues:mainfrom
qadan:weighted-shuffle

Conversation

@qadan
Copy link

@qadan qadan commented Aug 23, 2022

Adds a Random (Boost Unpicked) option to the list of swap modes. This fudges the randomness a bit such that the longer a game goes without being picked, the more likely it is to get picked.

Why?

For casual sessions, it can be desirable provide/showcase a broad variety that "feels" more random, even though it isn't.

How?

Picking the Random (Boost Unpicked) swap mode will cause the shuffler to hang onto a game_weights table in the config. All game weights are initialized to 0. When picking a game, the list of games to choose from is padded with copies of each game, based on its current game weight - except for the previously selected game, which is reset to 0. All games then have their weight increased by one.

New games should be accounted for, and games are removed from the weights list when they are marked complete.

Notes

The games list could get super big. But 64 bit lua is probably good for it. Could test and see if it gets nasty with a massive list over a long time if it comes to that.

@TheT113
Copy link

TheT113 commented Jul 27, 2023

I wanted to try this out, but when running the LUA I get error: "NLua.Exceptions.LuaScriptException: [string "main"]:169: invalid escape sequence near ''.'"

I am downloading the entire package directly from your branch.

@MrDannyPicard
Copy link

I'd like to use this myself but i get error:
" NLua.Exceptions.LuaScriptException: [string "main"]:169: invalid escape sequence near ''.' "

I've tried to swap this section with the original one but then i get another error on line 369, which i also try changing back to the original code, but at that point i get an error to use bizhawk v 2.6.1 (something about lua core)

Do you have any plan to fix this or should i give up?

Thanks.

@SushiKishi SushiKishi mentioned this pull request Apr 13, 2025
@SushiKishi
Copy link

I've taken a stab at adding this feature. I very much started with what qadan initially provided as far as figuring out how to get the info I needed and where to start at in the code, but I took a slightly different approach to the execution.

I haven't submitted a pull request yet because I'd like someone other than me to at least look it over first, but you can find the branch here.

This was referenced Apr 13, 2025
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.

4 participants