From 59ecc0ee72a180692fcccab88db310d60021f2ab Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 13 Apr 2024 19:22:49 +0200 Subject: Fixed howto, added example --- example/example.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 example/example.cpp (limited to 'example/example.cpp') 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 @@ +#include +#include +#include + +extern "C" { +#include "../cube.h" +} + +cube_t apply_alg(cube_t cube, std::vector *moves) { + auto ret = cube; + + for (auto m : *moves) + ret = cube_move(ret, m); + + return ret; +} + +int main() { + auto cube = cube_new(); + auto moves = new std::vector { R, U, R3, U3 }; + char cstr[500]; + + std::cout << "The solved cube looks like this in H48 notation:\n"; + cube_write((char *)"H48", cube, cstr); + std::string solvedstr(cstr); + std::cout << solvedstr << "\n"; + std::cout << "After a sexy move it looks like this:\n"; + cube = apply_alg(cube, moves); + cube_write((char *)"H48", cube, cstr); + std::string sexystr(cstr); + std::cout << sexystr << "\n"; + + return 0; +} -- cgit v1.3