{{
function nicolae_spider_hilbert_setup(e)
    e.tags('transparent uniq_nico_spacefill')
    e.depth('Spider')
    e.orient('float')
    e.kmons('0 = 0 / 0 band w:3')
    e.kmons('9 = 9 / 9 band w:3')
    e.kmons('8 = 8 / 8 band w:3')
    e.subst('DEFHJKLMNOPQRSZap = .')
    e.subst('- = x:350 .:645 %:25 0:30')
    e.subst('0 = 0:20 9:7 8:3')
    e.subst('% = %:20 *:5')
end

function nicolae_spider_subbert_setup(e)
    e.tags('unrand allow_dup')
    e.shuffle('PQR/pqr')
    e.subst('pq = .')
    e.subst('rP = -')
    e.subst('QR = x')
    e.subst('- = x:25 .:46 0:2 %:2')
end
}}


# Everybody's favorite space-filling curve generates a lot of twisty passages,
# perfect for the ambience of the Spider's Nest.
NAME:     nicolae_spider_hilbert_zone_1
SUBVAULT: D : nico_hilbert_41
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_41
SUBVAULT: J : nico_hilbert_31
SUBVAULT: K : nico_hilbert_31
SUBVAULT: L : nico_hilbert_31
SUBVAULT: M : nico_hilbert_31
SUBVAULT: N : nico_hilbert_31
SUBVAULT: O : nico_hilbert_61
SUBVAULT: P : nico_hilbert_61
SUBVAULT: Q : nico_hilbert_31
SUBVAULT: R : nico_hilbert_31
SUBVAULT: S : nico_hilbert_31
SUBVAULT: Z : nico_hilbert_31
SUBVAULT: a : nico_hilbert_21
: nicolae_spider_hilbert_setup( _G )
MAP
-...............-...............-
.---M---O---O---.---P---P---N---.
.-xMMMxOOOxOOOx-.-xPPPxPPPxNNNx-.
.-MMM-OOOOOOOOO-.-PPPPPPPPP-NNN-.
.MMMMOOOOOOOOOOO.PPPPPPPPPPPNNNN.
.-MMM-OOOOOOOOO-.-PPPPPPPPP-NNN-.
.-xMMMxOOOxOOOx-.-xPPPxPPPxNNNx-.
.---M---O-x-O---.---P-x-P---N---.
-........-x-....-....-x-........-
.---D---.-x-----L-----x-.---E---.
.-xDDDx-.-xxxxxLLLxxxxx-.-xEEEx-.
.-DDDDD-.-----LLLLL-----.-EEEEE-.
.DDDDDDD.....LLLLLLL.....EEEEEEE.
.-DDDDD-------L-.-L-------EEEEE-.
.-xDDDxxxxxxxxx-.-xxxxxxxxxEEEx-.
.-x-D-----------.-----------E-x-.
.-x-............-............-x-.
.-x-----J-------a-------K-----x-.
.-xxxxxJJJxxxxxaaaxxxxxKKKxxxxx-.
.-----JJJJJ-----a-----KKKKK-----.
-....JJJJJJJ....a....KKKKKKK....-
.---Q-J-.-J-R---a---S-K-.-K-Z---.
.-xQQQx-.-xRRRxaaaxSSSx-.-xZZZx-.
.-QQQQQ-.-RRRRR-a-SSSSS-.-ZZZZZ-.
.QQQQQQQ.RRRRRRR.SSSSSSS.ZZZZZZZ.
.-Q-.-Q-F-R-.-R-.-S-.-S-H-Z-.-Z-.
.-x-.-xFFFx-.-x-.-x-.-xHHHx-.-x-.
.-x-.-FFFFF-.-x-.-x-.-HHHHH-.-x-.
.-x-.FFFFFFF.-x-.-x-.HHHHHHH.-x-.
.-x---FFFFF---x-.-x---HHHHH---x-.
.-xxxxxFFFxxxxx-.-xxxxxHHHxxxxx-.
.-------F-------.-------H-------.
-...............-...............-
ENDMAP


