[err]202607251724
This commit is contained in:
1 parent
50480ffe04
commit
3e873c4f8e
3 files changed
+57
-17
No files matched your search
+44
-13
@@ -3,10 +3,29 @@
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
std::array<std::string, CELL_SIZE> initialize_nicknames() {
|
||||
std::array<std::string, CELL_SIZE> arr;
|
||||
for (r8veritas::index i = 0; i < CELL_SIZE; i++) {
|
||||
arr[i] = std::to_string(i + 1);
|
||||
}
|
||||
return (arr);
|
||||
}
|
||||
|
||||
std::array<std::string, CELL_SIZE>
|
||||
initialize_tp_paths(std::array<std::string, CELL_SIZE> nickname_list) {
|
||||
std::array<std::string, CELL_SIZE> arr;
|
||||
for (r8veritas::index i = 0; i < CELL_SIZE; i++) {
|
||||
arr[i] = ".tp %" + nickname_list[i];
|
||||
}
|
||||
|
||||
return (arr);
|
||||
}
|
||||
|
||||
r8veritas::stat_ref generate_empty_stat() {
|
||||
r8veritas::stat arr;
|
||||
@@ -71,21 +90,34 @@ std::ostream &operator<<(std::ostream &os, const r8veritas::stat_ref &s) {
|
||||
std::ostream &operator<<(std::ostream &os, const r8veritas::ins &s) {
|
||||
|
||||
auto str = std::bitset<INS_SIZE>(s.bc).to_string();
|
||||
os << "SACRIFICE:" << s.sacrifice;
|
||||
os << tp_paths[s.sacrifice] << std::endl
|
||||
<< "biz" << std::endl
|
||||
<< "\tflb" << std::endl;
|
||||
/*
|
||||
.tp xxx
|
||||
biz
|
||||
flb
|
||||
*/
|
||||
std::reverse(&str[0], &str[CELL_SIZE]);
|
||||
if ((s.bc != 0b0) && (s.bc != 0b1)) {
|
||||
os << ",OPERATION:";
|
||||
if (str[0] == '0')
|
||||
os << "SET1: ";
|
||||
else
|
||||
os << "FLIP: ";
|
||||
os << '{';
|
||||
for (r8veritas::index i = 0; i < str.length() - 1; i++) {
|
||||
if (str[i] == '1')
|
||||
os << i << ' ';
|
||||
if (str[i] == '1') {
|
||||
os << "\t" << tp_paths[i] << std::endl;
|
||||
/*
|
||||
.tp yyy
|
||||
*/
|
||||
if (str[CELL_SIZE] == '1')
|
||||
os << "\tflb" << std::endl;
|
||||
else
|
||||
os << "\tset_1" << std::endl;
|
||||
}
|
||||
}
|
||||
os << '}';
|
||||
os << "\t" << tp_paths[s.sacrifice] << std::endl;
|
||||
}
|
||||
os << "rnz" << std::endl;
|
||||
/*
|
||||
rnz
|
||||
*/
|
||||
return (os);
|
||||
}
|
||||
|
||||
@@ -135,11 +167,10 @@ bool bfs(const r8veritas::truthtable &truthtable, r8veritas::index layer) {
|
||||
if (tmp_ans.first == truthtable.second) {
|
||||
while (!stats.empty())
|
||||
stats.pop();
|
||||
remembered_stats.erase(remembered_stats.begin(),
|
||||
remembered_stats.end());
|
||||
remembered_stats.clear();
|
||||
return (true);
|
||||
}
|
||||
if (!((tmp_ans.second) || remembered_stats.contains(tmp_ans.first))) {
|
||||
if (!remembered_stats.contains(tmp_ans.first)) {
|
||||
stats.push(tmp_ans.first);
|
||||
remembered_stats.insert(tmp_ans.first);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user