mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-06-26 15:13:19 +00:00
patterns:: furthest_map (Y)
This commit is contained in:
parent
7038df605c
commit
18206fa55f
36
pattern2.cpp
36
pattern2.cpp
|
@ -1560,6 +1560,35 @@ EX namespace patterns {
|
||||||
return cnm[c];
|
return cnm[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map<cell*, color_t> computed_furthest_map;
|
||||||
|
|
||||||
|
color_t furthest_map(cell *c) {
|
||||||
|
auto& cfm = computed_furthest_map;
|
||||||
|
if(cfm.count(c)) return cfm[c];
|
||||||
|
if(!bounded) return 0;
|
||||||
|
|
||||||
|
cell *sc = currentmap->gamestart();
|
||||||
|
auto ac = currentmap->allcells();
|
||||||
|
vector<int> bydist(20, 0);
|
||||||
|
vector<int> bynei(S7+1, 0);
|
||||||
|
int maxd = 0;
|
||||||
|
for(cell *d: ac) {
|
||||||
|
int di = celldistance(sc, d);
|
||||||
|
bydist[di]++;
|
||||||
|
maxd = max(maxd, di);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(cell *d: ac) cfm[d] = 0x101010;
|
||||||
|
|
||||||
|
for(cell *d: ac) if(celldistance(sc, d) == maxd)
|
||||||
|
cfm[d] = 0x1FFFF80;
|
||||||
|
|
||||||
|
println(hlog, "bydist = ", bydist);
|
||||||
|
|
||||||
|
return cfm[c];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cld compute_map_function(cell *c, int p, const string& formula) {
|
cld compute_map_function(cell *c, int p, const string& formula) {
|
||||||
exp_parser ep;
|
exp_parser ep;
|
||||||
ep.extra_params["p"] = p;
|
ep.extra_params["p"] = p;
|
||||||
|
@ -1793,6 +1822,9 @@ EX namespace patterns {
|
||||||
case 'Z': {
|
case 'Z': {
|
||||||
return nearer_map(c);
|
return nearer_map(c);
|
||||||
}
|
}
|
||||||
|
case 'Y': {
|
||||||
|
return furthest_map(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return canvasback;
|
return canvasback;
|
||||||
}
|
}
|
||||||
|
@ -1861,8 +1893,10 @@ EX namespace patterns {
|
||||||
dialog::addSelItem(XLAT("Penrose staircase"), "Nil", '/');
|
dialog::addSelItem(XLAT("Penrose staircase"), "Nil", '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bounded)
|
if(bounded) {
|
||||||
dialog::addSelItem(XLAT("nearer end"), "bounded", 'Z');
|
dialog::addSelItem(XLAT("nearer end"), "bounded", 'Z');
|
||||||
|
dialog::addSelItem(XLAT("furthest from start"), "bounded", 'Y');
|
||||||
|
}
|
||||||
|
|
||||||
if(arb::in() || arcm::in())
|
if(arb::in() || arcm::in())
|
||||||
dialog::addSelItem(XLAT("types"), "types", 'A');
|
dialog::addSelItem(XLAT("types"), "types", 'A');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user