https://github.com/srvariable/rubikcube
Play with a Rubik Cube in your own terminal!
https://github.com/srvariable/rubikcube
c game open-source terminal
Last synced: 7 months ago
JSON representation
Play with a Rubik Cube in your own terminal!
- Host: GitHub
- URL: https://github.com/srvariable/rubikcube
- Owner: SrVariable
- Created: 2023-12-20T10:15:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T13:47:33.000Z (about 2 years ago)
- Last Synced: 2025-02-24T23:50:12.233Z (about 1 year ago)
- Topics: c, game, open-source, terminal
- Language: C
- Homepage:
- Size: 65.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RubikCube
## Table of Contents
> 1. [Description](#description)
> 2. [Requirements](#requirements)
> 3. [Usage](#usage)
> 4. [Movements](#movements)
> 5. [How to Play](#how-to-play)
## Description
Terminal Based Game of a [Rubik's Cube](https://en.wikipedia.org/wiki/Rubik%27s_Cube). Each face is represented with a colored square emoji.
The colors available are:
- 🟧 Orange (Up face)
- 🟨 Yellow (Front face)
- 🟩 Green (Right face)
- 🟥 Red (Down face)
- 🟦 Blue (Left face)
- 🟪 Purple (Back face)
## Requirements
- git
- gcc
- make
## Usage
Clone the repository
```Shell
git clone https://github.com/SrVariable/RubikCube.git
```
Go to the cloned repository
```Shell
cd RubikCube
```
Execute make
```Shell
make
```
Run the program
```Shell
./rubik
```
## Movements


### Uppercase
- **B**: Rotate the B face 90º counterclockwise.
- **F**: Rotate the F face 90º clockwise.
- **L**: Rotate the L face 90º counterclockwise.
- **R**: Rotate the R face 90º clockwise.
- **U**: Rotate the U face 90º clockwise.
- **D**: Rotate the D face 90º counterclockwise
- **M**: Rotate the middle layer parallel to the R and L faces 90º counterclockwise.
- **E**: Rotate the middle layer parallel to the U and D faces 90º counterclockwise.
- **S**: Rotate the middle layer parallel to the F and B faces 90º clockwise.
### Lowercase
- **b**: Rotate the B face and the middle layer parallel to the F and B faces 90º counterclockwise.
- **f**: Rotate the F face and the middle layer parallel to the F and B faces 90º clockwise.
- **l**: Rotate the L face and middle layer parallel to the R and L faces 90º counterclockwise.
- **r**: Rotate the R face and middle layer parallel to the R and L faces 90º clockwise.
- **u**: Rotate the U face and middle layer parallel to the U and D faces face 90º clockwise.
- **d**: Rotate the D face and middle layer parallel to the U and D faces face 90º counterclockwise
- **x**: Rotate the cube in the X axis 90º clockwise.
- **y**: Rotate the cube in the Y axis 90º clockwise.
- **z**: Rotate the cube in the Z axis 90º clockwise.
> [!NOTE]
> Adding 2 after the letter will make the same movement twice. So B2 is the same as doing B B.
>
> Adding \' after the letter will make the reverse movement. So B' is the same as doing B B B.
> _Reference: [Rubik's Cube Move Notations](https://www.rubiksplace.com/move-notations/)_
## How to Play
When you run the program it will display the original position of the cube and will ask you to introduce a movement (listed before). You can introduce more than one movement in a single turn. For example:
> **Introduce a movement: B2FL'R**
This will do B2, F, L', R.
> [!NOTE]
>
> If you introduce more than one movement in a single turn, it will directly display the cube with the respective movements applied.
> [!TIP]
>
> To undo a movement you have to type the opposite movement in reverse.
>
> So in order to undo B2FL'R you will have to type R'LF'B'B'.