From fa6f94f9ef9d87da57c618a4d7d649f33258920c Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 22 Feb 2023 17:29:58 +0800 Subject: [PATCH] feat: add RawCode mirror functions framework --- src/klotski_core/raw_code/CMakeLists.txt | 2 +- src/klotski_core/raw_code/mirror.cc | 62 ++++++++++++++++++++++++ src/klotski_core/raw_code/raw_code.h | 30 ++++++------ 3 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 src/klotski_core/raw_code/mirror.cc diff --git a/src/klotski_core/raw_code/CMakeLists.txt b/src/klotski_core/raw_code/CMakeLists.txt index b59d305..254729c 100644 --- a/src/klotski_core/raw_code/CMakeLists.txt +++ b/src/klotski_core/raw_code/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 3.0) -add_library(raw_code OBJECT convert.cc raw_code.cc) +add_library(raw_code OBJECT mirror.cc convert.cc raw_code.cc) diff --git a/src/klotski_core/raw_code/mirror.cc b/src/klotski_core/raw_code/mirror.cc new file mode 100644 index 0000000..d419383 --- /dev/null +++ b/src/klotski_core/raw_code/mirror.cc @@ -0,0 +1,62 @@ +#include "raw_code.h" + +using klotski::RawCode; + +/// Static mirror functions +bool RawCode::is_vertical_mirror(RawCode &&raw_code) { + return raw_code.is_vertical_mirror(); +} + +bool RawCode::is_horizontal_mirror(RawCode &&raw_code) { + return raw_code.is_horizontal_mirror(); +} + +bool RawCode::is_vertical_mirror(const RawCode &raw_code) { + return raw_code.is_vertical_mirror(); +} + +bool RawCode::is_horizontal_mirror(const RawCode &raw_code) { + return raw_code.is_horizontal_mirror(); +} + +RawCode RawCode::to_vertical_mirror(RawCode &&raw_code) { + return raw_code.to_vertical_mirror(); +} + +RawCode RawCode::to_horizontal_mirror(RawCode &&raw_code) { + return raw_code.to_horizontal_mirror(); +} + +RawCode RawCode::to_vertical_mirror(const RawCode &raw_code) { + return raw_code.to_vertical_mirror(); +} + +RawCode RawCode::to_horizontal_mirror(const RawCode &raw_code) { + return raw_code.to_horizontal_mirror(); +} + +/// Mirror check functions +bool RawCode::is_vertical_mirror() const { + + // TODO: vertical mirror check + +} + +bool RawCode::is_horizontal_mirror() const { + + // TODO: horizontal mirror check + +} + +/// Mirror convert functions +RawCode RawCode::to_vertical_mirror() const { + + // TODO: vertical mirror convert + +} + +RawCode RawCode::to_horizontal_mirror() const { + + // TODO: horizontal mirror convert + +} diff --git a/src/klotski_core/raw_code/raw_code.h b/src/klotski_core/raw_code/raw_code.h index 1e0b1a5..1f4e797 100644 --- a/src/klotski_core/raw_code/raw_code.h +++ b/src/klotski_core/raw_code/raw_code.h @@ -91,20 +91,20 @@ namespace klotski { static RawCode from_common_code(const std::string &common_code); /// Mirror functions -// bool is_vertical_mirror() const; -// bool is_horizontal_mirror() const; -// -// RawCode to_vertical_mirror() const; -// RawCode to_horizontal_mirror() const; -// -// static bool is_vertical_mirror(RawCode &&raw_code); -// static bool is_horizontal_mirror(RawCode &&raw_code); -// static bool is_vertical_mirror(const RawCode &raw_code); -// static bool is_horizontal_mirror(const RawCode &raw_code); -// -// static RawCode to_vertical_mirror(RawCode &&raw_code); -// static RawCode to_horizontal_mirror(RawCode &&raw_code); -// static RawCode to_vertical_mirror(const RawCode &raw_code); -// static RawCode to_horizontal_mirror(const RawCode &raw_code); + bool is_vertical_mirror() const; + bool is_horizontal_mirror() const; + + RawCode to_vertical_mirror() const; + RawCode to_horizontal_mirror() const; + + static bool is_vertical_mirror(RawCode &&raw_code); + static bool is_horizontal_mirror(RawCode &&raw_code); + static bool is_vertical_mirror(const RawCode &raw_code); + static bool is_horizontal_mirror(const RawCode &raw_code); + + static RawCode to_vertical_mirror(RawCode &&raw_code); + static RawCode to_horizontal_mirror(RawCode &&raw_code); + static RawCode to_vertical_mirror(const RawCode &raw_code); + static RawCode to_horizontal_mirror(const RawCode &raw_code); }; }