mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +00:00
Qualify calls to format
C++20 introduces `std::format` and we `using namespace std`, so some of these would be ambiguous in C++20.
This commit is contained in:
parent
a250a4d430
commit
ced3bbcad4
@ -291,7 +291,7 @@ void archimedean_tiling::prepare() {
|
|||||||
int inv = oi;
|
int inv = oi;
|
||||||
DEBB0(DF_GEOM, ("vertex "));
|
DEBB0(DF_GEOM, ("vertex "));
|
||||||
for(int z=0; z<faces[i]; z++) {
|
for(int z=0; z<faces[i]; z++) {
|
||||||
DEBB0(DF_GEOM, (format("[%d %d] " , at, inv)));
|
DEBB0(DF_GEOM, (hr::format("[%d %d] " , at, inv)));
|
||||||
adjacent[2*i+oi].emplace_back(2*N+int(inv), inv ? (2*at+2*N-2) % (2*N) : 2*at);
|
adjacent[2*i+oi].emplace_back(2*N+int(inv), inv ? (2*at+2*N-2) % (2*N) : 2*at);
|
||||||
if(invert[at]) inv ^= 1;
|
if(invert[at]) inv ^= 1;
|
||||||
at = adj[at];
|
at = adj[at];
|
||||||
@ -299,7 +299,7 @@ void archimedean_tiling::prepare() {
|
|||||||
else at = (at+N-1) % N;
|
else at = (at+N-1) % N;
|
||||||
}
|
}
|
||||||
if(!inv) make_match(2*i, 0, inv ? (2*at+2*N-1) % 2*N : 2*at, 0);
|
if(!inv) make_match(2*i, 0, inv ? (2*at+2*N-1) % 2*N : 2*at, 0);
|
||||||
DEBB(DF_GEOM, (format("-> [%d %d]\n", at, inv)));
|
DEBB(DF_GEOM, (hr::format("-> [%d %d]\n", at, inv)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=0; i<N; i++) {
|
for(int i=0; i<N; i++) {
|
||||||
@ -348,11 +348,11 @@ void archimedean_tiling::prepare() {
|
|||||||
int ai = i, aj = j;
|
int ai = i, aj = j;
|
||||||
DEBB0(DF_GEOM, ("triangle "));
|
DEBB0(DF_GEOM, ("triangle "));
|
||||||
for(int s=0; s<3; s++) {
|
for(int s=0; s<3; s++) {
|
||||||
DEBB0(DF_GEOM, (format("[%d %d] ", ai, aj)));
|
DEBB0(DF_GEOM, (hr::format("[%d %d] ", ai, aj)));
|
||||||
tie(ai, aj) = adjacent[ai][aj];
|
tie(ai, aj) = adjacent[ai][aj];
|
||||||
aj++; if(aj >= isize(adjacent[ai])) aj = 0;
|
aj++; if(aj >= isize(adjacent[ai])) aj = 0;
|
||||||
}
|
}
|
||||||
DEBB(DF_GEOM, (format("-> [%d %d]\n", ai, aj)));
|
DEBB(DF_GEOM, (hr::format("-> [%d %d]\n", ai, aj)));
|
||||||
make_match(i, j, ai, aj);
|
make_match(i, j, ai, aj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ void archimedean_tiling::regroup() {
|
|||||||
|
|
||||||
if(debugflags & DF_GEOM) {
|
if(debugflags & DF_GEOM) {
|
||||||
for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
||||||
DEBB(DF_GEOM, (format("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i])));
|
DEBB(DF_GEOM, (hr::format("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ void archimedean_tiling::compute_geometry() {
|
|||||||
set_flag(arr[gArchimedean].flags, qCLOSED, gg.kind == gcSphere);
|
set_flag(arr[gArchimedean].flags, qCLOSED, gg.kind == gcSphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBB(DF_GEOM, (format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));
|
DEBB(DF_GEOM, (hr::format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));
|
||||||
|
|
||||||
bool infake = fake::in();
|
bool infake = fake::in();
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ void archimedean_tiling::compute_geometry() {
|
|||||||
|
|
||||||
if(need_flip) geom3::light_flip(false);
|
if(need_flip) geom3::light_flip(false);
|
||||||
|
|
||||||
DEBB(DF_GEOM, (format("computed edgelength = %f\n", float(edgelength))));
|
DEBB(DF_GEOM, (hr::format("computed edgelength = %f\n", float(edgelength))));
|
||||||
|
|
||||||
triangles.clear();
|
triangles.clear();
|
||||||
triangles.resize(2*N+2);
|
triangles.resize(2*N+2);
|
||||||
@ -537,7 +537,7 @@ void archimedean_tiling::compute_geometry() {
|
|||||||
|
|
||||||
if(debugflags & DF_GEOM) for(auto& ts: triangles) {
|
if(debugflags & DF_GEOM) for(auto& ts: triangles) {
|
||||||
DEBB0(DF_GEOM, ("T"));
|
DEBB0(DF_GEOM, ("T"));
|
||||||
for(auto& t: ts) DEBB0(DF_GEOM, (format(" %f@%f", float(t.first), float(t.second))));
|
for(auto& t: ts) DEBB0(DF_GEOM, (hr::format(" %f@%f", float(t.first), float(t.second))));
|
||||||
DEBB(DF_GEOM, ());
|
DEBB(DF_GEOM, ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,7 +937,7 @@ void connect_digons_too(heptspin h1, heptspin h2) {
|
|||||||
// no need to specify archimedean_gmatrix and altmap
|
// no need to specify archimedean_gmatrix and altmap
|
||||||
hnew->c.connect(1, h2);
|
hnew->c.connect(1, h2);
|
||||||
h1--, h2++;
|
h1--, h2++;
|
||||||
DEBB(DF_GEOM, (format("OL2 %p.%d ~ %p.%d\n", hr::voidp(h1.at), h1.spin, hr::voidp(h2.at), h2.spin)));
|
DEBB(DF_GEOM, (hr::format("OL2 %p.%d ~ %p.%d\n", hr::voidp(h1.at), h1.spin, hr::voidp(h2.at), h2.spin)));
|
||||||
h1.at->c.connect(h1.spin, h2);
|
h1.at->c.connect(h1.spin, h2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -945,15 +945,15 @@ void connect_digons_too(heptspin h1, heptspin h2) {
|
|||||||
void connectHeptagons(heptspin hi, heptspin hs) {
|
void connectHeptagons(heptspin hi, heptspin hs) {
|
||||||
DEBB(DF_GEOM, ("OLD ", hi, " ~ ", hs));
|
DEBB(DF_GEOM, ("OLD ", hi, " ~ ", hs));
|
||||||
if(hi.at->move(hi.spin) == hs.at && hi.at->c.spin(hi.spin) == hs.spin) {
|
if(hi.at->move(hi.spin) == hs.at && hi.at->c.spin(hi.spin) == hs.spin) {
|
||||||
DEBB(DF_GEOM, (format("WARNING: already connected\n")));
|
DEBB(DF_GEOM, (hr::format("WARNING: already connected\n")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(hi.peek()) {
|
if(hi.peek()) {
|
||||||
DEBB(DF_GEOM, (format("ERROR: already connected left\n")));
|
DEBB(DF_GEOM, (hr::format("ERROR: already connected left\n")));
|
||||||
throw hr_archimedean_error("Archimedean error: already connected left");
|
throw hr_archimedean_error("Archimedean error: already connected left");
|
||||||
}
|
}
|
||||||
if(hs.peek()) {
|
if(hs.peek()) {
|
||||||
DEBB(DF_GEOM, (format("ERROR: already connected right\n")));
|
DEBB(DF_GEOM, (hr::format("ERROR: already connected right\n")));
|
||||||
throw hr_archimedean_error("Archimedean error: already connected right");
|
throw hr_archimedean_error("Archimedean error: already connected right");
|
||||||
}
|
}
|
||||||
hi.at->c.connect(hi.spin, hs);
|
hi.at->c.connect(hi.spin, hs);
|
||||||
|
8
cell.cpp
8
cell.cpp
@ -607,17 +607,17 @@ EX void initcells() {
|
|||||||
|
|
||||||
EX void clearcell(cell *c) {
|
EX void clearcell(cell *c) {
|
||||||
if(!c) return;
|
if(!c) return;
|
||||||
DEBB(DF_MEMORY, (format("c%d %p\n", c->type, hr::voidp(c))));
|
DEBB(DF_MEMORY, (hr::format("c%d %p\n", c->type, hr::voidp(c))));
|
||||||
for(int t=0; t<c->type; t++) if(c->move(t)) {
|
for(int t=0; t<c->type; t++) if(c->move(t)) {
|
||||||
DEBB(DF_MEMORY, (format("mov %p [%p] S%d\n", hr::voidp(c->move(t)), hr::voidp(c->move(t)->move(c->c.spin(t))), c->c.spin(t))));
|
DEBB(DF_MEMORY, (hr::format("mov %p [%p] S%d\n", hr::voidp(c->move(t)), hr::voidp(c->move(t)->move(c->c.spin(t))), c->c.spin(t))));
|
||||||
if(c->move(t)->move(c->c.spin(t)) != NULL &&
|
if(c->move(t)->move(c->c.spin(t)) != NULL &&
|
||||||
c->move(t)->move(c->c.spin(t)) != c) {
|
c->move(t)->move(c->c.spin(t)) != c) {
|
||||||
DEBB(DF_MEMORY | DF_ERROR, (format("cell error: type = %d %d -> %d\n", c->type, t, c->c.spin(t))));
|
DEBB(DF_MEMORY | DF_ERROR, (hr::format("cell error: type = %d %d -> %d\n", c->type, t, c->c.spin(t))));
|
||||||
if(worst_precision_error < 1e-3) exit(1);
|
if(worst_precision_error < 1e-3) exit(1);
|
||||||
}
|
}
|
||||||
c->move(t)->move(c->c.spin(t)) = NULL;
|
c->move(t)->move(c->c.spin(t)) = NULL;
|
||||||
}
|
}
|
||||||
DEBB(DF_MEMORY, (format("DEL %p\n", hr::voidp(c))));
|
DEBB(DF_MEMORY, (hr::format("DEL %p\n", hr::voidp(c))));
|
||||||
gp::delete_mapped(c);
|
gp::delete_mapped(c);
|
||||||
destroy_cell(c);
|
destroy_cell(c);
|
||||||
}
|
}
|
||||||
|
@ -1943,7 +1943,7 @@ EX void menuitem_sightrange(char c IS('c')) {
|
|||||||
else if(WDIM == 3)
|
else if(WDIM == 3)
|
||||||
dialog::addSelItem(XLAT("sight range settings"), fts(sightranges[geometry]) + "au", c);
|
dialog::addSelItem(XLAT("sight range settings"), fts(sightranges[geometry]) + "au", c);
|
||||||
else
|
else
|
||||||
dialog::addSelItem(XLAT("sight range settings"), format("%+d", sightrange_bonus), c);
|
dialog::addSelItem(XLAT("sight range settings"), hr::format("%+d", sightrange_bonus), c);
|
||||||
dialog::add_action_push(edit_sightrange);
|
dialog::add_action_push(edit_sightrange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1562,7 +1562,7 @@ struct shift_data {
|
|||||||
|
|
||||||
bignum& compute(ld rad2) {
|
bignum& compute(ld rad2) {
|
||||||
if(result.count(rad2)) return result[rad2];
|
if(result.count(rad2)) return result[rad2];
|
||||||
// println(hlog, "compute ", format("%p", this), " [shift=", shift, "], r2 = ", rad2);
|
// println(hlog, "compute ", hr::format("%p", this), " [shift=", shift, "], r2 = ", rad2);
|
||||||
// indenter i(2);
|
// indenter i(2);
|
||||||
auto& b = result[rad2];
|
auto& b = result[rad2];
|
||||||
if(!parent) {
|
if(!parent) {
|
||||||
|
@ -103,11 +103,11 @@ void init() {
|
|||||||
for(int a=0; a<100; a++) {
|
for(int a=0; a<100; a++) {
|
||||||
ld nq7 = q7 + q8;
|
ld nq7 = q7 + q8;
|
||||||
ld nq8 = q7 * 5 + q8 * 6;
|
ld nq8 = q7 * 5 + q8 * 6;
|
||||||
println(hlog, format("%.20f", val = (nq7 + nq8) / (q7 + q8)));
|
println(hlog, hr::format("%.20f", val = (nq7 + nq8) / (q7 + q8)));
|
||||||
q7 = nq7; q8 = nq8;
|
q7 = nq7; q8 = nq8;
|
||||||
}
|
}
|
||||||
val = sqrt(val);
|
val = sqrt(val);
|
||||||
println(hlog, "root: ", format("%.20f", val));
|
println(hlog, "root: ", hr::format("%.20f", val));
|
||||||
for(int a=-50; a<50; a++)
|
for(int a=-50; a<50; a++)
|
||||||
for(int b=1; b<50; b++)
|
for(int b=1; b<50; b++)
|
||||||
for(int c=-50; c<50; c++)
|
for(int c=-50; c<50; c++)
|
||||||
@ -283,7 +283,7 @@ string matcode(transmatrix T) {
|
|||||||
swap(h[1], h[2]); swap(h[0], h[1]);
|
swap(h[1], h[2]); swap(h[0], h[1]);
|
||||||
// return lalign(0, h);
|
// return lalign(0, h);
|
||||||
|
|
||||||
return format("R%dA%03dL%.3f", ialpha/60, hangle, hypot_d(2, h));
|
return hr::format("R%dA%03dL%.3f", ialpha/60, hangle, hypot_d(2, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ghatid(string s) {
|
int ghatid(string s) {
|
||||||
@ -431,7 +431,7 @@ void hatframe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string writematrix(transmatrix T) {
|
string writematrix(transmatrix T) {
|
||||||
return format("mt(%.10f,%.10f,%.10f, %.10f,%.10f,%.10f, %.10f,%.10f,%.10f)",
|
return hr::format("mt(%.10f,%.10f,%.10f, %.10f,%.10f,%.10f, %.10f,%.10f,%.10f)",
|
||||||
T[0][0],
|
T[0][0],
|
||||||
T[0][1],
|
T[0][1],
|
||||||
T[0][2],
|
T[0][2],
|
||||||
@ -456,7 +456,7 @@ void hatter() {
|
|||||||
dialog::add_key_action('a', [] {
|
dialog::add_key_action('a', [] {
|
||||||
hatcorners_add.push_back(sh);
|
hatcorners_add.push_back(sh);
|
||||||
println(hlog, "hatcorners = {");
|
println(hlog, "hatcorners = {");
|
||||||
for(auto h: hatcorners_add) println(hlog, format(" pt(%.10f,%.10f),", h[0], h[1]));
|
for(auto h: hatcorners_add) println(hlog, hr::format(" pt(%.10f,%.10f),", h[0], h[1]));
|
||||||
println(hlog, " }");
|
println(hlog, " }");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void do_recording() {
|
|||||||
ticks = i * 1000 / mrec_fps;
|
ticks = i * 1000 / mrec_fps;
|
||||||
|
|
||||||
if(i >= mrec_first && i < mrec_last) {
|
if(i >= mrec_first && i < mrec_last) {
|
||||||
string s = format(mrec_file.c_str(), i);
|
string s = hr::format(mrec_file.c_str(), i);
|
||||||
println(hlog, "recording frame ", i, "/", isize(saved), " to ", s);
|
println(hlog, "recording frame ", i, "/", isize(saved), " to ", s);
|
||||||
shot::take(s);
|
shot::take(s);
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1079,7 @@ void test_current(string tesname) {
|
|||||||
case 'O': Out("overts;oedges", lalign(0, count_vertex_orbits(), ";", count_edge_orbits()));
|
case 'O': Out("overts;oedges", lalign(0, count_vertex_orbits(), ";", count_edge_orbits()));
|
||||||
case 'U': Out("vshapes;vverts;vedges;ushapes;uverts;uedges;xea;xeb;xec", count_uniform());
|
case 'U': Out("vshapes;vverts;vedges;ushapes;uverts;uedges;xea;xeb;xec", count_uniform());
|
||||||
case 'L': Out("mirror_rules", arb::current.mirror_rules);
|
case 'L': Out("mirror_rules", arb::current.mirror_rules);
|
||||||
case 'B': Out("listshape;listvalence", format("%lld;%lld", get_shapelist(), get_valence_list()));
|
case 'B': Out("listshape;listvalence", hr::format("%lld;%lld", get_shapelist(), get_valence_list()));
|
||||||
case 'F': Out("maxdist", max_dist());
|
case 'F': Out("maxdist", max_dist());
|
||||||
|
|
||||||
case 'f': Out("file", tesname);
|
case 'f': Out("file", tesname);
|
||||||
@ -1091,7 +1091,7 @@ void test_current(string tesname) {
|
|||||||
case '1': Out("single", single_live_branches);
|
case '1': Out("single", single_live_branches);
|
||||||
case '2': Out("double", double_live_branches);
|
case '2': Out("double", double_live_branches);
|
||||||
case 'p': Out("premini", states_premini);
|
case 'p': Out("premini", states_premini);
|
||||||
case 'K': Out("movecount", format("%ld", rulegen::movecount));
|
case 'K': Out("movecount", hr::format("%ld", rulegen::movecount));
|
||||||
}
|
}
|
||||||
println(*test_out);
|
println(*test_out);
|
||||||
test_out->flush();
|
test_out->flush();
|
||||||
|
@ -235,11 +235,11 @@ void build_sols(int PRECX, int PRECY, int PRECZ) {
|
|||||||
auto xerr = solerror(v, nisot::numerical_exp(cand));
|
auto xerr = solerror(v, nisot::numerical_exp(cand));
|
||||||
|
|
||||||
if(cand == fail) {
|
if(cand == fail) {
|
||||||
println(hlog, format("[%2d %2d %2d] FAIL", iz, iy, ix));
|
println(hlog, hr::format("[%2d %2d %2d] FAIL", iz, iy, ix));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(xerr > 1e-3) {
|
else if(xerr > 1e-3) {
|
||||||
println(hlog, format("[%2d %2d %2d] ", iz, iy, ix));
|
println(hlog, hr::format("[%2d %2d %2d] ", iz, iy, ix));
|
||||||
println(hlog, "f(?) = ", v);
|
println(hlog, "f(?) = ", v);
|
||||||
println(hlog, "f(", cand, ") = ", nisot::numerical_exp(cand));
|
println(hlog, "f(", cand, ") = ", nisot::numerical_exp(cand));
|
||||||
println(hlog, "error = ", xerr);
|
println(hlog, "error = ", xerr);
|
||||||
@ -265,7 +265,7 @@ void build_sols(int PRECX, int PRECY, int PRECZ) {
|
|||||||
}
|
}
|
||||||
if(it < last_x && it < last_y) solve_at(it, it);
|
if(it < last_x && it < last_y) solve_at(it, it);
|
||||||
std::lock_guard<std::mutex> fm(file_mutex);
|
std::lock_guard<std::mutex> fm(file_mutex);
|
||||||
if(0) println(hlog, format("%2d: %2d", iz, it));
|
if(0) println(hlog, hr::format("%2d: %2d", iz, it));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ void visualize_table(sn::tabled_inverses& tab, const string& s) {
|
|||||||
for(int i=0; i<3; i++)
|
for(int i=0; i<3; i++)
|
||||||
part(p, i) = 0x80 + 0x70 * tab.get_int(ix, iy, iz)[i];
|
part(p, i) = 0x80 + 0x70 * tab.get_int(ix, iy, iz)[i];
|
||||||
}
|
}
|
||||||
SDL_SavePNG(rb.srf, format(s.c_str(), iz).c_str());
|
SDL_SavePNG(rb.srf, hr::format(s.c_str(), iz).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ EX namespace dialog {
|
|||||||
getcstat = 'A' + i, inslider = true, slider_x = mousex;
|
getcstat = 'A' + i, inslider = true, slider_x = mousex;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayColorButton(dcenter, vid.yres/2+vid.fsize * 6, XLAT("select this color") + " : " + format(colorAlpha ? "%08X" : "%06X", color), ' ', 8, 0, color >> (colorAlpha ? ash : 0));
|
displayColorButton(dcenter, vid.yres/2+vid.fsize * 6, XLAT("select this color") + " : " + hr::format(colorAlpha ? "%08X" : "%06X", color), ' ', 8, 0, color >> (colorAlpha ? ash : 0));
|
||||||
|
|
||||||
if(extra_options) extra_options();
|
if(extra_options) extra_options();
|
||||||
|
|
||||||
|
@ -1000,7 +1000,7 @@ EX namespace gp {
|
|||||||
bool master = !(li.relative.first||li.relative.second);
|
bool master = !(li.relative.first||li.relative.second);
|
||||||
int cor = master ? S7 : SG6;
|
int cor = master ? S7 : SG6;
|
||||||
if(master) li.last_dir = -1;
|
if(master) li.last_dir = -1;
|
||||||
DEBB(DF_GP, (format("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id)));
|
DEBB(DF_GP, (hr::format("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id)));
|
||||||
|
|
||||||
cgi.generate_floorshapes_for(id, c0, siid, sidir);
|
cgi.generate_floorshapes_for(id, c0, siid, sidir);
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ void geometry_information::prepare_basics() {
|
|||||||
: hdist(xpush0(crossf), xspinpush0(TAU/S7, crossf));
|
: hdist(xpush0(crossf), xspinpush0(TAU/S7, crossf));
|
||||||
|
|
||||||
DEBB(DF_GEOM | DF_POLY,
|
DEBB(DF_GEOM | DF_POLY,
|
||||||
(format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
|
(hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
|
||||||
hexhexdist, hexvdist)));
|
hexhexdist, hexvdist)));
|
||||||
|
|
||||||
base_distlimit = ginf[geometry].distlimit[!BITRUNCATED];
|
base_distlimit = ginf[geometry].distlimit[!BITRUNCATED];
|
||||||
|
6
glhr.cpp
6
glhr.cpp
@ -57,7 +57,7 @@ EX }
|
|||||||
EX void glError(const char* GLcall, const char* file, const int line) {
|
EX void glError(const char* GLcall, const char* file, const int line) {
|
||||||
GLenum errCode = glGetError();
|
GLenum errCode = glGetError();
|
||||||
if(errCode!=GL_NO_ERROR) {
|
if(errCode!=GL_NO_ERROR) {
|
||||||
println(hlog, format("OPENGL ERROR #%i: in file %s on line %i :: %s",errCode,file, line, GLcall));
|
println(hlog, hr::format("OPENGL ERROR #%i: in file %s on line %i :: %s",errCode,file, line, GLcall));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ struct glwrap {
|
|||||||
void glwrap::act(const char *when) {
|
void glwrap::act(const char *when) {
|
||||||
GLenum errCode = glGetError();
|
GLenum errCode = glGetError();
|
||||||
if(errCode!=GL_NO_ERROR) {
|
if(errCode!=GL_NO_ERROR) {
|
||||||
println(hlog, format("GL error %i %s: %s:%i", errCode, when, msg, line));
|
println(hlog, hr::format("GL error %i %s: %s:%i", errCode, when, msg, line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ EX int compileShader(int type, const string& s) {
|
|||||||
int lineno = 1;
|
int lineno = 1;
|
||||||
string cline = "";
|
string cline = "";
|
||||||
for(char c: s+"\n") {
|
for(char c: s+"\n") {
|
||||||
if(c == '\n') println(hlog, format("%4d : ", lineno), cline), lineno++, cline = "";
|
if(c == '\n') println(hlog, hr::format("%4d : ", lineno), cline), lineno++, cline = "";
|
||||||
else cline += c;
|
else cline += c;
|
||||||
}
|
}
|
||||||
println(hlog, "===");
|
println(hlog, "===");
|
||||||
|
@ -234,7 +234,7 @@ EX namespace gp {
|
|||||||
auto& wc = get_mapping(at);
|
auto& wc = get_mapping(at);
|
||||||
auto wcw = get_localwalk(wc, dir);
|
auto wcw = get_localwalk(wc, dir);
|
||||||
auto& wc1 = get_mapping(at + eudir(dir));
|
auto& wc1 = get_mapping(at + eudir(dir));
|
||||||
DEBB0(DF_GP, (format(" md:%02d s:%d", wc.mindir, wc.cw.spin)); )
|
DEBB0(DF_GP, (hr::format(" md:%02d s:%d", wc.mindir, wc.cw.spin)); )
|
||||||
DEBB0(DF_GP, (" connection ", at, "/", dir, " ", wc.cw+dir, "=", wcw, " ~ ", at+eudir(dir), "/", dir1, " "); )
|
DEBB0(DF_GP, (" connection ", at, "/", dir, " ", wc.cw+dir, "=", wcw, " ~ ", at+eudir(dir), "/", dir1, " "); )
|
||||||
if(!wc1.cw.at) {
|
if(!wc1.cw.at) {
|
||||||
wc1.start = wc.start;
|
wc1.start = wc.start;
|
||||||
|
@ -470,7 +470,7 @@ EX namespace history {
|
|||||||
auto save_band_segment = [&] {
|
auto save_band_segment = [&] {
|
||||||
string fname = name_format;
|
string fname = name_format;
|
||||||
replace_str(fname, "$DATE", timebuf);
|
replace_str(fname, "$DATE", timebuf);
|
||||||
replace_str(fname, "$ID", format("%03d", segid++));
|
replace_str(fname, "$ID", hr::format("%03d", segid++));
|
||||||
IMAGESAVE(band, fname.c_str());
|
IMAGESAVE(band, fname.c_str());
|
||||||
|
|
||||||
if(dospiral)
|
if(dospiral)
|
||||||
|
@ -507,8 +507,8 @@ EX string from_hexstring(string o) {
|
|||||||
EX string as_cstring(string o) {
|
EX string as_cstring(string o) {
|
||||||
string s = "string(\"";
|
string s = "string(\"";
|
||||||
for(char c: o)
|
for(char c: o)
|
||||||
s += format("\\x%02x", (unsigned char) c);
|
s += hr::format("\\x%02x", (unsigned char) c);
|
||||||
s += format("\", %d)", isize(o));
|
s += hr::format("\", %d)", isize(o));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ EX string as_nice_cstring(string o) {
|
|||||||
else if(c == 10)
|
else if(c == 10)
|
||||||
s += "\\n";
|
s += "\\n";
|
||||||
else
|
else
|
||||||
s += format("\\x%02x", (unsigned char) c);
|
s += hr::format("\\x%02x", (unsigned char) c);
|
||||||
s += "\"";
|
s += "\"";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ public class HyperRogue extends Activity implements SensorEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onError(MediaPlayer mp, int what, int extra)
|
public boolean onError(MediaPlayer mp, int what, int extra)
|
||||||
{
|
{
|
||||||
/* Toast.makeText(getApplicationContext(), String.format("Error(%s%s)", what, extra),
|
/* Toast.makeText(getApplicationContext(), String.hr::format("Error(%s%s)", what, extra),
|
||||||
Toast.LENGTH_SHORT).show(); */
|
Toast.LENGTH_SHORT).show(); */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1162,7 @@ EX void add_options() {
|
|||||||
cell *c = centerover->move(point_direction);
|
cell *c = centerover->move(point_direction);
|
||||||
if(c && c->wall == waWaxWall) {
|
if(c && c->wall == waWaxWall) {
|
||||||
color_t col = c->landparam;
|
color_t col = c->landparam;
|
||||||
dialog::addBoolItem("we are facing floor (color " + format("%06X", col) + ")", colors_of_floors.count(col), 'n');
|
dialog::addBoolItem("we are facing floor (color " + hr::format("%06X", col) + ")", colors_of_floors.count(col), 'n');
|
||||||
dialog::add_action([col] {
|
dialog::add_action([col] {
|
||||||
if(colors_of_floors.count(col)) colors_of_floors.erase(col);
|
if(colors_of_floors.count(col)) colors_of_floors.erase(col);
|
||||||
else colors_of_floors.insert(col);
|
else colors_of_floors.insert(col);
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "hyper.h"
|
#include "hyper.h"
|
||||||
namespace hr {
|
namespace hr {
|
||||||
|
|
||||||
EX const string dnameof(eMonster m) { return m >= 0 && m < motypes ? minf[m].name : format("[MONSTER %d]", m); }
|
EX const string dnameof(eMonster m) { return m >= 0 && m < motypes ? minf[m].name : hr::format("[MONSTER %d]", m); }
|
||||||
EX const string dnameof(eLand l) { return l >= 0 && l < landtypes ? linf[l].name : format("[LAND %d]", l); }
|
EX const string dnameof(eLand l) { return l >= 0 && l < landtypes ? linf[l].name : hr::format("[LAND %d]", l); }
|
||||||
EX const string dnameof(eWall w) { return w >= 0 && w < walltypes ? winf[w].name : format("[WALL %d]", w); }
|
EX const string dnameof(eWall w) { return w >= 0 && w < walltypes ? winf[w].name : hr::format("[WALL %d]", w); }
|
||||||
EX const string dnameof(eItem i) { return i >= 0 && i < ittypes ? iinf[i].name : format("[ITEM %d]", i); }
|
EX const string dnameof(eItem i) { return i >= 0 && i < ittypes ? iinf[i].name : hr::format("[ITEM %d]", i); }
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
#define NUMLAN 8
|
#define NUMLAN 8
|
||||||
|
8
reg3.cpp
8
reg3.cpp
@ -1589,7 +1589,7 @@ EX namespace reg3 {
|
|||||||
ld err;
|
ld err;
|
||||||
|
|
||||||
for(auto& p2: altmap[alt]) if((err = intval(tC0(p2.second), hT)) < 1e-3) {
|
for(auto& p2: altmap[alt]) if((err = intval(tC0(p2.second), hT)) < 1e-3) {
|
||||||
if(err > worst_error1) println(hlog, format("worst_error1 = %lg", double(worst_error1 = err)));
|
if(err > worst_error1) println(hlog, hr::format("worst_error1 = %lg", double(worst_error1 = err)));
|
||||||
// println(hlog, "YES found in ", isize(altmap[alt]));
|
// println(hlog, "YES found in ", isize(altmap[alt]));
|
||||||
if(DEB) println(hlog, "-> found ", p2.first);
|
if(DEB) println(hlog, "-> found ", p2.first);
|
||||||
int fb = 0;
|
int fb = 0;
|
||||||
@ -1604,7 +1604,7 @@ EX namespace reg3 {
|
|||||||
for(int d2=0; d2<S7; d2++) {
|
for(int d2=0; d2<S7; d2++) {
|
||||||
hyperpoint back = p2.second * tC0(cgi.adjmoves[d2]);
|
hyperpoint back = p2.second * tC0(cgi.adjmoves[d2]);
|
||||||
if((err = intval(back, old)) < 1e-3) {
|
if((err = intval(back, old)) < 1e-3) {
|
||||||
if(err > worst_error2) println(hlog, format("worst_error2 = %lg", double(worst_error2 = err)));
|
if(err > worst_error2) println(hlog, hr::format("worst_error2 = %lg", double(worst_error2 = err)));
|
||||||
if(p2.first->move(d2)) println(hlog, "error: repeated edge");
|
if(p2.first->move(d2)) println(hlog, "error: repeated edge");
|
||||||
p2.first->c.connect(d2, parent, d, false);
|
p2.first->c.connect(d2, parent, d, false);
|
||||||
fix_distances(p2.first, parent);
|
fix_distances(p2.first, parent);
|
||||||
@ -2416,7 +2416,7 @@ EX namespace reg3 {
|
|||||||
println(f, "face ", t, " ", id++, " ", isize(fa));
|
println(f, "face ", t, " ", id++, " ", isize(fa));
|
||||||
for(auto& h: fa) {
|
for(auto& h: fa) {
|
||||||
auto h1 = kleinize(h);
|
auto h1 = kleinize(h);
|
||||||
println(f, format("%.20f %.20f %.20f", h1[0], h1[1], h1[2]));
|
println(f, hr::format("%.20f %.20f %.20f", h1[0], h1[1], h1[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println(f);
|
println(f);
|
||||||
@ -2431,7 +2431,7 @@ EX namespace reg3 {
|
|||||||
transmatrix T = quotient_map->adj(c, i);
|
transmatrix T = quotient_map->adj(c, i);
|
||||||
for(int i=0; i<4; i++) {
|
for(int i=0; i<4; i++) {
|
||||||
for(int j=0; j<4; j++) {
|
for(int j=0; j<4; j++) {
|
||||||
print(f, format("%.20f", T[i][j]), j == 3 ? "\n" : " ");
|
print(f, hr::format("%.20f", T[i][j]), j == 3 ? "\n" : " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println(f);
|
println(f);
|
||||||
|
@ -105,7 +105,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, cd.center.shift / ads_time_unit);
|
string str = hr::format(tformat, cd.center.shift / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(cd.center.h)), .1, str, 0xFF4040, 8);
|
queuestr(shiftless(rgpushxto0(cd.center.h)), .1, str, 0xFF4040, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(view_proper_times && rock.type != oParticle) {
|
if(view_proper_times && rock.type != oParticle) {
|
||||||
string str = format(tformat, rock.pt_main.shift / ads_time_unit);
|
string str = hr::format(tformat, rock.pt_main.shift / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, (cr.shift + rock.start) / ads_time_unit);
|
string str = hr::format(tformat, (cr.shift + rock.start) / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -350,13 +350,13 @@ void view_ads_game() {
|
|||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, ship_pt / ads_time_unit);
|
string str = hr::format(tformat, ship_pt / ads_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paused && view_proper_times) {
|
if(paused && view_proper_times) {
|
||||||
string str = format(tformat, view_pt / ads_time_unit);
|
string str = hr::format(tformat, view_pt / ads_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ struct rock_generator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void report(string s) {
|
void report(string s) {
|
||||||
println(hlog, lalign(10, format(tformat, cshift/ds_time_unit)), ": ", s);
|
println(hlog, lalign(10, hr::format(tformat, cshift/ds_time_unit)), ": ", s);
|
||||||
};
|
};
|
||||||
|
|
||||||
ld rand_range(ld a, ld b) { return lerp(a, b, randd()); };
|
ld rand_range(ld a, ld b) { return lerp(a, b, randd()); };
|
||||||
@ -585,7 +585,7 @@ void view_ds_game() {
|
|||||||
if(view_proper_times && rock.type != oParticle) {
|
if(view_proper_times && rock.type != oParticle) {
|
||||||
ld t = rock.pt_main.shift;
|
ld t = rock.pt_main.shift;
|
||||||
if(rock.type == oMainRock) t += current.shift;
|
if(rock.type == oMainRock) t += current.shift;
|
||||||
string str = format(tformat, t / ds_time_unit);
|
string str = hr::format(tformat, t / ds_time_unit);
|
||||||
queuestr(shiftless(sphereflip * rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(sphereflip * rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ void view_ds_game() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, (cr.shift + ss.start) / ds_time_unit);
|
string str = hr::format(tformat, (cr.shift + ss.start) / ds_time_unit);
|
||||||
queuestr(shiftless(sphereflip * rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
queuestr(shiftless(sphereflip * rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -664,13 +664,13 @@ void view_ds_game() {
|
|||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, ship_pt / ds_time_unit);
|
string str = hr::format(tformat, ship_pt / ds_time_unit);
|
||||||
queuestr(shiftless(sphereflip), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(sphereflip), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paused && view_proper_times) {
|
if(paused && view_proper_times) {
|
||||||
string str = format(tformat, view_pt / ds_time_unit);
|
string str = hr::format(tformat, view_pt / ds_time_unit);
|
||||||
queuestr(shiftless(sphereflip), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(sphereflip), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void display(int id, int y, ld val, ld maxv, ld tank, ld unit) {
|
|||||||
|
|
||||||
if(maxv == 0) {
|
if(maxv == 0) {
|
||||||
string s;
|
string s;
|
||||||
if(main_rock) s = format(tformat, current.shift);
|
if(main_rock) s = hr::format(tformat, current.shift);
|
||||||
else s = its(val + .5);
|
else s = its(val + .5);
|
||||||
|
|
||||||
queuestr(sta, ctr, 0, 20, s, col >> 8, 1, 0);
|
queuestr(sta, ctr, 0, 20, s, col >> 8, 1, 0);
|
||||||
|
@ -499,7 +499,7 @@ void bantar_record() {
|
|||||||
vid.xres = vid.yres = TSIZE;
|
vid.xres = vid.yres = TSIZE;
|
||||||
banachtarski::bantar_frame();
|
banachtarski::bantar_frame();
|
||||||
|
|
||||||
IMAGESAVE(rbuf.render(), ("bantar/" + format("%05d", fr) + IMAGEEXT).c_str());
|
IMAGESAVE(rbuf.render(), ("bantar/" + hr::format("%05d", fr) + IMAGEEXT).c_str());
|
||||||
printf("GL %5d/%5d\n", i, 10000);
|
printf("GL %5d/%5d\n", i, 10000);
|
||||||
fr++;
|
fr++;
|
||||||
}
|
}
|
||||||
|
@ -1755,7 +1755,7 @@ void run() {
|
|||||||
perfect_linewidth = 0;
|
perfect_linewidth = 0;
|
||||||
shot::shot_aa = 2;
|
shot::shot_aa = 2;
|
||||||
vid.linewidth *= 2;
|
vid.linewidth *= 2;
|
||||||
shot::take(format("bringris-%04d.png", id++), [] { draw_screen(vid.xres, false); });
|
shot::take(hr::format("bringris-%04d.png", id++), [] { draw_screen(vid.xres, false); });
|
||||||
vid.linewidth /= 2;
|
vid.linewidth /= 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,7 +97,7 @@ int readArgs() {
|
|||||||
for(auto& loc: p.second.locs) {
|
for(auto& loc: p.second.locs) {
|
||||||
dynamicval<transmatrix> dv(View, loc.lView);
|
dynamicval<transmatrix> dv(View, loc.lView);
|
||||||
dynamicval<cell*> dc(centerover, loc.lco);
|
dynamicval<cell*> dc(centerover, loc.lco);
|
||||||
shot::take(format(s.c_str(), p.first, i++));
|
shot::take(hr::format(s.c_str(), p.first, i++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ int tallybox_total(qtybox& box) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string segdesc(segment *s) {
|
string segdesc(segment *s) {
|
||||||
return format("(%s-%s: len=%d, qty=%d/%d)", get_path(s->left).c_str(), get_path(s->right).c_str(), segmentlen(s), get0(s->qty), tallybox_total(s->qty));
|
return hr::format("(%s-%s: len=%d, qty=%d/%d)", get_path(s->left).c_str(), get_path(s->right).c_str(), segmentlen(s), get0(s->qty), tallybox_total(s->qty));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ void compute_betweenness(bool verify) {
|
|||||||
auto b = betweenness3(c1);
|
auto b = betweenness3(c1);
|
||||||
// add_to_set(c1, 1, 0);
|
// add_to_set(c1, 1, 0);
|
||||||
auto b4 = betweenness4(c1);
|
auto b4 = betweenness4(c1);
|
||||||
print(hlog, format("B;%10Ld;%10Ld;%20.10Lf;%3d;%-40s", b.first, b.second, b4, vertices[i]->lev, rogueviz::vdata[i].name.c_str()));
|
print(hlog, hr::format("B;%10Ld;%10Ld;%20.10Lf;%3d;%-40s", b.first, b.second, b4, vertices[i]->lev, rogueviz::vdata[i].name.c_str()));
|
||||||
if(verify) {
|
if(verify) {
|
||||||
/*
|
/*
|
||||||
betweenness_type a = b.first;
|
betweenness_type a = b.first;
|
||||||
@ -364,7 +364,7 @@ void compute_betweenness(bool verify) {
|
|||||||
else printf("\n");
|
else printf("\n");
|
||||||
pb++;
|
pb++;
|
||||||
}
|
}
|
||||||
if(verify) println(hlog, format("errorcount = %d/%d\n", errorcount, errorcount2));
|
if(verify) println(hlog, hr::format("errorcount = %d/%d\n", errorcount, errorcount2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void build(mycell *c, int lev, string s) {
|
void build(mycell *c, int lev, string s) {
|
||||||
|
@ -45,7 +45,7 @@ void memoryInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void debugtally() {
|
void debugtally() {
|
||||||
print(hlog, "T"); for(int i=0; i<MAXDIST; i++) if(tally[i]) print(hlog, format(" %4d/%4lld", edgetally[i], tally[i]));
|
print(hlog, "T"); for(int i=0; i<MAXDIST; i++) if(tally[i]) print(hlog, hr::format(" %4d/%4lld", edgetally[i], tally[i]));
|
||||||
println(hlog, " .. %", loglikopt());
|
println(hlog, " .. %", loglikopt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ int move_restart() {
|
|||||||
print(hlog, " stats:");
|
print(hlog, " stats:");
|
||||||
for(int a=0; a<2; a++) for(int b=0; b<128; b++) {
|
for(int a=0; a<2; a++) for(int b=0; b<128; b++) {
|
||||||
int d = distances_map[a][b];
|
int d = distances_map[a][b];
|
||||||
if(d) print(hlog, format(" %d/%d:%d", a,b, d));
|
if(d) print(hlog, hr::format(" %d/%d:%d", a,b, d));
|
||||||
}
|
}
|
||||||
println(hlog, "\n");
|
println(hlog, "\n");
|
||||||
return lastmoves = moves;
|
return lastmoves = moves;
|
||||||
@ -157,7 +157,7 @@ void verifycs() {
|
|||||||
edgecs += edgetally[u] * u*u,
|
edgecs += edgetally[u] * u*u,
|
||||||
totalcs += tally[u] * u*u;
|
totalcs += tally[u] * u*u;
|
||||||
|
|
||||||
print(hlog, "edgecs=", format("%lld", edgecs), " totalcs=", format("%lld", totalcs));
|
print(hlog, "edgecs=", hr::format("%lld", edgecs), " totalcs=", hr::format("%lld", totalcs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void preparegraph() {
|
void preparegraph() {
|
||||||
|
@ -61,15 +61,15 @@ void do_analyze_grid(int maxv) {
|
|||||||
ld wE2 = wstats[d][2];
|
ld wE2 = wstats[d][2];
|
||||||
ld wVr = wE2 - wE * wE;
|
ld wVr = wE2 - wE * wE;
|
||||||
|
|
||||||
print(hlog, format("d=%2d: q = %8d E = %12.8" PLDF " dif = %12.8" PLDF " Vr = %12.8" PLDF " Vr/(d-1)=%12.8" PLDF,
|
print(hlog, hr::format("d=%2d: q = %8d E = %12.8" PLDF " dif = %12.8" PLDF " Vr = %12.8" PLDF " Vr/(d-1)=%12.8" PLDF,
|
||||||
d, q, E, dif, Vr, Vd));
|
d, q, E, dif, Vr, Vd));
|
||||||
|
|
||||||
if(0) print(hlog, format(" | <%" PLDF "> ex = %12.8" PLDF " d.ex = %12.8" PLDF " Vr = %12.8" PLDF, wstats[d][0], wE, wE - lwE, wVr));
|
if(0) print(hlog, hr::format(" | <%" PLDF "> ex = %12.8" PLDF " d.ex = %12.8" PLDF " Vr = %12.8" PLDF, wstats[d][0], wE, wE - lwE, wVr));
|
||||||
|
|
||||||
ld Sigma = sqrt(Vr);
|
ld Sigma = sqrt(Vr);
|
||||||
sort(distances[d].begin(), distances[d].end());
|
sort(distances[d].begin(), distances[d].end());
|
||||||
if(Sigma) for(int u=1; u<8; u++)
|
if(Sigma) for(int u=1; u<8; u++)
|
||||||
print(hlog, format(" %8.5" PLDF, (distances[d][u * isize(distances[d]) / 8] - E) / Sigma));
|
print(hlog, hr::format(" %8.5" PLDF, (distances[d][u * isize(distances[d]) / 8] - E) / Sigma));
|
||||||
|
|
||||||
println(hlog);
|
println(hlog);
|
||||||
lwE = wE;
|
lwE = wE;
|
||||||
|
@ -78,7 +78,7 @@ ld bestll2(ld a, ld ab) { return bestll(a, ab-a); }
|
|||||||
template<class T> void fix_logistic_parameters(logistic& l, const T& f, const char *name, ld eps) {
|
template<class T> void fix_logistic_parameters(logistic& l, const T& f, const char *name, ld eps) {
|
||||||
indenter_finish im("fix_logistic_parameters");
|
indenter_finish im("fix_logistic_parameters");
|
||||||
ld cur = f(l);
|
ld cur = f(l);
|
||||||
println(hlog, format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%" PLDF ")", name, cur, l.R, l.T));
|
println(hlog, hr::format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%" PLDF ")", name, cur, l.R, l.T));
|
||||||
|
|
||||||
for(ld step=1; step>eps; step /= 2) {
|
for(ld step=1; step>eps; step /= 2) {
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ template<class T> void fix_logistic_parameters(logistic& l, const T& f, const ch
|
|||||||
while(true) { l.T -= step; ld t = f(l); if(t <= cur) break; cur = t; }
|
while(true) { l.T -= step; ld t = f(l); if(t <= cur) break; cur = t; }
|
||||||
l.T += step;
|
l.T += step;
|
||||||
|
|
||||||
println(hlog, format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%10.5" PLDF ")", name, cur, l.R, l.T));
|
println(hlog, hr::format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%10.5" PLDF ")", name, cur, l.R, l.T));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ void writestats() {
|
|||||||
ld placement_loglik = loglik_placement();
|
ld placement_loglik = loglik_placement();
|
||||||
|
|
||||||
for(int u=0; u<MAXDIST; u++) if(tally[u]) {
|
for(int u=0; u<MAXDIST; u++) if(tally[u]) {
|
||||||
println(hlog, format("* %4d: %8d / %12Ld = %lf %.10" PLDF " %.10" PLDF,
|
println(hlog, hr::format("* %4d: %8d / %12Ld = %lf %.10" PLDF " %.10" PLDF,
|
||||||
u, edgetally[u], tally[u], double(edgetally[u]) / tally[u],
|
u, edgetally[u], tally[u], double(edgetally[u]) / tally[u],
|
||||||
saved_logistic.yes(u), current_logistic.yes(u)));
|
saved_logistic.yes(u), current_logistic.yes(u)));
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ void fast_loglik_cont(logistic& l, const logisticfun& f, const char *name, ld st
|
|||||||
if(name) println(hlog, "fix_logistic_parameters");
|
if(name) println(hlog, "fix_logistic_parameters");
|
||||||
indenter_finish im(name);
|
indenter_finish im(name);
|
||||||
ld cur = f(l);
|
ld cur = f(l);
|
||||||
if(name) println(hlog, format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%" PLDF ")", name, cur, l.R, l.T));
|
if(name) println(hlog, hr::format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%" PLDF ")", name, cur, l.R, l.T));
|
||||||
|
|
||||||
map<pair<double, double>, double> memo;
|
map<pair<double, double>, double> memo;
|
||||||
auto ff = [&] () {
|
auto ff = [&] () {
|
||||||
@ -424,7 +424,7 @@ void fast_loglik_cont(logistic& l, const logisticfun& f, const char *name, ld st
|
|||||||
|
|
||||||
if(changed) goto loop;
|
if(changed) goto loop;
|
||||||
|
|
||||||
if(name) println(hlog, format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%10.5" PLDF ")", name, cur, l.R, l.T));
|
if(name) println(hlog, hr::format("%s = %20.10" PLDF " (R=%10.5" PLDF " T=%10.5" PLDF ")", name, cur, l.R, l.T));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ void wfc() {
|
|||||||
|
|
||||||
if(isize(freq)) println(hlog, "last freq = ", freq[0].prob);
|
if(isize(freq)) println(hlog, "last freq = ", freq[0].prob);
|
||||||
println(hlog, "freq size = ", isize(freq));
|
println(hlog, "freq size = ", isize(freq));
|
||||||
println(hlog, "tfreq = ", format("%lld", tfreq));
|
println(hlog, "tfreq = ", hr::format("%lld", tfreq));
|
||||||
println(hlog, "trans size = ", isize(trans));
|
println(hlog, "trans size = ", isize(trans));
|
||||||
println(hlog, "next code = ", nextcode);
|
println(hlog, "next code = ", nextcode);
|
||||||
clearMessages();
|
clearMessages();
|
||||||
|
@ -100,7 +100,7 @@ void experiment() {
|
|||||||
println(hlog, "found: ", tie(ia, ib));
|
println(hlog, "found: ", tie(ia, ib));
|
||||||
|
|
||||||
for(auto& row: jms[ia]) {
|
for(auto& row: jms[ia]) {
|
||||||
for(auto& i: row) print(hlog, format("%2d, ", i));
|
for(auto& i: row) print(hlog, hr::format("%2d, ", i));
|
||||||
println(hlog);
|
println(hlog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void build(crystal::coord co, int at) {
|
|||||||
if(WDIM == 3) c->wall = waWaxWall;
|
if(WDIM == 3) c->wall = waWaxWall;
|
||||||
}
|
}
|
||||||
|
|
||||||
println(hlog, co, " twos = ", twos, " index = ", index, " set = ", format("%06X", c->landparam));
|
println(hlog, co, " twos = ", twos, " index = ", index, " set = ", hr::format("%06X", c->landparam));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,7 +921,7 @@ void ncee() {
|
|||||||
displayButton(vid.xres - 8, 8 + vid.fsize, XLAT("(v) menu"), 'v', 16);
|
displayButton(vid.xres - 8, 8 + vid.fsize, XLAT("(v) menu"), 'v', 16);
|
||||||
|
|
||||||
if(algo_ticks)
|
if(algo_ticks)
|
||||||
displaystr(8, 8 + vid.fsize, 0, vid.fsize * 2, format("%d.%03d", algo_ticks/1000, algo_ticks%1000), 0xFFFFFF, 0);
|
displaystr(8, 8 + vid.fsize, 0, vid.fsize * 2, hr::format("%d.%03d", algo_ticks/1000, algo_ticks%1000), 0xFFFFFF, 0);
|
||||||
|
|
||||||
keyhandler = [=] (int sym, int uni) {
|
keyhandler = [=] (int sym, int uni) {
|
||||||
// dialog::handleNavigation(sym, uni);
|
// dialog::handleNavigation(sym, uni);
|
||||||
@ -977,7 +977,7 @@ void ncee() {
|
|||||||
fmap = genellipse(D, i * degree / slow);
|
fmap = genellipse(D, i * degree / slow);
|
||||||
println(hlog, "i = ", i);
|
println(hlog, "i = ", i);
|
||||||
for(int a=0; a<10; a++) iterate();
|
for(int a=0; a<10; a++) iterate();
|
||||||
if(i >= 0) shot::take(format(rfname.c_str(), i), draw_ncee);
|
if(i >= 0) shot::take(hr::format(rfname.c_str(), i), draw_ncee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -388,7 +388,7 @@ void level::init() {
|
|||||||
start.timer = 0;
|
start.timer = 0;
|
||||||
current = start;
|
current = start;
|
||||||
println(hlog, "start.where = ", start.where);
|
println(hlog, "start.where = ", start.where);
|
||||||
println(hlog, "current.where = ", current.where, " : ", format("%p", ¤t));
|
println(hlog, "current.where = ", current.where, " : ", hr::format("%p", ¤t));
|
||||||
|
|
||||||
int qgoals = isize(goals);
|
int qgoals = isize(goals);
|
||||||
records[0].resize(qgoals, 0);
|
records[0].resize(qgoals, 0);
|
||||||
|
@ -22,7 +22,7 @@ void save() {
|
|||||||
if(l->records[i][g]) {
|
if(l->records[i][g]) {
|
||||||
println(f, "*RECORD");
|
println(f, "*RECORD");
|
||||||
println(f, l->name);
|
println(f, l->name);
|
||||||
println(f, format("%d %d %f", i, g, l->records[i][g]));
|
println(f, hr::format("%d %d %f", i, g, l->records[i][g]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ void save() {
|
|||||||
println(f, l->name);
|
println(f, l->name);
|
||||||
println(f, p.name);
|
println(f, p.name);
|
||||||
println(f, isize(p.plan));
|
println(f, isize(p.plan));
|
||||||
for(auto t: p.plan) println(f, format("%.6f %.6f %.6f %.6f", t.at[0], t.at[1], t.vel[0], t.vel[1]));
|
for(auto t: p.plan) println(f, hr::format("%.6f %.6f %.6f %.6f", t.at[0], t.at[1], t.vel[0], t.vel[1]));
|
||||||
println(f);
|
println(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ void timestamp::centerview(level *lev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string format_timer(ld t) {
|
string format_timer(ld t) {
|
||||||
return format("%d:%02d.%02d", int(t / 60), int(t) % 60, int(frac(t) * 100));
|
return hr::format("%d:%02d.%02d", int(t / 60), int(t) % 60, int(frac(t) * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void timestamp::draw_instruments(level* l) {
|
void timestamp::draw_instruments(level* l) {
|
||||||
@ -373,7 +373,7 @@ void timestamp::draw_instruments(level* l) {
|
|||||||
|
|
||||||
string s;
|
string s;
|
||||||
if(loaded_or_planned) s = "R";
|
if(loaded_or_planned) s = "R";
|
||||||
else if(reversals) s = format("+%d", reversals);
|
else if(reversals) s = hr::format("+%d", reversals);
|
||||||
else return;
|
else return;
|
||||||
displaystr(vid.xres - vid.fsize, vid.fsize*4, 0, vid.fsize, s, 0, 16);
|
displaystr(vid.xres - vid.fsize, vid.fsize*4, 0, vid.fsize, s, 0, 16);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ string latex_packages =
|
|||||||
string latex_cachename(string s, flagtype flags) {
|
string latex_cachename(string s, flagtype flags) {
|
||||||
unsigned hash = 0;
|
unsigned hash = 0;
|
||||||
for(char c: latex_packages + s) hash = (hash << 3) ^ hash ^ c ^ flags;
|
for(char c: latex_packages + s) hash = (hash << 3) ^ hash ^ c ^ flags;
|
||||||
return format("latex-cache/%08X.png", hash);
|
return hr::format("latex-cache/%08X.png", hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* note: you pdftopng from the xpdf package for this to work! */
|
/* note: you pdftopng from the xpdf package for this to work! */
|
||||||
@ -330,7 +330,7 @@ void show_animation(presmode mode, string s, int sx, int sy, int frames, int fps
|
|||||||
/* actually load */
|
/* actually load */
|
||||||
array<int, 2> tab;
|
array<int, 2> tab;
|
||||||
if(pipe(&tab[0])) {
|
if(pipe(&tab[0])) {
|
||||||
addMessage(format("Error: %s", strerror(errno)));
|
addMessage(hr::format("Error: %s", strerror(errno)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ namespace sag {
|
|||||||
|
|
||||||
if(t2 - tl > 980) {
|
if(t2 - tl > 980) {
|
||||||
tl = t2;
|
tl = t2;
|
||||||
println(hlog, format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ",
|
println(hlog, hr::format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ",
|
||||||
numiter, double(sag::temperature), (double) exp(sag::temperature),
|
numiter, double(sag::temperature), (double) exp(sag::temperature),
|
||||||
double(sag::cost)));
|
double(sag::cost)));
|
||||||
}
|
}
|
||||||
@ -458,7 +458,7 @@ namespace sag {
|
|||||||
auto t2 = SDL_GetTicks();
|
auto t2 = SDL_GetTicks();
|
||||||
if(t2 - t1 > 1000) {
|
if(t2 - t1 > 1000) {
|
||||||
t1 = t2;
|
t1 = t2;
|
||||||
println(hlog, format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ",
|
println(hlog, hr::format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ",
|
||||||
numiter, double(sag::temperature), (double) exp(sag::temperature),
|
numiter, double(sag::temperature), (double) exp(sag::temperature),
|
||||||
double(sag::cost)));
|
double(sag::cost)));
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ namespace sag {
|
|||||||
if(t < (sag_ittime+1) / 2) ipturn *= 2;
|
if(t < (sag_ittime+1) / 2) ipturn *= 2;
|
||||||
else if(t > sag_ittime * 2) ipturn /= 2;
|
else if(t > sag_ittime * 2) ipturn /= 2;
|
||||||
else ipturn = ipturn * sag_ittime / t;
|
else ipturn = ipturn * sag_ittime / t;
|
||||||
print(hlog, format("it %12Ld temp %6.4f [2:%8.6f,10:%8.6f,50:%8.6f] cost = %f\n",
|
print(hlog, hr::format("it %12Ld temp %6.4f [2:%8.6f,10:%8.6f,50:%8.6f] cost = %f\n",
|
||||||
numiter, double(sag::temperature),
|
numiter, double(sag::temperature),
|
||||||
(double) exp(-2 * exp(-sag::temperature)),
|
(double) exp(-2 * exp(-sag::temperature)),
|
||||||
(double) exp(-10 * exp(-sag::temperature)),
|
(double) exp(-10 * exp(-sag::temperature)),
|
||||||
@ -701,7 +701,7 @@ namespace sag {
|
|||||||
|
|
||||||
dhrg::fast_loglik_cont(lgemb, lc, nullptr, 1, 1e-5);
|
dhrg::fast_loglik_cont(lgemb, lc, nullptr, 1, 1e-5);
|
||||||
|
|
||||||
println(hlog, "loglik = ", format("%.6f", lc(lgemb)), " R = ", lgemb.R, " T = ", lgemb.T, " iterations = ", embiter);
|
println(hlog, "loglik = ", hr::format("%.6f", lc(lgemb)), " R = ", lgemb.R, " T = ", lgemb.T, " iterations = ", embiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reassign_embedding() {
|
void reassign_embedding() {
|
||||||
@ -769,7 +769,7 @@ namespace sag {
|
|||||||
for(int i=0; i<isize(sagid); i++) {
|
for(int i=0; i<isize(sagid); i++) {
|
||||||
println(f, vdata[i].name);
|
println(f, vdata[i].name);
|
||||||
for(int d=0; d<MDIM; d++)
|
for(int d=0; d<MDIM; d++)
|
||||||
println(f, format("%.20f", placement[i][d]));
|
println(f, hr::format("%.20f", placement[i][d]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,8 +1153,8 @@ void geo_stats() {
|
|||||||
out("geometry", S3 >= OINF ? "tree" : hyperbolic ? "hyperbolic" : sphere ? "sphere" : euclid ? "euclid" : nil ? "nil" : sol ? "solv" : mproduct ? "product" : "other");
|
out("geometry", S3 >= OINF ? "tree" : hyperbolic ? "hyperbolic" : sphere ? "sphere" : euclid ? "euclid" : nil ? "nil" : sol ? "solv" : mproduct ? "product" : "other");
|
||||||
out("closed", max_sag_dist == isize(sagcells) ? 0 : closed_manifold ? 1 : 0);
|
out("closed", max_sag_dist == isize(sagcells) ? 0 : closed_manifold ? 1 : 0);
|
||||||
out("angular", angular);
|
out("angular", angular);
|
||||||
for(int p: {1, 10, 50}) { out(format("sagdist%02d", p), sorted_sagdist[(p * sorted_sagdist.size()) / 100]); }
|
for(int p: {1, 10, 50}) { out(hr::format("sagdist%02d", p), sorted_sagdist[(p * sorted_sagdist.size()) / 100]); }
|
||||||
for(int p: {1, 2, 3, 4}) { out(format("d%d", p), d[p]); }
|
for(int p: {1, 2, 3, 4}) { out(hr::format("d%d", p), d[p]); }
|
||||||
println(hlog);
|
println(hlog);
|
||||||
#undef out
|
#undef out
|
||||||
}
|
}
|
||||||
@ -1173,7 +1173,7 @@ void output_stats() {
|
|||||||
dhrg::prepare_pairs(DN, [] (int i) { return edges_yes[i]; });
|
dhrg::prepare_pairs(DN, [] (int i) { return edges_yes[i]; });
|
||||||
dhrg::greedy_routing(routing_result, [] (int i, int j) { return sagdist[sagid[i]][sagid[j]]; });
|
dhrg::greedy_routing(routing_result, [] (int i, int j) { return sagdist[sagid[i]][sagid[j]]; });
|
||||||
print(hlog, "CSV;", logid++, ";", isize(sagnode), ";", DN, ";", isize(sagedges), ";", lgsag.R, ";", lgsag.T, ";", cost, ";", mAP, ";", routing_result.suc / routing_result.tot, ";", routing_result.routedist / routing_result.bestdist);
|
print(hlog, "CSV;", logid++, ";", isize(sagnode), ";", DN, ";", isize(sagedges), ";", lgsag.R, ";", lgsag.T, ";", cost, ";", mAP, ";", routing_result.suc / routing_result.tot, ";", routing_result.routedist / routing_result.bestdist);
|
||||||
if(report_tempi) print(hlog, ";", hightemp,";",lowtemp,";",format("%lld", numiter));
|
if(report_tempi) print(hlog, ";", hightemp,";",lowtemp,";",hr::format("%lld", numiter));
|
||||||
println(hlog);
|
println(hlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,7 +1448,7 @@ EX bool record_video(string fname IS(videofile), bool_reaction_t rec IS(record_a
|
|||||||
|
|
||||||
array<int, 2> tab;
|
array<int, 2> tab;
|
||||||
if(pipe(&tab[0])) {
|
if(pipe(&tab[0])) {
|
||||||
addMessage(format("Error: %s", strerror(errno)));
|
addMessage(hr::format("Error: %s", strerror(errno)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
println(hlog, "tab = ", tab);
|
println(hlog, "tab = ", tab);
|
||||||
|
@ -102,7 +102,7 @@ void geometry_information::prepare_usershapes() {
|
|||||||
if(sh->flags & POLY_VCONVEX) vcon++;
|
if(sh->flags & POLY_VCONVEX) vcon++;
|
||||||
if(sh->flags & POLY_CCONVEX) ccon++;
|
if(sh->flags & POLY_CCONVEX) ccon++;
|
||||||
}
|
}
|
||||||
println(hlog, format("inverse = %d isside = %d vcon = %d ccon = %d", inve, issi, vcon, ccon));
|
println(hlog, hr::format("inverse = %d isside = %d vcon = %d ccon = %d", inve, issi, vcon, ccon));
|
||||||
}
|
}
|
||||||
|
|
||||||
initPolyForGL();
|
initPolyForGL();
|
||||||
|
Loading…
Reference in New Issue
Block a user