En:Res.puzzle

Aus EnigmaWiki

Wechseln zu: Navigation, Suche

The puzzle resolver helps you to reduce the number of required tile declarations for clusters of st_puzzle stones. By usage of the cluster attribute of st_puzzle you can easily set clusters of fully connected stones. But for irregular, internally just partial connected puzzles you often need a bunch of similar tile declarations that differ just in the connections attribute value.

Like res.autotile this resolver offers autotiling. You just define one template tile and can use all connections variations. Additonally this resolver registers every puzzle stone set and allows you to shuffle the puzzle clusters. You can even select shuffle algorithms and define accessible sides of a puzzle.

Location:
This resolver is part of the library libpuzzle as of release 3. You can use it by adding the following dependency to your level el:compatibility:

<el:dependency el:path="lib/libpuzzle" el:id="lib/libpuzzle" el:release="3" el:preload="true"/>

Syntax:
res.puzzle(subresolver, rules)

Description:

  • subresolver: Resolver to which unresolved requests should be forwarded. May be ti as the final resolver of the resolver chain.
  • rules = rule, rule,...: One rule or as many as you like, all seperated by a comma.
  • rule: The string of the template tile key that is the common tile key prefix for all autogenerated tile declarations.

Syntax Samples:

res.puzzle(ti, "B", "Y", "I", "M")

Details:
The puzzle resolver assumes a tile key length of two or more characters. The given rules are prefix strings which need concat with a one character suffix to a standard tile key. Given a rule with a proper template rule you can use any of the following suffices without tile declaration:

Suffix Solid Suffix Hollow Cluster Connections
"0" "5" 0 autoconnect
"1" "6" 1 autoconnect
"2" "7" 2 autoconnect
"3" "8" 3 autoconnect
"4" "9" 4 autoconnect
" " "+" nil ""
"a" "A" nil "w"
"b" "B" nil "s"
"c" "C" nil "sw"
"d" "D" nil "e"
"e" "E" nil "ew"
"f" "F" nil "es"
"g" "G" nil "esw"
"h" "H" nil "n"
"i" "I" nil "nw"
"j" "J" nil "ns"
"k" "K" nil "nsw"
"l" "L" nil "ne"
"m" "M" nil "new"
"n" "N" nil "nes"
"o" "O" nil "nesw"
"p" "P" 10 autoconnect
"q" "Q" 11 autoconnect
"r" "R" 12 autoconnect
"s" "S" 13 autoconnect
"t" "T" 14 autoconnect
"u" "U" 15 autoconnect
"v" "V" 16 autoconnect
"w" "W" 17 autoconnect
"x" "X" 18 autoconnect
"y" "Y" 19 autoconnect
"z" "Z" 20 autoconnect

All puzzle stones set by this resolver will be registered and shuffled by default with the intensity of 3. You can define other intensity attribute values on any puzzle stone. The maximum intensity of all stones in a cluster will be taken. The intensity multiplied by the number of stones in a cluster describes the number of inverse pushes, called pulls, that will be performed during shuffling. Thus an intensity of 3 on a cluster of 6 stones will perform 18 pulls. That means it is guaranteed that you can solve the puzzle with 18 pushes. But as some pull operations may neutralize the user may be able to solve such a shuffled puzzle with less than 18 pushes.

If you define no shuffle algorithm it is assumed that the user can rotate the puzzle from any side and any st_puzzle. The requested number of shuffling pull operations will be performed from random puzzle stones in a manner that gurantees that the user can solve the puzzle if he has free access to all sides.

If you set the algorithm on any of the puzzle stones to the value "marked" the resolver registers that the user has no free access, but just from positions that you did mark. You do mark a position by setting the attribute "push_directions" on a floor. All floors adajacent to outer puzzle stones from which a user can push rotate a puzzle will be checked for this attribute. If its string value, a substring of "nesw", contains the character of the required push direction this push event will take part in the random reverse shuffling process. Note that hollow stones and their restriction of not being able to initiate a rotation if fully respected on shuffling.

Persönliche Werkzeuge