Skip to content

Commit

Permalink
wfc::Wfc::_add_constraint(): change to_erase_uset to to_erase_darr
Browse files Browse the repository at this point in the history
  • Loading branch information
fl4shk committed Nov 14, 2022
1 parent 81efde9 commit af95510
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 35 deletions.
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CXX_DIRS:=$(SHARED_SRC_DIRS)
# Whether or not to do debugging stuff
#DEBUG:=yeah do debug

#DEBUG_OPTIMIZATION_LEVEL:=-O2
DEBUG_OPTIMIZATION_LEVEL:=-Og
#DEBUG_OPTIMIZATION_LEVEL:=-O1
#DEBUG_OPTIMIZATION_LEVEL:=-O0
Expand Down
42 changes: 25 additions & 17 deletions dungeon.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@

######### ###########
#.......# #.........#
#.......+,,,,,,,+.........#
#.......# #.........#
#####+### ######+####
, ,
, ,
,,,,,,,,,,,,,,,,,,
, ,
, ,
#####+###### #####+###
#..........# #.......#
#..........+,,,,,+.......#
#..........# #.......#
############ #.......#
#########



######### #############
#.......# #...........#
#.......+,,,,,+...........#
#.......# #...........#
#.......# #...........#
#.......# #...........#
#.......# #...........#
#####+### ########+####
, ,
, ,
,,,,,,,,,,,,,,,,,,
, ,
, ,
#####+##### #####+###
#.........## ##.......#
#..........+,,,,+........#
#.........## #........#
########### #........#
##########



36 changes: 18 additions & 18 deletions src/wfc_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,11 @@ void Wfc::_add_constraint(
= potential.at(neighbor.pos.y).at(neighbor.pos.x);
//printout("debug: _add_constraint(): tiles: ", tiles, "\n");

std::unordered_set<size_t>
//tiles,
//other_tiles,
to_erase_uset;
//std::vector<size_t> to_erase_darr;
//std::unordered_set<size_t>
// //tiles,
// //other_tiles,
// to_erase_uset;
std::vector<size_t> to_erase_darr;
//for (size_t i=0; i<raw_tiles.size(); ++i) {
// if (raw_tiles.contains(i)) {
// tiles.insert(i);
Expand Down Expand Up @@ -900,23 +900,23 @@ void Wfc::_add_constraint(
if (!found) {
//printout("_add_constraint(): !found: ",
// other_tile, "\n");
to_erase_uset.insert(other_tile);
//bool found_other_tile = false;
//for (const auto& to_erase: to_erase_darr) {
// if (to_erase == other_tile) {
// found_other_tile = true;
// break;
// }
//}
//if (!found_other_tile) {
// to_erase_darr.push_back(other_tile);
//}
//to_erase_uset.insert(other_tile);
bool found_other_tile = false;
for (const auto& to_erase: to_erase_darr) {
if (to_erase == other_tile) {
found_other_tile = true;
break;
}
}
if (!found_other_tile) {
to_erase_darr.push_back(other_tile);
}
needs_update.push(neighbor.pos);
}
}
}
for (const size_t& to_erase_tile: to_erase_uset)
//for (const size_t& to_erase_tile: to_erase_darr)
//for (const size_t& to_erase_tile: to_erase_uset)
for (const size_t& to_erase_tile: to_erase_darr)
{
//printout("_add_constraint(): Erasing: ",
// nb_pot_elem.contains(to_erase_tile), " ",
Expand Down

0 comments on commit af95510

Please sign in to comment.