identical function depends on current base
This commit is contained in:
25
main.cpp
25
main.cpp
@@ -26,6 +26,23 @@ const CellType CUR_BASE = 3;
|
|||||||
const int ARGS_COUNT = 2;
|
const int ARGS_COUNT = 2;
|
||||||
const string CLASSES_FILENAME = "classes.txt";
|
const string CLASSES_FILENAME = "classes.txt";
|
||||||
|
|
||||||
|
FiniteFunction<CUR_BASE> identical_x;
|
||||||
|
FiniteFunction<CUR_BASE> identical_y;
|
||||||
|
|
||||||
|
template <CellType BASE>
|
||||||
|
pair<FiniteFunction<BASE>, FiniteFunction<BASE>> get_identicals() {
|
||||||
|
if ( BASE == 3 )
|
||||||
|
return make_pair(
|
||||||
|
FiniteFunction<CUR_BASE>(string("000 111 222")),
|
||||||
|
FiniteFunction<CUR_BASE>(string("012 012 012"))
|
||||||
|
);
|
||||||
|
else if ( BASE == 4 )
|
||||||
|
return make_pair(
|
||||||
|
FiniteFunction<CUR_BASE>(string("0000 1111 2222 3333")),
|
||||||
|
FiniteFunction<CUR_BASE>(string("0123 0123 0123 0123"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
struct FunctionTask {
|
struct FunctionTask {
|
||||||
bool is_finished;
|
bool is_finished;
|
||||||
vector<FiniteFunction<CUR_BASE>> current;
|
vector<FiniteFunction<CUR_BASE>> current;
|
||||||
@@ -288,9 +305,6 @@ pair<vector<FiniteFunction<BASE>>, bool> extend_function_class(
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FiniteFunction<CUR_BASE> identical_x(string("000 111 222"));
|
|
||||||
FiniteFunction<CUR_BASE> identical_y(string("012 012 012"));
|
|
||||||
auto FiniteFunctionHasher = [](const FiniteFunction<BASE> &f) -> uint32_t {
|
auto FiniteFunctionHasher = [](const FiniteFunction<BASE> &f) -> uint32_t {
|
||||||
return f.get_hash();
|
return f.get_hash();
|
||||||
};
|
};
|
||||||
@@ -541,6 +555,8 @@ void process_task_lists() {
|
|||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
tie(identical_x, identical_y) = get_identicals<CUR_BASE>();
|
||||||
|
|
||||||
cout << "sizeof FiniteFunction<" << (int)CUR_BASE << "> = "
|
cout << "sizeof FiniteFunction<" << (int)CUR_BASE << "> = "
|
||||||
<< sizeof(FiniteFunction<CUR_BASE>) << endl;
|
<< sizeof(FiniteFunction<CUR_BASE>) << endl;
|
||||||
cout << "sizeof FunctionTask = "<< sizeof(FunctionTask) << endl;
|
cout << "sizeof FunctionTask = "<< sizeof(FunctionTask) << endl;
|
||||||
@@ -570,8 +586,7 @@ int main() {
|
|||||||
decltype(FiniteFunctionHasher)
|
decltype(FiniteFunctionHasher)
|
||||||
> allowed_functions(funcs.begin(), funcs.end(), 128, FiniteFunctionHasher);
|
> allowed_functions(funcs.begin(), funcs.end(), 128, FiniteFunctionHasher);
|
||||||
|
|
||||||
FiniteFunction<CUR_BASE> identical_x(string("000 111 222"));
|
|
||||||
FiniteFunction<CUR_BASE> identical_y(string("012 012 012"));
|
|
||||||
cout << identical_x.get_hash() << endl;
|
cout << identical_x.get_hash() << endl;
|
||||||
cout << identical_y.get_hash() << endl;
|
cout << identical_y.get_hash() << endl;
|
||||||
allowed_functions.erase(identical_x);
|
allowed_functions.erase(identical_x);
|
||||||
|
|||||||
Reference in New Issue
Block a user