# I figured, I already went to the trouble of making subvaults, might as well
# find another place to use them...
NAME:     nicolae_spider_hilbert_zone_2
SUBVAULT: D : nico_hilbert_41
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_41
SUBVAULT: J : nico_hilbert_61
SUBVAULT: K : nico_hilbert_61
SUBVAULT: L : nico_hilbert_31
SUBVAULT: M : nico_hilbert_31
SUBVAULT: N : nico_hilbert_31
SUBVAULT: O : nico_hilbert_31
SUBVAULT: P : nico_hilbert_61
SUBVAULT: Q : nico_hilbert_61
SUBVAULT: R : nico_hilbert_61
SUBVAULT: S : nico_hilbert_61
: nicolae_spider_hilbert_setup( _G )
MAP
-...............-...............-
.---D-------E---.---F-------H---.
.-xDDDxxxxxEEEx-.-xFFFxxxxxHHHx-.
.-DDDDD---EEEEE-.-FFFFF---HHHHH-.
.DDDDDDD.EEEEEEE.FFFFFFF.HHHHHHH.
.-DDDDD-.-EEEEE-.-FFFFF-.-HHHHH-.
.-xDDDx-.-xEEEx-.-xFFFx-.-xHHHx-.
.---D---.-x-E---.---F-x-.---H---.
-........-x-....-....-x-........-
.-------J-x-J---.---K-x-K-------.
.-xxxxxJJJxJJJx-.-xKKKxKKKxxxxx-.
.-x---JJJJJJJJJ-.-KKKKKKKKK---x-.
.-x-.JJJJJJJJJJJ.KKKKKKKKKKK.-x-.
.-x-.-JJJJJJJJJ-.-KKKKKKKKK-.-x-.
.-x-.-xJJJxJJJx-.-xKKKxKKKx-.-x-.
.-L-.-L-J---J---.---K---K-M-.-M-.
.LLLLLLL........-........MMM.MMM.
.-LLLLL-.---N-------O---.-MMMMM-.
.-xLLLx-.-xNNNxxxxxOOOx-.-xMMMx-.
.---L-x-.-NNNNN---OOOOO-.-x-M---.
-....-x-.NNNNNNN.OOOOOOO.-x-....-
.---P-x-.-N-Q-N-.-O-R-O-.-x-S---.
.-xPPPx-.-xQQQx-.-xRRRx-.-xSSSx-.
.-PPPPP-.-QQQQQ-.-RRRRR-.-SSSSS-.
.PPPPPPP.QQQQQQQ.RRRRRRR.SSSSSSS.
.-PPPPP---QQQQQ-.-RRRRR---SSSSS-.
.-xPPPxxxxxQQQx-.-xRRRxxxxxSSSx-.
.-PPPPP---QQQQQ-.-RRRRR---SSSSS-.
.PPPPPPP.QQQQQQQ.RRRRRRR.SSSSSSS.
.-PPPPP-.-QQQQQ-.-RRRRR-.-SSSSS-.
.-xPPPx-.-xQQQx-.-xRRRx-.-xSSSx-.
.---P---.---Q---.---R---.---S---.
-.......-.......-.......-.......-
ENDMAP


