mirror of https://github.com/dnomd343/klotski.git
Dnomd343
2 years ago
4 changed files with 32 additions and 5 deletions
@ -1,4 +1,4 @@ |
|||||
cmake_minimum_required(VERSION 3.0) |
cmake_minimum_required(VERSION 3.0) |
||||
set(CMAKE_CXX_STANDARD 14) |
set(CMAKE_CXX_STANDARD 14) |
||||
|
|
||||
add_executable(klotski main.cc common.cc all_cases.cc short_code.cc) |
add_executable(klotski main.cc common.cc all_cases.cc short_code.cc common_code.cc) |
||||
|
@ -0,0 +1,11 @@ |
|||||
|
#include "common.h" |
||||
|
#include "common_code.h" |
||||
|
|
||||
|
bool CommonCode::check(uint64_t common_code) { |
||||
|
uint32_t head = common_code >> 32; |
||||
|
auto range = (uint32_t)common_code; |
||||
|
if (head >= 16 || (head & 0b11) == 0b11) { // check 2x2 block address
|
||||
|
return false; // invalid common code
|
||||
|
} |
||||
|
return Common::check_case(head, Common::range_reverse(range)); // check by head and range
|
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <cstdint> |
||||
|
|
||||
|
class CommonCode { |
||||
|
public: |
||||
|
static bool check(uint64_t common_code); |
||||
|
}; |
Loading…
Reference in new issue