Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ar664
Copy link

@ar664 ar664 commented Jan 7, 2025

This is a brute force approach to looking for items in a seed given some variables. It works by checking every item that you can encounter in ante(s) against your list of items.

itemList is the items you want to find
amountList is the amount of each item you want to find
anteList is how deep an ante you want to go for each item

Think of it as whiteboard code as I haven't tested it, just trying to get a feel for what direction you were thinking of. It's incomplete and could be optimized further, was just giving this a concept review before further refinement.

Another thing I was thinking about was lua or json as a scripting languag, but that's outside my expertise atm.

@MathIsFun0
Copy link
Collaborator

Hmm, this is a good start towards generalized filters.

My idea was to use a JSON system to create filters like these with many more capabilities. There should be some discussion on how exactly that would work before we get into integrating JSON with something like this

@ar664
Copy link
Author

ar664 commented Jan 7, 2025

It would probably be helpful to have an enum for itemtype and a generalized search function for each type. Itemtype referring to the comments in the item enum (i.e. below). What do you think?

https://github.com/MathIsFun0/Immolate/blob/448ae244760d0feb6f8d43a0a5244b2088cf4e48/src/items.hpp#L10-L13
https://github.com/MathIsFun0/Immolate/blob/448ae244760d0feb6f8d43a0a5244b2088cf4e48/src/items.hpp#L180

enum ItemType {
    Jokers,
    Vouchers,
    ..
    Enhancements,
    Hands
}
long searchForType(Instance inst, ItemType itype, int ante)
    switch (itype)
        case Jokers:
            return searchForJokers(inst, ante);
        ..
        default:
            return 0;
}

@ar664
Copy link
Author

ar664 commented Jan 8, 2025

@MathIsFun0 I created a filters.hpp and filters.cpp with a sample class. Ideally it would just be plug and play with your current threading system, but I don't have much experience in C++ threading to say.

I can't build & test stuff on my end because I'm just using a steam deck and getting a dev environment working on there is a pain. Hence why I'm just writing boiler plate code to suggest paths to take.

I made some "efficiency" changes like doing a for loop on the ante instead of the search list. It's still brute force, but doesn't check every item for every type. I noticed one of your latest commits mentioned instance.next over instance.reset, would that effect something like this?

Awfully slow at ~1m-500k seeds/s with just the search for 1 joker
Further optimizations needed, but it did find seeds with a blueprint joker in shop.
@ar664
Copy link
Author

ar664 commented Jan 15, 2025

I was able to get it to build and test on my steam deck. The filter is slow, but I think it has some room for optimization. Probably limiting/better function calls or using less memory.

I might wait on the SIMD branch to see how you are going to use that.

What JSON library were you planning to use if any? I think I can start working on that if you like the direction I'm going.

Started using Tracy to profile the performance.
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