Skip to content
forked from tkhalymon/megaminx

It's a future emulator of a Rubik's puzzle "megaminx"

Notifications You must be signed in to change notification settings

genbtc/megaminx

 
 

Repository files navigation

GenBTC's Megaminx Solver v1.4.5 (last updated February 4, 2024)

LatestScreenshot

It's a working simulator of a Megaminx, a Rubik's ~~cube~~ Dodecahedron puzzle!

You can test your moves by rotating a virtual cube, that works just like the real thing.

Comes preloaded with over 100+ Megaminx algorithms, known sequences of moves that save you time.

It also can auto-solve itself now, and print out the moves!

Using this program will make you a Megaminx EXPERT!

Usage:


press H for on-screen Help (shown above):
spacebar Auto-spins the 3D render
Right click for Menu
Double click to rotate the current face clockwise. (+Shift to reverse).
Left drag spins Camera / spin Viewport (arrow keys too). MouseWheel Zooms
default Front Face is Light_Blue
Supports SaveFiles, Save & Restore
Supports instanciating a virtual Shadow Cube for experimental branching
Full List of Keyboard commands shown below:
Code made to take advantage of C++ features, to be std=c++17 compliant, minimal C used.
Open source, and editable, customizable. Love FOSS. I am open to taking suggestions/PRs also.
CMake build script (Makefile also included)

Compatible with Linux, Windows (maybe mac)

Build Instructions for CMake (CMakeLists.txt):
Easily Builds using CMake. (make sure its installed)
cmake build .
`cmake --build .` or regular `make` if no CMake

Compile, Build & run (Makefile)


Linux: You'll need the pre-requisities: `apt-get install g++ make freeglut3-dev`
Build with `make`, run with `./megaminx`
Windows: Compatible out of the box with Visual Studio 2017 "Open Folder w/ CMake".

Builds on "Linux for Windows" (MSYS2/MingW) / WSL(untested)


Requires Freeglut(mingw), OpenGL(windows), GLU(windows)
Download and Install MSYS2/MingW64 environment, and from the shell run:
Install pre-reqs: `pacman -S base-devel freeglut`
Re-Generate the project with cmake: `cmake -G "MSYS Makefiles" .` the last dot is the current dir.
Alternatively, default Makefile provided

Main Menu:


"Toggle Spinning"
"Algorithms ---->" = Human Bulk Rotate Algos
"AutoSolve Layer" = Computer Teleport InstaSolve by Layer (internally "pops-out"=aka cheating)
"AutoSolve Face " = Computer Teleport InstaSolve by Faces (Reset to solved position)
"AutoSolve Face" = Computer Teleport Current Face actions
"AutoModify Piece" = Computer Teleport can AutoSwap Pieces

Usage / Navigation:

Keyboard Commands:

"[Right Click] Actions Menu"
"[Dbl Click] Rotate Current >>"
"[F1-F8=F9] AutoSolve Layer# >>"
" +Shift CounterClockwise <<"
"[W/w] Rotate Upper Face "
"[S/s] Rotate Front Face "
"[A/a] Rotate Left Side "
"[D/d] Rotate Right Side"
"[Z/z] Rotate DownLeft "
"[C/c] Rotate DownRight "
"[X/x] Rotate Bottom Face "
"[Space] Toggle Auto-Spin"
"[BackSpace] Reset Camera"
"[Delete] Scramble Puzzle"
"[Enter] Solve Current Face"

Possible cube-state actions

"Rotate Current Face ClockWise"
"Solve/Reset Current Face (All)"
"Solve Current Face's Edges"
"Solve Current Face's Corners"
"Swap Face's Edges 1-5
"Swap Face's Corners 1-5

AutoSolve using Human Rotate Algorithms

