mirror of https://github.com/dnomd343/klotski.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
529 B
24 lines
529 B
9 months ago
|
#include <cstdint>
|
||
|
|
||
|
#include "cases.h"
|
||
|
#include "utils/utility.h"
|
||
|
|
||
|
block_num_t get_block_num(uint32_t range) {
|
||
|
block_num_t result {};
|
||
|
range = klotski::range_reverse(range);
|
||
|
for (; range; range >>= 2) {
|
||
|
switch (range & 0b11) {
|
||
|
case 0b01: // 1x2 block
|
||
|
++result.n_1x2;
|
||
|
continue;
|
||
|
case 0b10: // 2x1 block
|
||
|
++result.n_2x1;
|
||
|
continue;
|
||
|
case 0b11: // 1x1 block
|
||
|
++result.n_1x1;
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
return result;
|
||
|
}
|