Class SeedSearch.Builder

java.lang.Object
moe.maika.ygofm.gamedata.SeedSearch.Builder
Enclosing class:
SeedSearch

public static class SeedSearch.Builder extends Object
A builder for SeedSearch instances. Use a new builder for each search.

The builder is not thread-safe and should not be reused after building an instance.

  • Constructor Details

    • Builder

      public Builder(Deck deck, List<Card> drawnCards)
      Creates a new builder for a seed search.
      Parameters:
      deck - the deck
      drawnCards - the cards drawn from the deck in the order they were drawn
  • Method Details

    • withSort

      public SeedSearch.Builder withSort(Comparator<? super Card> sorter)
      Sets the sort order for the deck. The default is to sort by card ID.
      Parameters:
      sorter - the sort performed on the Build Deck screen before the duel
      Returns:
      this builder
    • withSpace

      public SeedSearch.Builder withSpace(int end)
      Sets the range of seeds to explore. The default is 0 to 5,000,000.
      Parameters:
      end - the end of the seed space to explore
      Returns:
      this builder
    • withSpace

      public SeedSearch.Builder withSpace(int start, int end)
      Sets the range of seeds to explore. The default is 0 to 5,000,000.
      Parameters:
      start - the start of the seed space to explore
      end - the end of the seed space to explore
      Returns:
      this builder
    • withCallbackAfterEachIteration

      public SeedSearch.Builder withCallbackAfterEachIteration(Runnable callback)
      Sets a callback to be run after each iteration of the search. This can be used to provide feedback to the user or to cancel the search.
      Parameters:
      callback - the callback to run after each iteration of the search
      Returns:
      this builder
    • withCallbackAfterEachHit

      public SeedSearch.Builder withCallbackAfterEachHit(Consumer<RNG> callback)
      Sets a callback to be run after each successfully found seed. This can be used to provide feedback to the user or to cancel the search.
      Parameters:
      callback - the callback to run after each hit in the search
      Returns:
      this builder
    • withInitialSeed

      public SeedSearch.Builder withInitialSeed(RNG initialSeed)
      Sets the initial seed to use for the search. The default is 0x55555555 (the value initialized after boot on the Konami screen).
      Parameters:
      initialSeed - the initial seed to use for the search
      Returns:
      this builder
    • build

      public SeedSearch build()
      Builds the seed search.
      Returns:
      the seed search