-
Notifications
You must be signed in to change notification settings - Fork 99
Added Harmony Reflection #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -464,6 +464,9 @@ public class HexActions { | |||
public static final ActionRegistryEntry CONST$E = make("const/double/e", | |||
new ActionRegistryEntry(HexPattern.fromAngles("aaq", | |||
HexDir.EAST), Action.makeConstantOp(new DoubleIota(Math.E)))); | |||
public static final ActionRegistryEntry CONST$PHI = make("const/double/phi", | |||
new ActionRegistryEntry(HexPattern.fromAngles("wdded", | |||
HexDir.NORTH_EAST), Action.makeConstantOp(new DoubleIota(1.618)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.618033988749895
:3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only added three decimal places because of Hex's double tolerance, but I realize that you could probably scale it up to get more digits. I'll update it.
honestly with how easy this is to compute (5 0.5 pow 1 add 0.5 mul) i don't feel great about this taking up a whole pattern slot; pi/tau are in the stdlib [why is tau in the stdlib?] because they're transcendental and very annoying to approximate. is there a specific use-case you have for this? would you be willing to let this be a scribe's refl. easter egg? [read off a gold item] |
There are (virtually) infinite pattern slots, right? I know phi is easy to compute, but so is e via its Taylor series and that made it into the standard library. Tau is there, I assume because it's the more "pure" circle constant, and pi is there, I assume because people don't want to have to do I'd actually say that e has fewer gameplay applications than phi for most people. Phi is nice for geometry. I wanted to add it because I was working on a little project (scattering points evenly across a sphere using the Fibonacci sphere technique in order to send raycasts off in all directions) and the golden ratio as a readily-accessible pattern would have been really helpful. There is also the more famous use of sunflower-like configurations, spiral tilings, and phyllotaxis. Even if phi isn't frqeuently used, it's just a nice number that encapsulates a nice idea. Sure, one could work around it by embedding or computing it but that is so much overhead for a constant that could just be baked in. The pull request is already here, it isn't competing with any more useful patterns, it saves op counts like Dioscuri's Gambit, and it might nudge players towards some fun uses. There isn't any harm I see in including it and the upside is small and sweet. |
I would be interested in making it a Scribe's Reflection Easter egg and I could add that too if people like it enough (golden apple maybe? Sunflower?), but I think it still would be a nice pattern on its own. The pie Easter egg for example doesn't come with any numbers that you yourself can't use the Arc Reflection for. |
Question about PRing: should I be running datagen and pushing the altered datagen cache files? |
Hmm, I thought if I just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but some minor formatting nitpicks (and the description)
"e": "Adds $(italic)e/$, the base of natural logarithms, to the stack.", | ||
"phi": "Adds $(italic)φ/$, the ratio of a whole to its greater part, to the stack.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- description probably needs some work (tentative description suggested; what does the golden ratio do again?)
- I'd unquote phi (and e) for consistency
- other greek letters aren't italicized
"e": "Adds $(italic)e/$, the base of natural logarithms, to the stack.", | |
"phi": "Adds $(italic)φ/$, the ratio of a whole to its greater part, to the stack.", | |
e: "Adds $(italic)e/$, the base of natural logarithms, to the stack.", | |
phi: "Adds φ, the golden ratio, to the stack.", |
"e": "Euler's Reflection", | ||
"phi": "Harmony Reflection", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"e": "Euler's Reflection", | |
"phi": "Harmony Reflection", | |
e: "Euler's Reflection", | |
phi: "Harmony Reflection", |
I have a specific use case: my Entity Cannon hex uses golden-section search, and a phi pattern would make that a bit simpler. |
Adds a reflection for the golden ratio. It seems fitting because there is a pattern for pi and a separate one for tau, so why not one for phi.