mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-01 01:12:52 +00:00
improved cycle checking
This commit is contained in:
parent
33d2331788
commit
50c4e2be62
@ -1101,10 +1101,12 @@ void o_key(o_funcs& v) {
|
|||||||
if(geometry == gNotKnot) v.push_back(named_dialog("notknot", show));
|
if(geometry == gNotKnot) v.push_back(named_dialog("notknot", show));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool do_check_cycle;
|
||||||
cell *startcell, *current;
|
cell *startcell, *current;
|
||||||
vector<int> dirs;
|
vector<int> dirs;
|
||||||
|
|
||||||
void check_cycle() {
|
void check_cycle() {
|
||||||
|
if(!do_check_cycle) return;
|
||||||
if(!current) {
|
if(!current) {
|
||||||
auto s = currentmap->allcells()[0];
|
auto s = currentmap->allcells()[0];
|
||||||
println(hlog, "starting the cycle, ", cwt.at == s);
|
println(hlog, "starting the cycle, ", cwt.at == s);
|
||||||
@ -1117,6 +1119,13 @@ void check_cycle() {
|
|||||||
current = cwt.at;
|
current = cwt.at;
|
||||||
startcell->item = itGold;
|
startcell->item = itGold;
|
||||||
println(hlog, "dirs = ", dirs, " finished = ", startcell == current);
|
println(hlog, "dirs = ", dirs, " finished = ", startcell == current);
|
||||||
|
string dirstr;
|
||||||
|
for(int d: dirs)
|
||||||
|
if(d < 10)
|
||||||
|
dirstr += char('0' + d);
|
||||||
|
else
|
||||||
|
dirstr += char('a' + d-10);
|
||||||
|
addMessage("this loop can be identified with identity using: -nk-unloop 1 " + dirstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1170,6 +1179,9 @@ auto shot_hooks = addHook(hooks_initialize, 100, create_notknot)
|
|||||||
start_game();
|
start_game();
|
||||||
gen_knot();
|
gen_knot();
|
||||||
}
|
}
|
||||||
|
else if(argis("-nk-findloop")) {
|
||||||
|
do_check_cycle = true;
|
||||||
|
}
|
||||||
else if(argis("-nk-unloop")) {
|
else if(argis("-nk-unloop")) {
|
||||||
shift();
|
shift();
|
||||||
int copies = argi();
|
int copies = argi();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user