h-docs

Search

Search IconIcon to open search

Parameter: Patterns

The --patterns parameter for solution-finder is one of the harder parameters to understand. Patterns, in this case, is synonymous with queues, but potentially more broadly defined. This page is dedicated to providing a thorough explanation and examples on the various aspects and methods of specifying patterns.

It will be much easier (and useful) for users to understand the concepts of modern block stackers’ 7-Bag System which ties in closely to how patterns are defined. This page provides exercises that may require the reader to have sfinder, as it uses sfinder util seq to allow the reader to follow along. In standard sfinder syntax, write the following for the various given examples:

1
java -jar sfinder.jar util seq -p <example input>

Pattern Syntax

Begin by defining a single static queue: you can define a single pattern by simply writing the pieces in order.

  1. TILJSZO: returns only TILJSZO.
  2. TIL: returns only TIL.

Next, you can define bags. These are a set of pieces that sfinder gets pieces from. Bags are defined by placing pieces within square brackets [OSZ].

  1. T[OSZ]: returns TO, TS, and TZ
  2. [ILJ][TL]: returns IT, LT, JT, IL, LL, and JL.

From bags, you can specify how many pieces sfinder will pull from them at a time.

  1. T[OSZ]p1: also returns TO, TS, and TZ.
  2. [ILJO]p2: returns LI, IL, LJ, JL, LO, OL, IJ, JI, IO, OI, JO, and OJ.

Shortcuts

  1. Writing * is the same as writing [TILJSZO] (a full bag).
    • *p7 is the same as [TILJSZO]p7
  2. Writing ! after a bag will pull as many pieces as possible from that bag.
    • *! is the same as *p7
    • [ILJO]! is the same as [ILJO]p4
  3. Starting a bag with ^ indicates a full bag, but written pieces are excluded.
    • [^TI] is the same as [LJSZO].

Common Mistakes

  1. Incorrect Bags: This won’t run into an error similar to common mistakes #2 and #3, but is the most common mistake, sometimes even undetected. Make sure the bags and pieces you’re using are correct.
    • May include overlooking ! after writing a bag.
  2. Not Accounting For Hold: A field may require 7 pieces, so you may be inclined to define only 7 pieces, but with hold you may be able to use up to the 8th piece of a pattern. This may result in inaccurate results.
  3. Not Enough Pieces: when using sfinder functionalities that attempt to reach a certain field (e.g. percent or setup), you need to specify enough pieces to fill the field specified.
    • Error message: Message: Should specify equal to or more than X pieces: CurrentPieces=Y
  4. Duplicate Pieces: duplicate pieces won’t work. Bags should only have one of each piece.
    • [TIILJ] would return an error: Duplicate 'I' pieces in [] [position=3char] [SyntaxException].
    • Under normal play, duplicate pieces only appear at the beginning, so you wouldn’t need to include them in the bag: [TIILJ]I,[TILJ]
    • For abnormal circumstances, you can use Marfung37’s ExtendedSfinderPieces.
  5. Using “^” in Command Prompt: The ^ symbol is a special character for command prompt. To avoid errors when using it, you can do either option:
    • enclosing the text in quotation marks: [^T]"[^T]"
    • escaping the first ^ with another ^: [^T][^^T]