Compare commits
4 Commits
c220f7fe65
...
65f379930f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65f379930f | ||
|
|
7e8d4d6d1d | ||
|
|
b0cc69848f | ||
|
|
2df802d207 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -50,7 +50,6 @@ _deps
|
||||
build/
|
||||
build*
|
||||
|
||||
*.gba
|
||||
*.elf
|
||||
*.sav
|
||||
|
||||
|
||||
@ -226,34 +226,24 @@ void generator_t::clear_all_buffers() {
|
||||
}
|
||||
|
||||
bool generator_t::generate_axiom(etl::ivector<marker_t>& out_markers) {
|
||||
const group_output_t& axiom_output = m_group_outputs[m_axiom];
|
||||
vec2 init_pos(0, 0);
|
||||
mat<2, 2> init_orient = create_rotation(1, 0);
|
||||
|
||||
if (m_leafs_cur->capacity() < axiom_output.m_child_leafs.size() ||
|
||||
m_wleafs_cur->capacity() < axiom_output.m_child_wleafs.size() ||
|
||||
out_markers.capacity() < axiom_output.m_child_markers.size()) {
|
||||
mlog::debug << "Reached limit" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const leaf_t& leaf : axiom_output.m_child_leafs) {
|
||||
m_leafs_cur->push_back(leaf);
|
||||
}
|
||||
for (const weighted_leaf_t& wleaf : axiom_output.m_child_wleafs) {
|
||||
m_wleafs_cur->push_back(wleaf);
|
||||
}
|
||||
for (const marker_t& mark : axiom_output.m_child_markers) {
|
||||
out_markers.push_back(mark);
|
||||
}
|
||||
|
||||
return true;
|
||||
return generate_group(m_axiom, init_pos, init_orient, out_markers);
|
||||
}
|
||||
|
||||
bool generator_t::generate_group(group_id_t gid, vec2 pos, mat<2, 2> orient, etl::ivector<marker_t>& out_markers) {
|
||||
const group_output_t& group_output = m_group_outputs[gid];
|
||||
|
||||
if (m_leafs_cur->capacity() < group_output.m_child_leafs.size() ||
|
||||
m_wleafs_cur->capacity() < group_output.m_child_wleafs.size() ||
|
||||
out_markers.capacity() < group_output.m_child_markers.size()) {
|
||||
size_t new_leafs_size = m_leafs_cur->size() + group_output.m_child_leafs.size();
|
||||
size_t new_wleafs_size = m_wleafs_cur->size() + group_output.m_child_wleafs.size();
|
||||
size_t new_marker_size = out_markers.size() + group_output.m_child_markers.size();
|
||||
|
||||
bool reached_max_leafs = m_leafs_cur->capacity() < new_leafs_size;
|
||||
bool reached_max_wleafs = m_wleafs_cur->capacity() < new_wleafs_size;
|
||||
bool reached_max_markers = out_markers.capacity() < new_marker_size;
|
||||
|
||||
if (reached_max_leafs || reached_max_wleafs || reached_max_markers) {
|
||||
mlog::debug << "Reached limit" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -80,6 +80,9 @@ int main(void) {
|
||||
} catch (const mtl::exception&) {
|
||||
mlog::info << "Failed to configure ruleset, caught exception" << endl;
|
||||
return 0;
|
||||
} catch (const etl::exception& e) {
|
||||
mlog::error << "Failed to configure ruleset, caught ETL exception" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t gen_num = 0;
|
||||
@ -95,8 +98,10 @@ int main(void) {
|
||||
}
|
||||
} catch (etl::exception& e) {
|
||||
mlog::error << "Caught ETL exception: " << e.what() << endl;
|
||||
return 0;
|
||||
} catch (mtl::exception& e) {
|
||||
mlog::error << "Caught MTL exception: " << e.id() << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mlog::info << "Stepped " << gen.generation_num() << " generations" << mtl::endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user