# Technically this is based on a Moore curve, not a Hilbert curve.
# I won't tell anyone if you don't.
NAME:     nicolae_spider_hilbert_zone_3
SUBVAULT: D : nico_hilbert_42
SUBVAULT: E : nico_hilbert_31
SUBVAULT: F : nico_hilbert_31
SUBVAULT: H : nico_hilbert_31
SUBVAULT: J : nico_hilbert_31
SUBVAULT: K : nico_hilbert_41
SUBVAULT: L : nico_hilbert_41
SUBVAULT: M : nico_hilbert_41
SUBVAULT: N : nico_hilbert_41
SUBVAULT: O : nico_hilbert_41
SUBVAULT: P : nico_hilbert_41
SUBVAULT: Q : nico_hilbert_41
SUBVAULT: R : nico_hilbert_41
SUBVAULT: S : nico_hilbert_31
SUBVAULT: Z : nico_hilbert_31
SUBVAULT: a : nico_hilbert_31
SUBVAULT: p : nico_hilbert_31
: nicolae_spider_hilbert_setup( _G )
MAP
-...........-.......-...........-
.-------S---.---E---.---Z-------.
.-xxxxxSSSx-.-xEEEx-.-xZZZxxxxx-.
.-x-----SSS-.-EEEEE-.-ZZZ-----x-.
.-x-....SSSS.EEEEEEE.ZZZZ....-x-.
.-x-K---SSS-.-E-.-E-.-ZZZ---L-x-.
.-xKKKxSSSxxxxx-.-xxxxxZZZxLLLx-.
.-KKKKK-S-------.-------Z-LLLLL-.
.KKKKKKK........-........LLLLLLL.
.-KKKKK-.---O---.---P---.-LLLLL-.
.-xKKKx-.-xOOOx-.-xPPPx-.-xLLLx-.
.-x-K---.-OOOOO-.-PPPPP-.---L-x-.
.-x-.....OOOOOOO.PPPPPPP.....-x-.
.-x-----F-OOOOO-D-PPPPP-H-----x-.
.-xxxxxFFFxOOOxDDDxPPPxHHHxxxxx-.
.-----FFF---O-DDDDD-P---HHH-----.
-....FFFF....DDDDDDD....HHHH....-
.-----FFF---Q-DDDDD-R---HHH-----.
.-xxxxxFFFxQQQxDDDxRRRxHHHxxxxx-.
.-x-----F-QQQQQ-D-RRRRR-H-----x-.
.-x-.....QQQQQQQ.RRRRRRR.....-x-.
.-x-M---.-QQQQQ-.-RRRRR-.---N-x-.
.-xMMMx-.-xQQQx-.-xRRRx-.-xNNNx-.
.-MMMMM-.---Q---.---R---.-NNNNN-.
.MMMMMMM........-........NNNNNNN.
.-MMMMM-a-------.-------p-NNNNN-.
.-xMMMxaaaxxxxx-.-xxxxxpppxNNNx-.
.-x-M---aaa---J-.-J---ppp---N-x-.
.-x-....aaaa.JJJJJJJ.pppp....-x-.
.-x-----aaa-.-JJJJJ-.-ppp-----x-.
.-xxxxxaaax-.-xJJJx-.-xpppxxxxx-.
.-------a---.---J---.---p-------.
-...........-.......-...........-
ENDMAP


# Not really based on anything but I wanted a smaller vault option.
NAME:     nicolae_spider_hilbert_zone_4
SUBVAULT: D : nico_hilbert_42
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_41
SUBVAULT: J : nico_hilbert_41
SUBVAULT: K : nico_hilbert_21
SUBVAULT: L : nico_hilbert_21
SUBVAULT: M : nico_hilbert_21
SUBVAULT: N : nico_hilbert_21
SUBVAULT: O : nico_hilbert_61
SUBVAULT: P : nico_hilbert_61
SUBVAULT: Q : nico_hilbert_31
SUBVAULT: R : nico_hilbert_31
: nicolae_spider_hilbert_setup( _G )
MAP
-...................-...........-
.-------------------.-----------.
.-xxxxxxxxxxxxxxxxx-.-xxxxxxxxx-.
.-------------K---K-.---------x-.
-............KKKKKKK.........-x-.
.---O---.---E-K-.-K-F---.---Q-x-.
.-xOOOx-.-xEEEx-.-xFFFx-.-xQQQx-.
.-OOOOO-.-EEEEE-.-FFFFF-.-QQQQQ-.
.OOOOOOO.EEEEEEE.FFFFFFF.QQQQQQQ.
.-OOOOO-N-EEEEE-D.FFFFF-L-Q-P-Q-.
.-xOOOxNNNxEEExDDDxFFFxLLLxPPPx-.
.-OOOOO-N---E-DDDDD-F---L-PPPPP-.
.OOOOOOON....DDDDDDD....LPPPPPPP.
.-OOOOO-N---H-DDDDD-J---L-PPPPP-.
.-xOOOxNNNxHHHxDDDxJJJxLLLxPPPx-.
.-R-O-R-N-HHHHH-D-JJJJJ-L-PPPPP-.
.RRRRRRR.HHHHHHH.JJJJJJJ.PPPPPPP.
.-RRRRR-.-HHHHH-.-JJJJJ-.-PPPPP-.
.-xRRRx-.-xHHHx-.-xJJJx-.-xPPPx-.
.-x-R---.---H-M-.-M-J---.---P---.
.-x-.........MMMMMMM............-
.-x---------.-M---M-------------.
.-xxxxxxxxx-.-xxxxxxxxxxxxxxxxx-.
.-----------.-------------------.
-...........-...................-
ENDMAP


