The Easiest Hammer
Posted: Sat Sep 30, 2023 9:05 pm
The tiny 3x3 hammer thread and various other discussions on discord lead me down a rabbit hole of trying to create the fewest patterns hammer possible in base hexcasting. Specifically, find the fewest total patterns you have to draw out in order to put an iota list for a hammer spell on the stack. (this includes patterns required for embedding data). Ideally the goal should be a short spell that just works, requiring no other spells, and no other mods.
My first attempt was an idea to break the center block, then use trig to rotate a vector in a circle perpendicular to the block face, breaking the other 8 blocks. I was able to get down to 40 patterns using this method.
My second attempt was to use a nested Thoth gambit to iterate over a 3x3 area, and map this 3x3 to the surface I wanted to break by multiplying each number by the two surface basis vectors. This produced a hammer in just 36 patterns.
My third attempt was to use a double nested Thoth to iterate over a 3x3x3 area, and then project each vector to the plane defined by the surface normal. I was able to use a shortcut I learned from [object Object] for the projection, It turns out that taking the cross product has a similar effect to projecting a vector onto a plane; It always produces a vector that lies on the normal planes of both input vectors. This hammer took only 33 patterns, but has the major drawback of costing 3x as much media as other hammers.
Thinking about that last idea, I realized that if I had 9 vectors that form a square when flattened in the x, y, or z directions, I could produce a normal media cost hammer with very few patterns. It turns out that such a set of vectors does exist, and are connected to a mathematical concept called Latin Squares.
https://www.youtube.com/watch?v=Cnhr6VaQKlg
I tested this idea using an embedded list of vectors, and It worked perfectly. Math321 pointed out that it was possible to use the solution of a Sudoku puzzle to produce the 81 vectors required for creating a 9x9 hammer with this method as every Sudoku solution is a Latin Square, so we started calling these sets of vectors the "Sudoku vectors" of the hammer.
The last step to completion of the spell was removing the overhead of having to use Kirin's Ruler to produce the Sudoku vectors.
Because there must be one vector in every row, column, and stack, I can iterate over the rows and columns, and use some function to determine how high on the stack the vector should be.
It turns out that if I use the sum of the row and column index for the stack index, I get a shape that nearly works. The only issue is when both the row and column index is -1 or +1, resulting in a stack index of -2 or +2, which is outside the bounds of the 3x3x3.
To remedy this, -2 must be wrapped to +1, and +2 must be wrapped to -1. Instead of using the modulo pattern for this, I found a more compact method using the trig functions. It turns out that the function f(x) = sin(tan(x)) preserves -1, 0, and 1, but maps -2 to +0.817, and +2 to -0.817. It's okay that the function isn't super precise because when we call break block, it'll work if the vector is anywhere within the block volume (It always floors the vector to the block coordinate).
Putting it all together, the resulting spell:
Sage's Hammer (31 patterns)
I am confident that this is the fewest patterns possible to produce a hammer with base hexcasting. The compact nested Thoth plus the Sudoku method makes it quite a challenge to get anything even close.
My first attempt was an idea to break the center block, then use trig to rotate a vector in a circle perpendicular to the block face, breaking the other 8 blocks. I was able to get down to 40 patterns using this method.
Spoiler
Code: Select all
// rotary hammer
{
// get the pos and side
Mind's Reflection
Compass' Purification
Mind's Reflection
Alidade's Purification
Dioscuri Gambit
Archer's Distillation
Rotation Gambit II
Architect's Distillation
// break the center block
Prospector's Gambit
Break Block
// get the vectors that define the normal of the side
Gemini Decomposition
Vector Disintegration
Rotation Gambit
Vector Exaltation
Undertaker's Gambit
Division Distillation
// rotate about the center and break
{
Muninn's Reflection
Additive Distillation
Undertaker's Gambit
Gemini Decomposition
Huginn's Gambit
Sine Purification
Multiplicative Distillation
Rotation Gambit II
Cosine Purification
Multiplicative Distillation
Additive Distillation
Additive Distillation
Break Block
}
Numerical Reflection: 5.5 // roughly equal to pi * 7/4
Numerical Reflection: 9
Gemini Gambit // make 9 copies
Huginn's Gambit // save an initial angle to the ravenmind
Numerical Reflection: 8
Flock's Gambit
Thoth's Gambit
}
Spoiler
Code: Select all
// slinger's hammer
{
// get the pos and side
Mind's Reflection
Compass' Purification
Mind's Reflection
Alidade's Purification
Dioscuri Gambit
Archer's Distillation
Rotation Gambit II
Architect's Distillation
// get the vectors that define the normal of the side
Gemini Decomposition
Vector Disintegration
Rotation Gambit
Vector Exaltation
Undertaker's Gambit
Division Distillation
// create the iteration list
Numerical Reflection: -1
Numerical Reflection: 0
Numerical Reflection: 1
Numerical Reflection: 3
Flock's Gambit
Undertaker's Gambit
{
Multiplicative Distillation
Rotation Gambit II
{
Multiplicative Distillation
Additive Distillation
Additive Distillation
Break Block
}
Jester's Gambit
Thoth's Gambit
}
Jester's Gambit
Thoth's Gambit
}
Spoiler
Code: Select all
// wasteful hammer
{
Mind's Reflection
Compass' Purification
Mind's Reflection
Alidade's Purification
Dioscuri Gambit
Archer's Distillation
Rotation Gambit II
Architect's Distillation
{
{
{
Vector Exaltation
Division Distillation
Additive Distillation
Break Block
}
Numerical Reflection: 4
Fisherman's Gambit
Thoth's Gambit
}
Rotation Gambit
Thoth's Gambit
}
Numerical Reflection: -1
Numerical Reflection: 0
Numerical Reflection: 1
Numerical Reflection: 3
Flock's Gambit
Undertaker's Gambit
Undertaker's Gambit
Thoth's Gambit
}
Thinking about that last idea, I realized that if I had 9 vectors that form a square when flattened in the x, y, or z directions, I could produce a normal media cost hammer with very few patterns. It turns out that such a set of vectors does exist, and are connected to a mathematical concept called Latin Squares.
https://www.youtube.com/watch?v=Cnhr6VaQKlg
I tested this idea using an embedded list of vectors, and It worked perfectly. Math321 pointed out that it was possible to use the solution of a Sudoku puzzle to produce the 81 vectors required for creating a 9x9 hammer with this method as every Sudoku solution is a Latin Square, so we started calling these sets of vectors the "Sudoku vectors" of the hammer.
The last step to completion of the spell was removing the overhead of having to use Kirin's Ruler to produce the Sudoku vectors.
Because there must be one vector in every row, column, and stack, I can iterate over the rows and columns, and use some function to determine how high on the stack the vector should be.
It turns out that if I use the sum of the row and column index for the stack index, I get a shape that nearly works. The only issue is when both the row and column index is -1 or +1, resulting in a stack index of -2 or +2, which is outside the bounds of the 3x3x3.
To remedy this, -2 must be wrapped to +1, and +2 must be wrapped to -1. Instead of using the modulo pattern for this, I found a more compact method using the trig functions. It turns out that the function f(x) = sin(tan(x)) preserves -1, 0, and 1, but maps -2 to +0.817, and +2 to -0.817. It's okay that the function isn't super precise because when we call break block, it'll work if the vector is anywhere within the block volume (It always floors the vector to the block coordinate).
Putting it all together, the resulting spell:
Sage's Hammer (31 patterns)
Code: Select all
// sage hammer
{
// get the block coordinate, and the face normal
Mind's Reflection
Compass' Purification
Mind's Reflection
Alidade's Purification
Dioscuri Gambit
Archer's Distillation
Rotation Gambit II
Architect's Distillation
{
{
// build the sudoku vector
Dioscuri Gambit
Additive Distillation
Tangent Purification
Sine Purification
Vector Exaltation
// cross the sudoku vector with the face normal
Division Distillation
// add the coordinate offset, and break the block
Additive Distillation
Break Block
}
// inner loop
Rotation Gambit
Thoth's Gambit
}
// build the iteration list
Numerical Reflection: -1
Numerical Reflection: 0
Numerical Reflection: 1
Numerical Reflection: 3
Flock's Gambit
// copy it for the inner loop
Undertaker's Gambit
// start the outer loop
Thoth's Gambit
}