aboutsummaryrefslogtreecommitdiff
path: root/example/example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'example/example.cpp')
-rw-r--r--example/example.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/example/example.cpp b/example/example.cpp
new file mode 100644
index 0000000..60c998f
--- /dev/null
+++ b/example/example.cpp
@@ -0,0 +1,34 @@
1#include <cinttypes>
2#include <iostream>
3#include <vector>
4
5extern "C" {
6#include "../cube.h"
7}
8
9cube_t apply_alg(cube_t cube, std::vector<move_t> *moves) {
10 auto ret = cube;
11
12 for (auto m : *moves)
13 ret = cube_move(ret, m);
14
15 return ret;
16}
17
18int main() {
19 auto cube = cube_new();
20 auto moves = new std::vector<move_t> { R, U, R3, U3 };
21 char cstr[500];
22
23 std::cout << "The solved cube looks like this in H48 notation:\n";
24 cube_write((char *)"H48", cube, cstr);
25 std::string solvedstr(cstr);
26 std::cout << solvedstr << "\n";
27 std::cout << "After a sexy move it looks like this:\n";
28 cube = apply_alg(cube, moves);
29 cube_write((char *)"H48", cube, cstr);
30 std::string sexystr(cstr);
31 std::cout << sexystr << "\n";
32
33 return 0;
34}

Generated with cgit - Back to sebastiano.tronto.net