identical function depends on current base

This commit is contained in:
2018-04-26 12:44:33 +03:00
parent 48e918f500
commit aaa51e009c

View File

@@ -26,6 +26,23 @@ const CellType CUR_BASE = 3;
const int ARGS_COUNT = 2;
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 {
bool is_finished;
vector<FiniteFunction<CUR_BASE>> current;
@@ -288,9 +305,6 @@ pair<vector<FiniteFunction<BASE>>, bool> extend_function_class(
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 {
return f.get_hash();
};
@@ -541,6 +555,8 @@ void process_task_lists() {
int main() {
tie(identical_x, identical_y) = get_identicals<CUR_BASE>();
cout << "sizeof FiniteFunction<" << (int)CUR_BASE << "> = "
<< sizeof(FiniteFunction<CUR_BASE>) << endl;
cout << "sizeof FunctionTask = "<< sizeof(FunctionTask) << endl;
@@ -570,8 +586,7 @@ int main() {
decltype(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_y.get_hash() << endl;
allowed_functions.erase(identical_x);