# And smaller still.
NAME:     nicolae_spider_hilbert_zone_5
SUBVAULT: D : nico_hilbert_31
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_61
SUBVAULT: J : nico_hilbert_61
: nicolae_spider_hilbert_setup( _G )
MAP
-...........-...........-
.---E-------.-------F---.
.-xEEExxxxx-.-xxxxxFFFx-.
.-EEEEE---D-.-D---FFFFF-.
.EEEEEEE.DDDDDDD.FFFFFFF.
.-EEEEE-.-DDDDD-.-FFFFF-.
.-xEEEx-.-xDDDx-.-xFFFx-.
.---E-x-.---D---.-x-F---.
-....-x-.........-x-....-
.---H-x-H-------J-x-J---.
.-xHHHxHHHxxxxxJJJxJJJx-.
.-HHHHHHHHH---JJJJJJJJJ-.
.HHHHHHHHHHH.JJJJJJJJJJJ.
.-HHHHHHHHH-.-JJJJJJJJJ-.
.-xHHHxHHHx-.-xJJJxJJJx-.
.---H---H---.---J---J---.
-...........-...........-
ENDMAP


# Small and with stairs.
NAME:     nicolae_spider_hilbert_zone_6
DEPTH:    !Spider:1
SUBVAULT: D : nico_hilbert_41
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_41
SUBVAULT: J : nico_hilbert_41
SUBVAULT: K : nico_hilbert_41
SUBVAULT: L : nico_hilbert_41
SUBST:    { = {[(
: nicolae_spider_hilbert_setup( _G )
MAP
-.......................-
.---J---------------K---.
.-xJJJxxxxxxxxxxxxxKKKx-.
.-JJJJJ-----------KKKKK-.
.JJJJJJJ....-....KKKKKKK.
.-JJJJJ-D---.---E-KKKKK-.
.-xJJJxDDDx-.-xEEExKKKx-.
.-x-J-DDDDD-.-EEEEE-K-x-.
.-x-.DDDDDDD.EEEEEEE.-x-.
.-x-.-DDDDD-.-EEEEE-.-x-.
.-x-.-xDDDx-.-xEEEx-.-x-.
.-x-.---D---.---E---.-x-.
.-x--.......{.......--x-.
.-x-.---H---.---F---.-x-.
.-x-.-xHHHx-.-xFFFx-.-x-.
.-x-.-HHHHH-.-FFFFF-.-x-.
.-x-.HHHHHHH.FFFFFFF.-x-.
.-x-L-HHHHH-.-FFFFF-.-x-.
.-xLLLxHHHx-.-xFFFx-.-x-.
.-LLLLL-H---.---F-x-.---.
.LLLLLLL....-....-x-....-
.-LLLLL-----------x-----.
.-xLLLxxxxxxxxxxxxxxxxx-.
.---L-------------------.
-.......................-
ENDMAP


# Large and with stairs.
NAME:     nicolae_spider_hilbert_zone_7
DEPTH:    !Spider:1
SUBVAULT: D : nico_hilbert_41
SUBVAULT: E : nico_hilbert_41
SUBVAULT: F : nico_hilbert_41
SUBVAULT: H : nico_hilbert_41
SUBVAULT: J : nico_hilbert_31
SUBVAULT: K : nico_hilbert_31
SUBVAULT: L : nico_hilbert_31
SUBVAULT: M : nico_hilbert_31
SUBVAULT: N : nico_hilbert_41
SUBVAULT: O : nico_hilbert_41
SUBVAULT: P : nico_hilbert_41
SUBVAULT: Q : nico_hilbert_21
SUBVAULT: R : nico_hilbert_21
SUBVAULT: S : nico_hilbert_21
SUBVAULT: Z : nico_hilbert_21
SUBVAULT: a : nico_hilbert_21
SUBVAULT: p : nico_hilbert_21
SUBST:    { = {[(
: nicolae_spider_hilbert_setup( _G )
MAP
....-.......................-....
.---.-----------------------.---.
.-x-.-xxxxxxxxxxxxxxxxxxxxx-.-x-.
.---.-Q---Q-----------R---R-.---.
-....QQQQQQQ.........RRRRRRR....-
.---Z-Q-N-Q-.---K---.-R-O-R-S---.
.-xZZZxNNNx-.-xKKKx-.-xOOOxSSSx-.
.-x-Z-NNNNN-.-KKKKK-.-OOOOO-S-x-.
.-x-ZNNNNNNN.KKKKKKK.OOOOOOOS-x-.
.-x-Z-NNNNN-D-K-.-K-E-OOOOO-S-x-.
.-xZZZxNNNxDDDx-.-xEEExOOOxSSSx-.
.-x-Z---N-DDDDD-.-EEEEE-O---S-x-.
.-x-.....DDDDDDD.EEEEEEE.....-x-.
.-x-.---J-DDDDD-.-EEEEE-L---.-x-.
.-x-.-xJJJxDDDx-.-xEEExLLLx-.-x-.
.-x-.-JJJ---D---.---E---LLL-.-x-.
.-x-.JJJJ.......{.......LLLL.-x-.
.-x-.-JJJ---H---.---F---LLL-.-x-.
.-x-.-xJJJxHHHx-.-xFFFxLLLx-.-x-.
.-x-.---J-HHHHH-.-FFFFF-L---.-x-.
.-x-.....HHHHHHH.FFFFFFF.....-x-.
.-x-a---P-HHHHH-.-FFFFF-----.-x-.
.-xaaaxPPPxHHHx-.-xFFFxxxxx-.-x-.
.-x-a-PPPPP-H-M-.-M-F-x-----.-x-.
.-x-aPPPPPPP.MMMMMMM.-x-.....-x-.
.-x-a-PPPPP-.-MMMMM-.-x-.-----x-.
.-xaaaxPPPx-.-xMMMx-.-x-.-xxxxx-.
.---a-p-P-p-.---M---.-x-.-----x-.
-....ppppppp.........-x-.....-x-.
.---.-p---p-----------x-----.-x-.
.-x-.-xxxxxxxxxxxxxxxxxxxxx-.-x-.
.---.-----------------------.---.
....-.......................-....
ENDMAP


# Hilbert subvaults ############################################################

NAME: nicolae_spider_hilbert_2_sides_1_open
TAGS: nico_hilbert_21
: nicolae_spider_subbert_setup( _G )
MAP
 x   -
-x-....
 x   -
ENDMAP


NAME: nicolae_spider_hilbert_3_sides_1_open
TAGS: nico_hilbert_31
: nicolae_spider_subbert_setup( _G )
MAP
   P
  RQR
 r-P-x
pqp.-x-
 r   x
ENDMAP


NAME: nicolae_spider_hilbert_4_sides_1_open
TAGS: nico_hilbert_41
: nicolae_spider_subbert_setup( _G )
MAP
   -
  xxx
 x---x
-x-.-x-
 x-.-x
  -.-
   .
ENDMAP


NAME: nicolae_spider_hilbert_4_sides_2_open
TAGS: nico_hilbert_42
: nicolae_spider_subbert_setup( _G )
MAP
   P
  RQR
 r-P-x
pqp.-x-
 r-.-x
  -.-
   .
ENDMAP


NAME: nicolae_spider_hilbert_6_sides_1_open
TAGS: nico_hilbert_61
: nicolae_spider_subbert_setup( _G )
MAP
   P   -
  RQR xxx
 r-P-----x
pqp.....-x-
 r-------x
  xxx xxx
   -   -
ENDMAP

################################################################################
