Skip to content

Rubik 3D-Simulator in Python using Pygame and Quaternions

License

Notifications You must be signed in to change notification settings

igor-marinescu/RubikQuat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RubikQuat

Alt RubikQuatScreen

RubikQuat is a 3D Rubik Simulator program, written entirelly in Python by means of Pygame modules. A simple 3D-Engine is implemented using only the basic 2D-graphics. The orientation in space and rotation is calculated using Quaternions. The purpose for which RubikQuat was created:

  • Learn Python and experiment with Pygame
  • Study Rubik's mechanics
  • Research Quaternions
  • Implement simple 3D-Engine

Run

Using python:

$ python -m rubikquat_src

Under Windows: There is a build for Windows (using py2exe) which allows to run the application even without Python. Unpack the content of the build_zip folder and execute .\build\rubikquat.exe.

Help

Alt RubikQuatHelp

Help screen is displayed when RubikQuat application starts. It can also be invoked each time by pressing the F1 Key or clicking the '?'-button (top-left). Press Esc or mouse left-click to close the help and return to Rubik screen.

Controls

Key Function Key Function
L Flip Left-Face clockwise Left Rotate Rubik along Y-axis
Shift+L Flip Left-Face counterclockwise Right Rotate Rubik along Y-axis
R Flip Right-Face clockwise Up Rotate Rubik along X-axis
Shift+R Flip Right-Face counterclockwise Down Rotate Rubik along X-axis
F Flip Front-Face clockwise Pg-Up Rotate Rubik along Z-axis
Shift+F Flip Front-Face counterclockwise Pg-Down Rotate Rubik along Z-axis
U Flip Top-Face clockwise Ctrl+Z Undo the last move
Shift+U Flip Top-Face counterclockwise Ctrl+Y Redo a move
F1 Show Help S Scramble the Rubik

You can also do all the above actions by clicking with mouse on corresponding button. Rotate the Rubik using mouse - just drag the Rubik in the direction you want to rotate it. The mouse-wheel rotates the Rubik along Z-axis.

Development

Clean the build:

> make clean

Build the .\build\rubikquat.exe using py2exe:

> make setup

Virtual environment:

> virtualenv venv
> venv\Scripts\activate
> pip install -r requirements.txt

License

GNU GPL3. See the LICENSE.md file for details.

Author

Igor Marinescu

About

Rubik 3D-Simulator in Python using Pygame and Quaternions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages