Single-Header Rubik's cube scrambling library made in C!
#include <stdio.h>
#define SCRAMBLER_IMPLEMENTATION
#include "scrambler.h"
int main(void) {
char* scramble = scrambleGenerateString(scrambleGetConfiguration(MODE_3X3));
printf("%s\n", scramble);
free(scramble);
return 0;
}
Scrambler is a single-header library for scrambling the twisty puzzles written in C. It's simplicity and design allows to simply drag and drop the scrambler.h
file into your project and use it however you'd like to! You can use pre-defined configurations and even create your own settings which then scrambler will use to output the desired scramble.
#define SCRAMBLER_IMPLEMENTATION
- Scrambler is single-header library, and to make it work you need to define the macroSCRAMBLER_IMPLEMENTATION
somewhere in your code. THIS MACRO MUST BE DEFINED ONLY ONCE, OTHERWISE THE COMPILER WON'T COMPILE THE PROJECT PROPERLY;Heap allocation
- currently the project uses dynamically-allocated string to output the scramble as text. Remember to call thefree()
ordelete
at the end of your program to prevent memory leaks;
This project uses the MIT license.