#include #include #include #include #include using namespace std::string_literals; #include #include #include #include using namespace std::chrono; using centiseconds = duration; using deciseconds = duration; using decaseconds = duration; #include #define FRC_NO_ICU 1 #include "FRC.h" #include "path.h" #include "keyboard.h" #include "file.h" #include "rnn.h" #include "gens.h" #include "version.h" /********************************************************** * DESIGN: * PRIMARY GOALS: * Simulate a 2D screen keyboard by a grid representing keys. CHECK * Define algorithms to mutate and breed keymaps. CHECK * Simulate a trace by drawing lines between keys. * Train another evolutionary algorithm to recognize words given traces. * Use difficulty of training that algorithm as cost function. * Use evolutionary algorithm to produce the best keymap. * Define a compact human-readable text format to represent keymaps. * * * * SECONDARY GOALS: * Display current best keymap graphically in the terminal (using ncurses) dynamically. - OR - * Display current best keymap graphically using a simple graphics library. **********************************************************/ std::string keymapAdaptor(std::string k, const std::string& ins = "\n") { if (k.length() != 30) { std::cerr<(nullTestData, rng)<<" - "<(nullTestData, rng)<<" - "<(nullTestData, rng)<{}}; sKeymap k_qwerty{keymap(qwerty)}, k_dvorak{keymap(dvorak)}, k_alpha{keymap(alphabetic)}, k_inverse{keymap(inverse)}, k_colemak{keymap(colemak)}, k_workman{keymap(workman)}, k_homerow{keymap(homerow)}, k_zvud{keymap(zvud)}, k_deunkja{keymap(deunkja)}, k_random{rng}; assert(argc > 2); std::cout< 3) { generations::maxThreads = fromStr(argv[3]); } else { generations::maxThreads = std::thread::hardware_concurrency(); } if (generations::maxThreads <= 0) { generations::maxThreads = 1; } #if 0 sKeymap axz = breed(k_alpha, k_inverse), axq = breed(k_alpha, k_qwerty), axd = breed(k_alpha, k_dvorak), qxd = breed(k_qwerty, k_dvorak), qxqxd = breed(k_qwerty, qxd), axqxd = breed(k_alpha, qxd), qxr = breed(k_qwerty, k_random), dxr = breed(k_dvorak, k_random); sKeymap k_q_1 = k_qwerty.mutate(1), k_q_4 = k_q_1.mutate(3), k_q_8 = k_q_4.mutate(4), k_q_16 = k_q_8.mutate(8), k_q_52 = k_q_16.mutate(36); std::cout <(cgen.size()); ++i) { // std::cout<>(std::numeric_limits::lowest); std::strftime(tmp.begin(), 256, fmt, tmb); return std::string(tmp.begin()); }; auto printTime = [&put_time](){ std::time_t now_c = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); return " ----------------- "s +put_time(std::localtime(&now_c), "%T") +" -----------------\n"s; }; std::cout<(sqrt(words.back().second)); int r_times = 8; int r_gens = rnnGens; doNullSamples(buildsample( decltype(words){words.begin(), words.begin()+WORD_COUNT}, SAMPLE_SIZE, rng ), k_random, weight_bias, rng); std::cout<(std::make_tuple( rnnGens, weight_bias, words2, SAMPLE_SIZE )); } else { k_gen.test(std::make_tuple( rnnGens, weight_bias, words2, SAMPLE_SIZE )); } auto& is = k_gen.exportInds(); //std::clog<