Hi folks! I’ve been working on the Rubik’s cube game in Elm using WebGL. The goal of the project was to experiment with complex user interactions and learn how to do ray tracing.
Using the same function to handle a particular message and also to conditionally subscribe to the corresponding subscription. You can find some similarities between update and subscription functions in the Main.elm.
Modelling rotations as quaternions and using elm-animation library for transitions between rotations (for start game/end game transitions).
Rendering text in 3D by defining a mesh as a layer of cubes, but then selectively discarding some of them in the vertex shader using the texture lookup.
I don’t know if you have seen my ai-search library: https://github.com/the-sett/ai-search. I have recently learned how to solve the Rubiks cube myself, and would be interested in writing a solver for it in Elm. Did you already write a solver for your game? If not, I could try and contribute one to your animated cube game.
===
Although, there is an easy way to write a solver that cheats. Just record the sequence of moves made when you shuffle the cube, and then play that back in reverse order.
So what exactly is going on in the value of this declaration? Is this valid elm syntax here? Is there a step before the Elm compiler that replaces this with something else? Or is [glsl| some kind of special Elm syntax that the compiler actually understands? Are other languages understood here? ([js| /* ... */ |], etc.).
I’ve never seen anything like this before. I didn’t see any explanation for this, so I was wondering if anyone could explain how this works. Thanks!
@rupert this sounds interesting! Currently, the cube has a physical model with positions in 3d, because it is easier for rendering and interactions.
To solve it we need a way to convert it into a simpler model, solve it, and then convert it back & convert back the steps to represent them as a list of Transformation.
Let’s get in touch on Elm slack to discuss it further. I will have some time next week.
So the [glsl| … |] syntax is actually built into Elm, and not by a custom | operator defined in the webgl package? Something to add to the thread on here about lesser known syntax.
Yes, a different model is better suited to solving than rendering, I’m not sure yet what the best way of modelling for solving is, in a functional language. I’ll have some time here and there over the next few weeks, so yes to a chat on Slack.