move_convert.cpp (584B)
1 /* A simple example showing how to move a cube and print it in H48 format. */ 2 3 #include "../nissy.h" 4 #include <iostream> 5 6 int main() { 7 nissy::cube c; 8 if (!c.move("R' U' F").ok()) { 9 std::cout << "Error moving the cube!" << std::endl; 10 return 1; 11 } 12 13 auto string_or_error = c.to_string("H48"); 14 if (std::holds_alternative<nissy::error>(string_or_error)) { 15 std::cout << "Error converting cube!" << std::endl; 16 return 1; 17 } 18 19 auto str = std::get<std::string>(string_or_error); 20 std::cout << "Cube in H48 format after R' U' F:" << std::endl 21 << str << std::endl; 22 23 return 0; 24 }