"Solve White Star" = F1/
"Solve White Corners" = /F1
"2nd Layer Edges" = F2
"3rd Layer Corners" = F3
"4th Layer Edges" = F4
"5th Layer Corners" = F5
"6th Layer Edges" = F6
"7th Last Layer Edges" = F7
"7th Last Layer Corners" = F8
"All Layers at once" = F9

+Also Manual Last Layer solve commands for all of the above

Notation Algorithms (outdated. see "face.h" at the bottom for complete list and description. TODO: TBD.)


"r u R' U'"
"l u L' U'"
"U' L' u l u r U' R'"
"r u R' u r 2U' R'"
"u l U' R' u L' U' r"
"u r 2U' L' 2u R' 2U' l u"
"R' D' R D" ORIENT CORNER
"Edge Permutation 1": r2 U2' R2' U' r2 U2' R2' (5 to 2, 2 to 4, 4 to 5) HORSE
"Edge Permutation 2": r2 u2 R2' u r2 u2 R2' (5 to 4, 4 to 2, 2 to 5) HORSE
"Edge Permutation 3": r u R' F', r u R' U', R' f r2 U' R' (5 to 1, 1 to 2, 2 to 5) MUSHROOM
"Edge Permutation 4": r u R' u , R' U' r2 U', R' u R' u, r U2' (5 to 2, 2 to 1, 1 to 5) MUSHROOM
"Edge Permutation 5": l r u2, L' u R', l U' r u2, L' u2 R' (5 and 3 swap, 1 and 2 swap) BUNNY

For Developers:

Simplified Project Structure:
main.cpp - Main() entry point, GLUT callbacks, render function, keyboard/mouse handlers. the scaffolding structure hooks up to the megaminx engine, and frontend of the glut UI
main-menu.cpp - on screen display text. menu GUI. this file bridges the front end and the back end. such as what the algorithms are named or categories shown, what order, etc
engine/megaminx.cpp - Main puzzle. render() function draws geometry of each sub-piece. Everything in the cube is managed from interacting with this Megaminx* object
engine/shadow.cpp - Shadow Cube is a virtual version of the cube that only exists in memory, for theoretical play. It can be created and destroyed at whim without affecting the main visible one, and State can be "cloned" back and forth. Useful for iterating moves into the future, then throwing them away. a snapshot for you to revert. hot/cold version control.
engine/solve.cpp - longest function, all the actual cube transforms, that describe all the algorithms
engine/face.cpp - Conceptual heart of how the puzzle part is turned into code logic
engine/piece.h - base class common definitions for basing the following on:
engine/center.cpp - center primitive. Very simple openGL geometry. simple case statement abstracts important draw algorithm logic
engine/corner.cpp - corner primitive. a little bit more openGL geometry, same thing.
engine/edge.cpp - edge primitive. a little bit less openGL geometry, same thing.
engine/load.cpp - Saves State. save/restore from File support, and clone/destroy virtual shadow cube
ui/opengl.cpp - main orthographic viewport projection setup and various GL helpers
ui/camera.cpp - the viewport. everything moves by shifting the camera's projected view (code feels like a mirror)
Headers: bytes - headers filename 19326 - ./src/engine/face.h 11120 - ./src/engine/piece.h 7999 - ./src/engine/megaminx.h 5643 - ./src/engine/color.h 2096 - ./src/ui/camera.h 1683 - ./src/main.h 1513 - ./src/ui/opengl.h 311 - ./src/engine/corner.h 299 - ./src/engine/edge.h 269 - ./src/engine/center.h ============== ClassDiagram.png not fullly updated.
functions-face.txt is updated.

Programming Credits

genBTC - [email protected] - December 2017, all of 2018, and January 2019 and October 2019 - February 2020(C)
Updated README 2023 and tried to make better. Uses forked code originally from Taras Khalymon (tkhalymon) / @cybervisiontech / [email protected]

About

It's a future emulator of a Rubik's puzzle "megaminx"

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 82.8%
  • C 11.4%
  • Makefile 4.2%
  • CMake 1.3%
  • Meson 0.3%