mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	rulegen3:: renaming/refactoring
This commit is contained in:
		| @@ -96,7 +96,7 @@ static const flagtype w_r3_no_road_shortcuts = Flag(36); /*< consider all errors | |||||||
| /** these control the output */ | /** these control the output */ | ||||||
| EX flagtype rdebug_flags; | EX flagtype rdebug_flags; | ||||||
|  |  | ||||||
| EX int honeycomb_value = 1; /* how far to build local for honeycombs */ | EX int r3_neighborhood_decision = 1; /* how far to build local for honeycombs */ | ||||||
|  |  | ||||||
| EX flagtype flags = 0; | EX flagtype flags = 0; | ||||||
|  |  | ||||||
| @@ -1366,8 +1366,8 @@ EX void id_at_spin(twalker cw, vector<twalker>& sprawl, vector<analyzer_state*>& | |||||||
|       a = alloc_analyzer(); |       a = alloc_analyzer(); | ||||||
|       } |       } | ||||||
|     states.push_back(a); |     states.push_back(a); | ||||||
|     if(WDIM == 3 && honeycomb_value) { |     if(WDIM == 3 && r3_neighborhood_decision) { | ||||||
|       auto& ae = check_all_edges(cw, a, isize(sprawl)); |       auto& ae = get_decision_neighborhood(cw); | ||||||
|       int id = isize(sprawl); |       int id = isize(sprawl); | ||||||
|       if(id < isize(ae)) { |       if(id < isize(ae)) { | ||||||
|         a->id = ae[id].first; |         a->id = ae[id].first; | ||||||
| @@ -2505,7 +2505,7 @@ auto hooks = addHook(hooks_configfile, 100, [] { | |||||||
|       param_i(max_ignore_level_post, "max_ignore_level_post"); |       param_i(max_ignore_level_post, "max_ignore_level_post"); | ||||||
|       param_i(max_ignore_time_pre, "max_ignore_time_pre"); |       param_i(max_ignore_time_pre, "max_ignore_time_pre"); | ||||||
|       param_i(max_ignore_time_post, "max_ignore_time_post"); |       param_i(max_ignore_time_post, "max_ignore_time_post"); | ||||||
|       param_i(honeycomb_value, "honeycomb_value"); |       param_i(r3_neighborhood_decision, "r3_neighborhood_decision"); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| EX void parse_treestate(arb::arbi_tiling& c, exp_parser& ep) { | EX void parse_treestate(arb::arbi_tiling& c, exp_parser& ep) { | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								rulegen3.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								rulegen3.cpp
									
									
									
									
									
								
							| @@ -145,11 +145,13 @@ EX int get_roadsign(twalker what) { | |||||||
|   return roadsign_id[result] = next_roadsign_id--; |   return roadsign_id[result] = next_roadsign_id--; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| map<pair<int, int>, vector<pair<int, int>> > all_edges; | #if HDR | ||||||
|  | using neighborhood = vector<pair<int, int>>; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| EX vector<pair<int, int>>& check_all_edges(twalker cw, analyzer_state* a, int id) { | map<pair<int, int>, neighborhood> all_edges; | ||||||
|   auto& ae = all_edges[{cw.at->id, cw.spin}]; |  | ||||||
|   if(ae.empty()) { | EX void build_neighborhood(twalker cw, neighborhood& ae, flagtype dec) { | ||||||
|   set<tcell*> seen; |   set<tcell*> seen; | ||||||
|   vector<pair<twalker, transmatrix> > visited; |   vector<pair<twalker, transmatrix> > visited; | ||||||
|   vector<pair<int, int>> ae1; |   vector<pair<int, int>> ae1; | ||||||
| @@ -168,7 +170,7 @@ EX vector<pair<int, int>>& check_all_edges(twalker cw, analyzer_state* a, int id | |||||||
|     for(auto w: rotated) |     for(auto w: rotated) | ||||||
|       if(sqhypot_d(MDIM, v-w) < 1e-6) |       if(sqhypot_d(MDIM, v-w) < 1e-6) | ||||||
|         common++; |         common++; | ||||||
|       if(honeycomb_value >= 2) { |     if(dec & 2) { | ||||||
|       if(common < 1) { ae1.emplace_back(id, dir); return; } |       if(common < 1) { ae1.emplace_back(id, dir); return; } | ||||||
|       } |       } | ||||||
|     else { |     else { | ||||||
| @@ -184,9 +186,13 @@ EX vector<pair<int, int>>& check_all_edges(twalker cw, analyzer_state* a, int id | |||||||
|       visit(tw + j + wstep, visited[i].second * currentmap->adj(tcell_to_cell[tw.at], (tw+j).spin), i, j); |       visit(tw + j + wstep, visited[i].second * currentmap->adj(tcell_to_cell[tw.at], (tw+j).spin), i, j); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     if(honeycomb_value >= 3) for(auto p: ae1) ae.push_back(p); |   if(dec & 4) for(auto p: ae1) ae.push_back(p); | ||||||
|   println(hlog, "for ", tie(cw.at->id, cw.spin), " generated all_edges structure: ", ae, " of size ", isize(ae)); |   println(hlog, "for ", tie(cw.at->id, cw.spin), " generated all_edges structure: ", ae, " of size ", isize(ae)); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX neighborhood& get_decision_neighborhood(twalker cw) { | ||||||
|  |   auto& ae = all_edges[{cw.at->id, cw.spin}]; | ||||||
|  |   if(ae.empty()) build_neighborhood(cw, ae, r3_neighborhood_decision); | ||||||
|   return ae; |   return ae; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue