diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-04 18:36:31 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-04 18:36:31 +0200 |
| commit | 98dfdfc2aaa92bacdc94fedc433931cb3ea66a0a (patch) | |
| tree | ed542c3128e379aa221a71a0bea107d2cb5b32c6 | |
| parent | ba4e25810e0b845fe0488bc504bf3ab5bd1f3824 (diff) | |
| download | cubecore-98dfdfc2aaa92bacdc94fedc433931cb3ea66a0a.tar.gz cubecore-98dfdfc2aaa92bacdc94fedc433931cb3ea66a0a.zip | |
Added .gitignore; C++ example clean up; example compile script clean up
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | cube.o | bin | 23088 -> 32688 bytes | |||
| -rwxr-xr-x | example/a.out | bin | 49752 -> 75960 bytes | |||
| -rwxr-xr-x | example/compile.sh | 7 | ||||
| -rw-r--r-- | example/example.cpp | 10 | ||||
| -rw-r--r-- | example/example.o | bin | 33856 -> 0 bytes |
6 files changed, 14 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..011690f --- /dev/null +++ b/.gitignore | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | cube.o | ||
| 2 | example/a.out | ||
| 3 | example/example.o | ||
| Binary files differ | |||
diff --git a/example/a.out b/example/a.out index ef2babe..59a9f1a 100755 --- a/example/a.out +++ b/example/a.out | |||
| Binary files differ | |||
diff --git a/example/compile.sh b/example/compile.sh index 4ce3bd2..fe9f133 100755 --- a/example/compile.sh +++ b/example/compile.sh | |||
| @@ -1 +1,6 @@ | |||
| 1 | g++ example.cpp ../cube.o | 1 | #!/bin/sh |
| 2 | |||
| 3 | compiler="$((g++ -v 2>/dev/null && echo "g++") ||\ | ||
| 4 | (clang++ -v 2>/dev/null && echo "clang++"))" | ||
| 5 | |||
| 6 | ${compiler} -std=c++14 example.cpp ../cube.o | ||
diff --git a/example/example.cpp b/example/example.cpp index c7ec982..3fa7d66 100644 --- a/example/example.cpp +++ b/example/example.cpp | |||
| @@ -6,18 +6,18 @@ extern "C" { | |||
| 6 | #include "../cube.h" | 6 | #include "../cube.h" |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | cube_t apply_alg(cube_t cube, std::vector<move_t> *moves) { | 9 | cube_t apply_alg(cube_t cube, std::vector<move_t>& moves) { |
| 10 | auto ret = cube; | 10 | auto ret {cube}; |
| 11 | 11 | ||
| 12 | for (auto m : *moves) | 12 | for (auto m : moves) |
| 13 | ret = cube_move(ret, m); | 13 | ret = cube_move(ret, m); |
| 14 | 14 | ||
| 15 | return ret; | 15 | return ret; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | int main() { | 18 | int main() { |
| 19 | auto cube = cube_new(); | 19 | auto cube {cube_new()}; |
| 20 | auto moves = new std::vector<move_t> { R, U, R3, U3 }; | 20 | std::vector<move_t> moves { R, U, R3, U3 }; |
| 21 | char cstr[500]; | 21 | char cstr[500]; |
| 22 | 22 | ||
| 23 | std::cout << "The solved cube looks like this in H48 notation:\n"; | 23 | std::cout << "The solved cube looks like this in H48 notation:\n"; |
diff --git a/example/example.o b/example/example.o deleted file mode 100644 index af95a15..0000000 --- a/example/example.o +++ /dev/null | |||
| Binary files differ | |||
