Customizable Cuboid Iterator

Post your coolest Hexcasting creations here.

New topics are NOT for chatting or asking help, put those in the comments of a post or in a different forum.
User avatar
Robotgiggle
Posts: 22
Joined: Fri Dec 02, 2022 12:38 am

Customizable Cuboid Iterator

Post by Robotgiggle »

int, int, int, vec ––>

This spell takes three integers and a vector, and iterates over each block in a cuboid defined by the inputs. The three numbers define the size of the cuboid, with the first number representing the width along the X axis, the second number representing the height along the Y axis, and the third number representing the depth along the Z axis. The vector defines the bottom-north-west corner of the cuboid, serving as a starting point for the rest of the spell to iterate from.

The most obvious use for this is to break all the blocks in the cuboid, and as such the documentation below applies Break Block to each location. However, there are plenty of other uses for iterating over a cuboid. The Break Block spell can be replaced by whatever spell or effect you want, so long as it consumes a vector and doesn't return anything.

Due to the meta-evalutation cap, this spell won't work on cuboids larger than 8x8x8 blocks. The removal of the cap in the next update will allow for slightly larger cuboids, but the new 1mil pattern limit will still keep the size relatively constrained. If you want to iterate over a larger cuboid, try using loop unrolling.

Code: Select all

Huginn's Gambit
{
  {
    {
      Muninn's Reflection
      Gemini Decomposition
      Break Block
      Additive Distillation
      Huginn's Gambit
    }
    Vector Reflection +Z
    Numerical Reflection: 4
    Fisherman's Gambit II
    Gemini Gambit
    Flock's Reflection
    Numerical Reflection: 3
    Subtractive Distillation
    Fisherman's Gambit II
    Flock's Gambit
    Thoth's Gambit
    Bookkeeper's Gambit: v-v
    Muninn's Reflection
    Additive Distillation
    Jester's Gambit
    Vector Reflection -Z
    Multiplicative Distillation
    Additive Distillation
    Huginn's Gambit
  }
  Vector Reflection +Y
  Numerical Reflection: 4
  Fisherman's Gambit II
  Gemini Gambit
  Flock's Reflection
  Numerical Reflection: 2
  Subtractive Distillation
  Fisherman's Gambit II
  Flock's Gambit
  Thoth's Gambit
  Bookkeeper's Gambit: v-v
  Muninn's Reflection
  Additive Distillation
  Jester's Gambit
  Vector Reflection -Y
  Multiplicative Distillation
  Additive Distillation
  Huginn's Gambit
}
Vector Reflection +X
Numerical Reflection: 4
Fisherman's Gambit II
Gemini Gambit
Flock's Reflection
Numerical Reflection: 1
Subtractive Distillation
Fisherman's Gambit II
Flock's Gambit
Thoth's Gambit
Bookkeeper's Gambit: vvvv
Huginn's GambitqqqqqqqqqMuninn's ReflectionGemini DecompositionBreak BlockAdditive DistillationHuginn's GambiteeeVector Reflection +ZNumerical Reflection: 4Fisherman's Gambit IIGemini GambitFlock's ReflectionNumerical Reflection: 3Subtractive DistillationFisherman's Gambit IIFlock's GambitThoth's GambitBookkeeper's Gambit: Drop 1, Keep 1, Drop 1Muninn's ReflectionAdditive DistillationJester's GambitVector Reflection -ZMultiplicative Dstl.Additive DistillationHuginn's GambiteeeVector Reflection +YNumerical Reflection: 4Fisherman's Gambit IIGemini GambitFlock's ReflectionNumerical Reflection: 2Subtractive DistillationFisherman's Gambit IIFlock's GambitThoth's GambitBookkeeper's Gambit: Drop 1, Keep 1, Drop 1Muninn's ReflectionAdditive DistillationJester's GambitVector Reflection -YMultiplicative Dstl.Additive DistillationHuginn's GambiteeeVector Reflection +XNumerical Reflection: 4Fisherman's Gambit IIGemini GambitFlock's ReflectionNumerical Reflection: 1Subtractive DistillationFisherman's Gambit IIFlock's GambitThoth's GambitBookkeeper's Gambit: Drop 4
Last edited by Robotgiggle on Wed Apr 12, 2023 12:48 pm, edited 3 times in total.
Ant
Posts: 1
Joined: Fri Dec 02, 2022 3:41 am

Re: Customizable Cuboid Iterator

Post by Ant »

Line 25 "Vector Reflection +Z" should actually be a "Vector Reflection -Z" that's the reset Z function, it's adding more to the Z by accident
User avatar
Robotgiggle
Posts: 22
Joined: Fri Dec 02, 2022 12:38 am

Re: Customizable Cuboid Iterator

Post by Robotgiggle »

fixed