Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miyucomics
Copy link
Contributor

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.

@@ -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))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.618033988749895 :3

Copy link
Contributor Author

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.

@Alwinfy
Copy link
Collaborator

Alwinfy commented Jul 14, 2025

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]

@miyucomics
Copy link
Contributor Author

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 tau 2 div each time. By that logic, why not phi too? It's mechanically trivial to compute, yes, but noisy in context when you look over a hex and have to lexiconize 5 0.5 pow 1 add 0.5 mul as "the patterns that push the golden ratio." It saves players the operations it would take to calculate that number by just having it as a reflection.

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.

@miyucomics
Copy link
Contributor Author

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.

@miyucomics
Copy link
Contributor Author

miyucomics commented Jul 14, 2025

Question about PRing: should I be running datagen and pushing the altered datagen cache files?

@miyucomics
Copy link
Contributor Author

Hmm, I thought if I just git rm them, it would note that my PR never actually needed to track these files and stop tracking the .cache files that are preventing a clean merge.

Copy link

@PoolloverNathan PoolloverNathan left a 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)

Comment on lines 1791 to +1792
"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.",

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
Suggested change
"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.",

Comment on lines 697 to +698
"e": "Euler's Reflection",
"phi": "Harmony Reflection",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"e": "Euler's Reflection",
"phi": "Harmony Reflection",
e: "Euler's Reflection",
phi: "Harmony Reflection",

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🏗 In progress in Hex Casting Jul 14, 2025
@object-Object
Copy link
Member

object-Object commented Jul 14, 2025

Question about PRing: should I be running datagen and pushing the altered datagen cache files?

Ideally you should do a rebase to remove cef485d and undo your datagen changes in 41371c1, then rebase onto main. We just removed the datagen cache files in #906.

@object-Object
Copy link
Member

object-Object commented Jul 14, 2025

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]

I have a specific use case: my Entity Cannon hex uses golden-section search, and a phi pattern would make that a bit simpler.

https://github.com/object-Object/hex-hexes/blob/4326f0c041292927a2780c89117c1ca9e61af4dc/macros/Entity_Cannon.hexpattern#L413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

5 participants