2018-02-08 23:40:26 +00:00
|
|
|
// Hyperbolic Rogue -- the 'experiments with geometry' menu
|
2019-08-10 11:43:24 +00:00
|
|
|
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
|
2018-02-08 23:40:26 +00:00
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** \file geom-exp.cpp
|
|
|
|
* \brief The 'experiments with geometry' menu
|
|
|
|
*
|
|
|
|
* Implementation of this menu, and computation of the statistics shown there
|
|
|
|
*/
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-09-05 07:15:40 +00:00
|
|
|
#include "hyper.h"
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
int eupage = 0;
|
2021-05-28 22:11:31 +00:00
|
|
|
int euperpage = 9;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
string euchelp =
|
|
|
|
"If you want to know how much the gameplay is affected by the "
|
|
|
|
"hyperbolic geometry in HyperRogue, this mode is for you!\n\n"
|
|
|
|
|
|
|
|
"You can try many different geometries here. We start by gluing "
|
|
|
|
"n-gons in such a way that k of them meet in every vertex. "
|
|
|
|
"Depending on n and k, this either folds into a sphere, unfolds into a plane, "
|
2021-06-29 10:47:12 +00:00
|
|
|
"or requires a hyperbolic space. The result may be then 'bitruncated' by "
|
2017-11-06 20:18:40 +00:00
|
|
|
"replacing each vertex by a 2k-gon. Furthermore, you can play "
|
|
|
|
"with quotient geometries. For example, the elliptic geometry is "
|
|
|
|
"obtained from the sphere by making the antipodes be the same point, "
|
|
|
|
"so you return to the same spot (but as a mirror image) after going there. "
|
|
|
|
"Have fun experimenting! "
|
|
|
|
"Achievements and leaderboards do not work in geometry experiments, "
|
|
|
|
"except some specific ones.\n\n"
|
2021-06-29 10:47:12 +00:00
|
|
|
"In standard geometry (bitruncated or not), you can play the full game, but in other geometries "
|
2017-11-06 20:18:40 +00:00
|
|
|
"you select a particular land. Lands are unlocked by visiting them in this "
|
|
|
|
"session, or permanently by collecting 25 treasure. Try Crossroads in Euclidean "
|
|
|
|
"or chaos mode in non-standard non-quotient hyperbolic to visit many lands. "
|
|
|
|
"Highlights:\n"
|
|
|
|
"* Crystal World and Warped Coast can be understood as extra geometries.\n"
|
|
|
|
"* Halloween is specially designed for spherical geometry.\n"
|
|
|
|
"* To see the difference, try Hunting Grounds in Euclidean -- it is impossible.\n";
|
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2017-11-06 23:40:46 +00:00
|
|
|
void showQuotientConfig() {
|
2017-11-07 13:39:26 +00:00
|
|
|
using namespace fieldpattern;
|
2022-07-05 09:51:06 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
gamescreen();
|
2019-11-24 22:39:19 +00:00
|
|
|
dialog::init(XLAT("field quotient"));
|
2017-11-06 23:40:46 +00:00
|
|
|
fgeomextra& gxcur = fgeomextras[current_extra];
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(fgeomextras); i++) {
|
2017-11-06 23:40:46 +00:00
|
|
|
auto& g = fgeomextras[i];
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addBoolItem(ginf[g.base].tiling_name, g.base == gxcur.base, 'a'+i);
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::add_action([i] { current_extra = i; });
|
2017-11-06 23:40:46 +00:00
|
|
|
}
|
2019-11-24 22:39:19 +00:00
|
|
|
|
|
|
|
dialog::addBreak(100);
|
|
|
|
|
2017-11-06 23:40:46 +00:00
|
|
|
nextPrimes(gxcur);
|
2019-11-17 12:35:07 +00:00
|
|
|
string stars[3] = {"", "*", "**"};
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(gxcur.primes); i++) {
|
2017-11-06 23:40:46 +00:00
|
|
|
auto& p = gxcur.primes[i];
|
2019-11-17 12:47:13 +00:00
|
|
|
|
|
|
|
int sides = ginf[gxcur.base].sides;
|
|
|
|
bool sa = shapename_available(sides);
|
|
|
|
string s = sa ? "order %1%2 (%3 %4s)" : "order %1%2 (%3 %4-gons)";
|
|
|
|
|
|
|
|
s = XLAT(s, its(p.p), p.squared ? "²" : "", its(p.cells), sa ? shapename(sides) : its(sides));
|
|
|
|
|
|
|
|
s += stars[gxcur.dualval[i]];
|
|
|
|
|
|
|
|
dialog::addBoolItem(s, i == gxcur.current_prime_id, 'A'+i);
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::add_action([&gxcur, i] { gxcur.current_prime_id = i; });
|
2017-11-06 23:40:46 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:46:42 +00:00
|
|
|
if(isize(gxcur.primes) <= 6) {
|
2017-11-06 23:40:46 +00:00
|
|
|
dialog::addBreak(100);
|
|
|
|
dialog::addHelp(
|
|
|
|
"This geometry is obtained by applying the same 'generators' which "
|
|
|
|
"lead to creating the given basic hyperbolic geometry, "
|
|
|
|
"but using a fixed finite field instead of the field of reals. "
|
|
|
|
"It can be also interpreted as a quotient of the given basic geometry. "
|
|
|
|
"Warning: field patterns based on large primes might generate for a long time."
|
|
|
|
);
|
|
|
|
dialog::addBreak(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addItem("find the next prime", 'p');
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::add_action([&gxcur] { nextPrime(gxcur); });
|
2020-05-28 23:53:39 +00:00
|
|
|
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::addItem("activate", 'x');
|
|
|
|
dialog::add_action_confirmed([&gxcur] {
|
|
|
|
set_geometry(gxcur.base);
|
|
|
|
enableFieldChange();
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
start_game();
|
|
|
|
});
|
2017-11-06 23:40:46 +00:00
|
|
|
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::addItem("find alternate manifolds", 'y');
|
|
|
|
dialog::add_action_confirmed([&gxcur] {
|
|
|
|
set_geometry(gxcur.base);
|
|
|
|
triplet_id = 0;
|
|
|
|
enableFieldChange();
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
start_game();
|
|
|
|
|
|
|
|
auto& cfp = currfp;
|
|
|
|
auto triplets = cfp.find_triplets();
|
|
|
|
pushScreen([triplets] {
|
2022-07-05 09:51:06 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
gamescreen();
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::init(XLAT("alternate manifolds"));
|
|
|
|
int id = 0;
|
|
|
|
for(auto t: triplets) {
|
|
|
|
dialog::addItem(XLAT("generators (%1,%2), size %3", its(t.i), its(t.j), its(t.size/S7)), 'a'+id);
|
|
|
|
dialog::add_action([id] {
|
|
|
|
stop_game();
|
|
|
|
triplet_id = id;
|
|
|
|
fieldpattern::enableFieldChange();
|
|
|
|
start_game();
|
|
|
|
});
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
dialog::addBreak(100);
|
|
|
|
dialog::addHelp(XLAT(
|
|
|
|
"This option finds alternate solutions. For example, there are three {7,3} manifolds with 156 heptagons each (\"first Hurwitz triplet\").")
|
|
|
|
);
|
|
|
|
dialog::display();
|
2018-12-14 17:21:52 +00:00
|
|
|
});
|
2021-03-08 12:30:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
dialog::addItem("default", 'z');
|
|
|
|
dialog::add_action_confirmed([] {
|
|
|
|
set_geometry(gEuclid);
|
|
|
|
fieldpattern::quotient_field_changed = false;
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
start_game();
|
|
|
|
});
|
2017-11-06 23:40:46 +00:00
|
|
|
|
2021-03-08 12:30:55 +00:00
|
|
|
dialog::addBack();
|
2017-11-06 23:40:46 +00:00
|
|
|
dialog::display();
|
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX string bitruncnames[5] = {" (b)", " (n)", " (g)", " (i)", " (d)"};
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2018-06-17 17:04:17 +00:00
|
|
|
void validity_info() {
|
|
|
|
int vccolors[4] = {0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00};
|
|
|
|
auto lv = land_validity(specialland);
|
|
|
|
if(lv.flags & lv::display_error_message)
|
|
|
|
dialog::addInfo(XLAT(lv.msg), vccolors[lv.quality_level]);
|
|
|
|
else
|
|
|
|
dialog::addBreak(100);
|
|
|
|
}
|
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX bool showquotients;
|
2018-06-21 23:48:46 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
string validclasses[4] = {" (X)", " (½)", "", " (!)"};
|
|
|
|
|
2021-04-11 20:15:40 +00:00
|
|
|
EX void ge_land_selection() {
|
2018-12-13 16:02:10 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
if(cheater) for(int i=0; i<landtypes; i++) landvisited[i] = true;
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
for(int i=0; i<landtypes; i++)
|
|
|
|
if(hiitemsMax(treasureType(eLand(i))) >= 25) landvisited[i] = true;
|
|
|
|
landvisited[laCrossroads] = true;
|
2018-01-08 22:11:29 +00:00
|
|
|
landvisited[laCrossroads4] = true;
|
2017-11-06 20:18:40 +00:00
|
|
|
landvisited[laIce] = true;
|
|
|
|
landvisited[laHunting] = true;
|
|
|
|
landvisited[laMirrorOld] = true;
|
|
|
|
landvisited[laPrincessQuest] = cheater || princess::everSaved;
|
|
|
|
landvisited[laWildWest] = true;
|
|
|
|
landvisited[laHalloween] = true;
|
|
|
|
landvisited[laWarpCoast] = true;
|
|
|
|
landvisited[laGraveyard] = true;
|
|
|
|
landvisited[laDual] = true;
|
2018-01-05 13:19:56 +00:00
|
|
|
landvisited[laDocks] |= landvisited[laWarpCoast];
|
|
|
|
landvisited[laSnakeNest] |= landvisited[laRedRock];
|
2019-01-14 21:55:19 +00:00
|
|
|
landvisited[laCamelot] |= hiitemsMax(treasureType(laCamelot)) >= 1;
|
2017-11-06 20:18:40 +00:00
|
|
|
landvisited[laCA] = true;
|
2019-04-07 01:09:01 +00:00
|
|
|
landvisited[laAsteroids] = true;
|
2018-06-17 17:04:17 +00:00
|
|
|
|
2021-05-28 22:11:31 +00:00
|
|
|
dialog::init(XLAT("select the starting land"));
|
|
|
|
if(dialog::infix != "") mouseovers = dialog::infix;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2021-05-28 22:11:31 +00:00
|
|
|
generateLandList([] (eLand l) {
|
|
|
|
if(dialog::infix != "" && !dialog::hasInfix(linf[l].name)) return false;
|
|
|
|
return !!(land_validity(l).flags & lv::appears_in_geom_exp);
|
|
|
|
});
|
2019-02-06 15:34:22 +00:00
|
|
|
stable_sort(landlist.begin(), landlist.end(), [] (eLand l1, eLand l2) { return land_validity(l1).quality_level > land_validity(l2).quality_level; });
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
for(int i=0; i<euperpage; i++) {
|
|
|
|
if(euperpage * eupage + i >= isize(landlist)) { dialog::addBreak(100); break; }
|
|
|
|
eLand l = landlist[euperpage * eupage + i];
|
2021-05-28 22:11:31 +00:00
|
|
|
char ch = '1'+i;
|
2019-02-06 15:34:22 +00:00
|
|
|
string s = XLAT1(linf[l].name);
|
|
|
|
|
|
|
|
if(landvisited[l]) {
|
|
|
|
dialog::addBoolItem(s, l == specialland, ch);
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
2018-08-29 19:16:45 +00:00
|
|
|
else {
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addSelItem(s, XLAT("(locked)"), ch);
|
2018-08-29 19:16:45 +00:00
|
|
|
}
|
2019-02-06 15:34:22 +00:00
|
|
|
|
|
|
|
dialog::lastItem().color = linf[l].color;
|
|
|
|
dialog::lastItem().value += validclasses[land_validity(l).quality_level];
|
|
|
|
dialog::add_action([l] {
|
2019-05-29 13:52:49 +00:00
|
|
|
if(landvisited[l]) dialog::do_if_confirmed(dual::mayboth([l] {
|
2019-02-06 15:34:22 +00:00
|
|
|
stop_game_and_switch_mode(tactic::on ? rg::tactic : rg::nothing);
|
|
|
|
firstland = specialland = l;
|
2021-08-08 16:23:38 +00:00
|
|
|
if(l == laCanvas || l == laAsteroids || (land_validity(l).flags & lv::switch_to_single))
|
2021-04-12 11:58:04 +00:00
|
|
|
land_structure = lsSingle;
|
|
|
|
else if(among(l, laCrossroads, laCrossroads2))
|
|
|
|
land_structure = lsNiceWalls;
|
|
|
|
else if(among(l, laCrossroads4))
|
|
|
|
land_structure = lsNoWalls;
|
2019-02-06 15:34:22 +00:00
|
|
|
start_game();
|
|
|
|
popScreen();
|
2019-05-29 13:52:49 +00:00
|
|
|
}));
|
2019-02-06 15:34:22 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
dialog::addItem(XLAT("next page"), '-');
|
2021-05-28 22:11:31 +00:00
|
|
|
dialog::addInfo(XLAT("press letters to search"));
|
2019-02-06 15:34:22 +00:00
|
|
|
|
|
|
|
dialog::addBreak(25);
|
|
|
|
validity_info();
|
|
|
|
dialog::addBreak(25);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-05-29 13:52:49 +00:00
|
|
|
dual::add_choice();
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addBack();
|
|
|
|
dialog::display();
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
keyhandler = [] (int sym, int uni) {
|
|
|
|
dialog::handleNavigation(sym, uni);
|
|
|
|
|
|
|
|
if(uni == '-' || uni == PSEUDOKEY_WHEELUP || uni == PSEUDOKEY_WHEELDOWN) {
|
|
|
|
eupage++;
|
|
|
|
if(eupage * euperpage >= isize(landlist)) eupage = 0;
|
|
|
|
}
|
2021-05-28 22:11:31 +00:00
|
|
|
else if(dialog::editInfix(uni)) eupage = 0;
|
2019-02-06 15:34:22 +00:00
|
|
|
else if(doexiton(sym, uni)) popScreen();
|
|
|
|
};
|
|
|
|
}
|
2018-11-30 14:26:50 +00:00
|
|
|
|
2021-05-28 22:11:31 +00:00
|
|
|
EX void activate_ge_land_selection() {
|
|
|
|
dialog::infix = "";
|
|
|
|
eupage = 0;
|
|
|
|
pushScreen(ge_land_selection);
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
#if HDR
|
|
|
|
struct geometry_filter {
|
|
|
|
string name;
|
|
|
|
/** test if the current geometry matches the filter */
|
|
|
|
function<bool()> test;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EX geometry_filter *current_filter;
|
|
|
|
|
2019-11-28 19:00:34 +00:00
|
|
|
bool forced_quotient() { return quotient && !(cgflags & qOPTQ); }
|
|
|
|
|
2019-12-27 01:08:04 +00:00
|
|
|
EX geometry_filter gf_hyperbolic = {"hyperbolic", [] { return (arcm::in() || arb::in() || hyperbolic) && !forced_quotient(); }};
|
|
|
|
EX geometry_filter gf_spherical = {"spherical", [] { return (arcm::in() || arb::in() || sphere) && !forced_quotient(); }};
|
|
|
|
EX geometry_filter gf_euclidean = {"Euclidean", [] { return (arcm::in() || arb::in() || euclid) && !forced_quotient(); }};
|
2019-11-24 22:39:19 +00:00
|
|
|
EX geometry_filter gf_other = {"non-isotropic", [] { return prod || nonisotropic; }};
|
|
|
|
EX geometry_filter gf_regular_2d = {"regular 2D tesselations", [] {
|
2019-12-14 10:26:03 +00:00
|
|
|
return standard_tiling() && WDIM == 2 && !forced_quotient();
|
2019-11-24 22:39:19 +00:00
|
|
|
}};
|
|
|
|
EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", [] {
|
|
|
|
if(euclid) return geometry == gCubeTiling;
|
2019-12-14 11:12:24 +00:00
|
|
|
return !bt::in() && !kite::in() && WDIM == 3 && !forced_quotient() && !nonisotropic && !prod;
|
2019-11-24 22:39:19 +00:00
|
|
|
}};
|
|
|
|
EX geometry_filter gf_quotient = {"interesting quotient spaces", [] {
|
2019-11-28 19:00:34 +00:00
|
|
|
return forced_quotient() && !elliptic;
|
2019-11-24 22:39:19 +00:00
|
|
|
}};
|
|
|
|
|
2021-05-23 13:47:45 +00:00
|
|
|
EX vector<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient };
|
2019-11-24 22:39:19 +00:00
|
|
|
|
|
|
|
void ge_select_filter() {
|
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2019-11-24 22:39:19 +00:00
|
|
|
|
|
|
|
dialog::init(XLAT("geometries"));
|
|
|
|
|
|
|
|
char x = 'a';
|
|
|
|
for(auto f: available_filters) {
|
|
|
|
if(current_filter)
|
|
|
|
dialog::addBoolItem(XLAT(f->name), f == current_filter, x++);
|
|
|
|
else
|
|
|
|
dialog::addItem(XLAT(f->name), x++);
|
|
|
|
dialog::add_action([f] { current_filter = f; popScreen(); });
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addBack();
|
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_default_filter() {
|
2019-11-24 22:46:11 +00:00
|
|
|
current_filter = hyperbolic ? &gf_hyperbolic : euclid ? &gf_euclidean : sphere ? &gf_spherical : &gf_other;
|
2019-11-24 22:39:19 +00:00
|
|
|
for(auto f: available_filters) if(f->test()) current_filter = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_or_configure_geometry(eGeometry g) {
|
|
|
|
if(0) ;
|
|
|
|
#if CAP_CRYSTAL
|
|
|
|
else if(g == gCrystal)
|
|
|
|
pushScreen(crystal::show);
|
|
|
|
#endif
|
|
|
|
#if CAP_ARCM
|
|
|
|
else if(g == gArchimedean)
|
|
|
|
pushScreen(arcm::show);
|
|
|
|
#endif
|
2019-12-27 01:08:04 +00:00
|
|
|
else if(g == gArbitrary)
|
|
|
|
arb::choose();
|
2019-11-24 22:39:19 +00:00
|
|
|
else {
|
|
|
|
if(among(g, gProduct, gRotSpace)) {
|
2019-11-28 22:30:29 +00:00
|
|
|
if(WDIM == 3 || (g == gRotSpace && euclid)) {
|
2021-05-23 12:33:25 +00:00
|
|
|
addMessage(
|
2019-11-28 22:30:29 +00:00
|
|
|
g == gRotSpace ?
|
2021-05-23 12:33:25 +00:00
|
|
|
XLAT("Only works with 2D non-Euclidean geometries")
|
|
|
|
: XLAT("Only works with 2D geometries")
|
|
|
|
);
|
2019-11-24 22:39:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(g == gRotSpace) {
|
|
|
|
bool ok = true;
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) ok = PURE;
|
2019-12-14 11:12:24 +00:00
|
|
|
else if(bt::in() || kite::in()) ok = false;
|
2019-11-24 22:39:19 +00:00
|
|
|
else ok = PURE || BITRUNCATED;
|
|
|
|
if(!ok) {
|
|
|
|
addMessage(XLAT("Only works with (semi-)regular tilings"));
|
|
|
|
return;
|
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) {
|
2019-11-24 22:39:19 +00:00
|
|
|
int steps, single_step;
|
|
|
|
if(!arcm::current.get_step_values(steps, single_step)) {
|
|
|
|
addMessage(XLAT("That would have %1/%2 levels", its(steps), its(single_step)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-11-24 22:39:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
dual::may_split_or_do([g] { set_geometry(g); });
|
|
|
|
start_game();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** is g2 the same tiling as the current geometry (geometry)? */
|
|
|
|
bool same_tiling(eGeometry g2) {
|
|
|
|
if(g2 == gCrystal)
|
|
|
|
return S3 == 4;
|
2022-08-17 15:24:47 +00:00
|
|
|
if(g2 == gFieldQuotient && (hyperbolic || (geometry == gCubeTiling && reg3::cubes_reg3)) && standard_tiling())
|
2020-01-15 16:58:41 +00:00
|
|
|
return true;
|
2019-11-24 22:39:19 +00:00
|
|
|
if(g2 == gFieldQuotient && geometry != gFieldQuotient) {
|
|
|
|
int ce = 0;
|
|
|
|
for(auto& ge: fieldpattern::fgeomextras) {
|
|
|
|
if(ginf[ge.base].tiling_name == ginf[geometry].tiling_name) {
|
|
|
|
fieldpattern::current_extra = ce;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
ce++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ginf[g2].tiling_name == ginf[geometry].tiling_name;
|
|
|
|
}
|
2019-09-12 11:52:16 +00:00
|
|
|
|
|
|
|
void ge_select_tiling() {
|
2019-02-06 15:34:22 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
if(!current_filter) { popScreen(); return; }
|
|
|
|
dialog::init();
|
|
|
|
dialog::addItem(XLAT(current_filter->name), 'x');
|
|
|
|
dialog::add_action_push(ge_select_filter);
|
2019-03-02 23:49:37 +00:00
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
vector<eGeometry> geometries;
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
dialog::addBreak(100);
|
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
char letter = 'a';
|
2019-09-12 11:52:16 +00:00
|
|
|
for(int i=0; i<isize(ginf); i++) {
|
|
|
|
eGeometry g = eGeometry(i);
|
|
|
|
if(among(g, gProduct, gRotSpace)) hybrid::configure(g);
|
2019-11-24 22:46:11 +00:00
|
|
|
bool orig_el = elliptic;
|
2019-09-12 11:52:16 +00:00
|
|
|
bool on = geometry == g;
|
|
|
|
bool in_2d = WDIM == 2;
|
|
|
|
dynamicval<eGeometry> cg(geometry, g);
|
2020-01-15 17:00:21 +00:00
|
|
|
if(cgflags & qDEPRECATED) continue;
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() && !CAP_ARCM) continue;
|
2019-08-22 10:14:39 +00:00
|
|
|
if(cryst && !CAP_CRYSTAL) continue;
|
2019-09-13 15:45:31 +00:00
|
|
|
if(sol && !CAP_SOLV) continue;
|
2020-04-06 06:40:12 +00:00
|
|
|
if(arb::in() && (ISMOBILE || ISWEB)) continue;
|
2019-09-13 15:45:31 +00:00
|
|
|
if(WDIM == 3 && MAXMDIM == 3) continue;
|
2019-02-17 17:33:15 +00:00
|
|
|
if(geometry == gFieldQuotient && !CAP_FIELD) continue;
|
2020-05-15 09:46:26 +00:00
|
|
|
if(geometry == gFake) continue;
|
2019-11-24 22:39:19 +00:00
|
|
|
if(!current_filter->test()) continue;
|
2019-11-24 22:46:11 +00:00
|
|
|
if(orig_el) {
|
|
|
|
for(int j=0; j<isize(ginf); j++)
|
|
|
|
if(ginf[j].tiling_name == ginf[i].tiling_name)
|
|
|
|
geometry = g = eGeometry(j);
|
|
|
|
}
|
2021-05-23 12:17:06 +00:00
|
|
|
|
|
|
|
bool is_product = (geometry == gProduct && in_2d);
|
|
|
|
bool is_rotspace = (geometry == gRotSpace && in_2d);
|
|
|
|
dialog::addBoolItem(
|
|
|
|
is_product ? XLAT("current geometry x E") :
|
|
|
|
is_rotspace ? XLAT("space of rotations in current geometry") :
|
|
|
|
XLAT(ginf[g].menu_displayed_name), on, letter++);
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
|
2019-11-24 22:39:19 +00:00
|
|
|
dialog::add_action([g] { set_or_configure_geometry(g); });
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-09-12 11:52:16 +00:00
|
|
|
dialog::addBreak(100);
|
2019-06-18 12:19:24 +00:00
|
|
|
dual::add_choice();
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addBack();
|
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
|
2019-08-10 00:16:48 +00:00
|
|
|
EX string current_proj_name() {
|
2019-12-14 11:28:45 +00:00
|
|
|
bool h = hyperbolic || sn::in();
|
2020-10-08 16:22:28 +00:00
|
|
|
if(vpconf.model == mdPanini && vpconf.alpha == 1)
|
|
|
|
return XLAT("stereographic Panini");
|
|
|
|
else if(vpconf.model != mdDisk)
|
2020-04-16 22:53:58 +00:00
|
|
|
return models::get_model_name(vpconf.model);
|
|
|
|
else if(h && vpconf.alpha == 1)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("Poincaré model");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(h && vpconf.alpha == 0)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("Klein-Beltrami model");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(h && vpconf.alpha == -1)
|
2019-04-04 15:13:15 +00:00
|
|
|
return XLAT("inverted Poincaré model");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(sphere && vpconf.alpha == 1)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("stereographic projection");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(sphere && vpconf.alpha == 0)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("gnomonic projection");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(sphere && vpconf.alpha >= 999)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("orthographic projection");
|
2020-04-16 22:53:58 +00:00
|
|
|
else if(h && vpconf.alpha >= 999)
|
2019-04-05 11:59:55 +00:00
|
|
|
return XLAT("Gans model");
|
2019-02-06 15:34:22 +00:00
|
|
|
else
|
2019-03-20 01:12:37 +00:00
|
|
|
return XLAT("general perspective");
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
|
|
|
|
2019-11-24 22:39:30 +00:00
|
|
|
EX string dim_name() {
|
|
|
|
return " (" + its(WDIM) + "D)";
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:36:32 +00:00
|
|
|
#if CAP_THREAD && MAXMDIM >= 4
|
2020-01-16 15:39:18 +00:00
|
|
|
EX void showQuotientConfig3() {
|
|
|
|
|
|
|
|
using namespace fieldpattern;
|
2022-07-05 09:51:06 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
gamescreen();
|
2020-01-16 15:39:18 +00:00
|
|
|
dialog::init(XLAT("field quotient"));
|
|
|
|
|
|
|
|
auto& ds = discoveries[cginf.tiling_name];
|
|
|
|
|
|
|
|
if(!ds.discoverer) {
|
|
|
|
dialog::addItem("start discovery", 's');
|
|
|
|
dialog::add_action([&ds] { ds.activate(); });
|
|
|
|
}
|
|
|
|
else if(ds.is_suspended) {
|
|
|
|
dialog::addItem("resume discovery", 's');
|
|
|
|
dialog::add_action([&ds] { ds.activate(); });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog::addItem("suspend discovery", 's');
|
|
|
|
dialog::add_action([&ds] { ds.suspend(); });
|
|
|
|
}
|
|
|
|
|
|
|
|
auto& e = ds.experiment;
|
|
|
|
if(!e.Prime)
|
|
|
|
dialog::addBreak(100);
|
|
|
|
else {
|
|
|
|
string s = its(e.Prime);
|
|
|
|
if(e.wsquare) s += "²";
|
|
|
|
dialog::addInfo(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addBreak(100);
|
|
|
|
|
2020-01-28 15:10:35 +00:00
|
|
|
if(1) {
|
|
|
|
std::unique_lock<std::mutex> lk(ds.lock);
|
|
|
|
auto&l = ds.hashes_found;
|
|
|
|
for(auto& v: l) {
|
|
|
|
char x = 'a';
|
2020-05-27 23:41:17 +00:00
|
|
|
string s = XLAT("#%1, cells: %2, p=%3", itsh(v.first), its(get<5>(v.second)), its(get<0>(v.second)) + (get<1>(v.second) ? "²" : ""));
|
2020-01-28 15:10:35 +00:00
|
|
|
dialog::addItem(s, x++);
|
|
|
|
dialog::add_action([&v] {
|
|
|
|
stop_game();
|
|
|
|
int tmp;
|
|
|
|
tie(currfp.Prime, currfp.wsquare, currfp.R, currfp.P, currfp.X, tmp) = v.second;
|
|
|
|
currfp.Field = currfp.wsquare ? currfp.Prime * currfp.Prime : currfp.Prime;
|
|
|
|
currfp.generate_all3();
|
|
|
|
currfp.analyze();
|
|
|
|
start_game();
|
|
|
|
});
|
|
|
|
}
|
2020-01-16 15:39:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addBreak(100);
|
|
|
|
|
|
|
|
dialog::addBack();
|
|
|
|
|
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-09-12 11:56:24 +00:00
|
|
|
EX string geometry_name() {
|
|
|
|
switch(ginf[geometry].cclass) {
|
|
|
|
case gcHyperbolic:
|
2019-11-24 22:39:30 +00:00
|
|
|
return XLAT("hyperbolic") + dim_name();
|
2019-10-01 03:03:46 +00:00
|
|
|
|
2019-09-12 11:56:24 +00:00
|
|
|
case gcEuclid:
|
2020-05-15 21:50:27 +00:00
|
|
|
if(cgflags & qAFFINE)
|
|
|
|
return XLAT("affine") + dim_name();
|
2019-11-24 22:39:30 +00:00
|
|
|
return XLAT("flat") + dim_name();
|
2019-09-12 11:56:24 +00:00
|
|
|
|
|
|
|
case gcSphere:
|
2019-11-24 22:39:30 +00:00
|
|
|
return XLAT("spherical") + dim_name();
|
2019-09-12 11:56:24 +00:00
|
|
|
|
2019-10-03 18:24:27 +00:00
|
|
|
case gcSolNIH:
|
2019-11-15 13:52:21 +00:00
|
|
|
#if CAP_SOLV
|
2019-12-14 11:28:45 +00:00
|
|
|
switch(sn::geom()) {
|
2019-10-03 18:24:27 +00:00
|
|
|
case gSol:
|
|
|
|
return XLAT("Sol");
|
|
|
|
case gNIH:
|
|
|
|
return XLAT("hyperbolic (3:2)");
|
|
|
|
case gSolN:
|
|
|
|
return XLAT("Sol (3:2)");
|
|
|
|
default:
|
|
|
|
return "unknown";
|
|
|
|
}
|
2019-11-15 13:52:21 +00:00
|
|
|
#else
|
|
|
|
return XLAT("Sol");
|
|
|
|
#endif
|
2019-09-12 11:56:24 +00:00
|
|
|
|
|
|
|
case gcNil:
|
|
|
|
return XLAT("Nil");
|
|
|
|
|
|
|
|
case gcSL2:
|
|
|
|
return XLAT("~SL(2,R)~");
|
|
|
|
|
|
|
|
case gcProduct:
|
2019-09-12 18:27:00 +00:00
|
|
|
return XLAT("%1 x E", PIU(geometry_name()));
|
2019-09-12 11:56:24 +00:00
|
|
|
}
|
|
|
|
return "?";
|
|
|
|
}
|
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
EX void select_quotient_screen() {
|
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2019-11-24 22:39:19 +00:00
|
|
|
|
|
|
|
dialog::init(XLAT("quotient spaces in ") + ginf[geometry].tiling_name);
|
|
|
|
char key = 'a';
|
|
|
|
for(int i=0; i<isize(ginf); i++) {
|
|
|
|
auto g = eGeometry(i);
|
2020-05-15 09:46:50 +00:00
|
|
|
if(ginf[g].flags & qDEPRECATED) continue;
|
2019-11-24 22:39:19 +00:00
|
|
|
if(same_tiling(g)) {
|
|
|
|
dialog::addBoolItem(
|
|
|
|
(ginf[g].flags & qANYQ) ?
|
|
|
|
XLAT(ginf[g].menu_displayed_name) :
|
|
|
|
"no quotient",
|
|
|
|
g == geometry, key++);
|
|
|
|
dialog::add_action([g] {
|
2020-01-15 16:58:41 +00:00
|
|
|
if(g == gFieldQuotient && WDIM == 3) {
|
2020-01-16 15:39:18 +00:00
|
|
|
if(geometry != gFieldQuotient) {
|
|
|
|
stop_game();
|
|
|
|
fieldpattern::field_from_current();
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
for(int p=2;; p++) { currfp.Prime = p; currfp.force_hash = 0; if(!currfp.solve()) break; }
|
|
|
|
println(hlog, "set prime = ", currfp.Prime);
|
|
|
|
start_game();
|
|
|
|
}
|
2020-04-17 13:36:32 +00:00
|
|
|
#if CAP_THREAD && MAXMDIM >= 4
|
2020-01-16 15:39:18 +00:00
|
|
|
pushScreen(showQuotientConfig3);
|
|
|
|
#endif
|
2020-01-15 16:58:41 +00:00
|
|
|
}
|
|
|
|
else if(g == gFieldQuotient)
|
2019-11-24 22:39:19 +00:00
|
|
|
pushScreen(showQuotientConfig);
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_CRYSTAL
|
2020-01-02 16:20:26 +00:00
|
|
|
else if(g == gCrystal)
|
|
|
|
pushScreen(crystal::show);
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-11-24 22:39:19 +00:00
|
|
|
else {
|
|
|
|
dual::may_split_or_do([g] { set_geometry(g); });
|
|
|
|
start_game();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addBack();
|
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void select_quotient() {
|
2022-08-17 15:24:47 +00:00
|
|
|
if(euclid && !kite::in() && !arcm::in() && !reg3::cubes_reg3) {
|
2019-12-08 10:01:28 +00:00
|
|
|
euc::prepare_torus3();
|
|
|
|
pushScreen(euc::show_torus3);
|
2019-11-24 22:39:19 +00:00
|
|
|
}
|
|
|
|
else if(nil) {
|
|
|
|
nilv::prepare_niltorus3(),
|
|
|
|
pushScreen(nilv::show_niltorus3);
|
|
|
|
}
|
2021-03-30 09:27:48 +00:00
|
|
|
#if CAP_SOLV
|
2019-11-24 22:39:19 +00:00
|
|
|
else if(asonov::in()) {
|
|
|
|
asonov::prepare_config();
|
|
|
|
pushScreen(asonov::show_config);
|
|
|
|
}
|
2021-03-30 09:27:48 +00:00
|
|
|
#endif
|
2019-11-30 11:32:17 +00:00
|
|
|
else if(prod)
|
|
|
|
pushScreen(product::show_config);
|
2020-07-24 00:30:50 +00:00
|
|
|
else if(rotspace)
|
|
|
|
hybrid::configure_period();
|
2019-11-24 22:39:19 +00:00
|
|
|
else {
|
|
|
|
vector<eGeometry> choices;
|
|
|
|
for(int i=0; i<isize(ginf); i++) if(same_tiling(eGeometry(i))) choices.push_back(eGeometry(i));
|
|
|
|
|
|
|
|
println(hlog, "choices = ", choices);
|
|
|
|
|
2020-01-16 15:39:18 +00:00
|
|
|
if(isize(choices) > 1)
|
2019-11-24 22:39:19 +00:00
|
|
|
pushScreen(select_quotient_screen);
|
2020-01-16 15:39:18 +00:00
|
|
|
/* else if(isize(choices) > 1) {
|
2019-11-24 22:39:19 +00:00
|
|
|
set_geometry(choices[choices[0] == geometry ? 1 : 0]);
|
|
|
|
start_game();
|
2020-01-16 15:39:18 +00:00
|
|
|
} */
|
2019-11-24 22:39:19 +00:00
|
|
|
else
|
2020-03-07 22:44:00 +00:00
|
|
|
addMessage("No quotient spaces available in the current tiling.");
|
2019-11-24 22:39:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-06 21:03:45 +00:00
|
|
|
EX string full_geometry_name() {
|
|
|
|
string qstring = ginf[geometry].quotient_name;
|
|
|
|
bool variable =
|
2021-07-09 12:01:55 +00:00
|
|
|
!(prod || hybri || bt::in() || (WDIM == 3 && !reg3::in()) || kite::in() || arb::in());
|
2020-01-06 21:03:45 +00:00
|
|
|
|
|
|
|
string fgname = XLAT(ginf[geometry].tiling_name);
|
|
|
|
if(qstring != "none") fgname += " " + XLAT(qstring);
|
2022-05-06 10:40:48 +00:00
|
|
|
#if CAP_ARCM
|
2021-06-16 10:42:47 +00:00
|
|
|
if(arcm::in()) fgname = arcm::current.symbol;
|
2022-05-06 10:40:48 +00:00
|
|
|
#endif
|
2020-01-06 21:03:45 +00:00
|
|
|
if(variable) fgname = gp::operation_name() + " " + fgname;
|
|
|
|
return fgname;
|
|
|
|
}
|
|
|
|
|
2021-02-01 14:10:03 +00:00
|
|
|
void action_change_variation() {
|
|
|
|
if(0) ;
|
|
|
|
#if CAP_ARCM
|
|
|
|
else if(arcm::in()) arcm::next_variation();
|
|
|
|
#endif
|
2021-07-09 12:01:55 +00:00
|
|
|
#if MAXMDIM >= 4
|
2022-08-13 20:42:59 +00:00
|
|
|
else if(reg3::in() || geometry == gCubeTiling) reg3::configure_variation();
|
2021-07-09 12:01:55 +00:00
|
|
|
#endif
|
2021-02-01 14:10:03 +00:00
|
|
|
else if(euc::in(2,4) || !CAP_GP) dialog::do_if_confirmed([] {
|
|
|
|
set_variation(PURE ? eVariation::bitruncated : eVariation::pure);
|
|
|
|
start_game();
|
|
|
|
});
|
|
|
|
#if CAP_GP
|
|
|
|
else // if(S3 == 3)
|
|
|
|
gp::configure();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void menuitem_change_variation(char key) {
|
|
|
|
dialog::addSelItem(XLAT("variations"), gp::operation_name(), key);
|
|
|
|
dialog::add_action(action_change_variation);
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void menuitem_change_geometry(char key) {
|
|
|
|
dialog::addSelItem(XLAT("geometry/topology/tiling"), full_geometry_name(), key);
|
|
|
|
dialog::add_action_push(current_filter ? ge_select_tiling : ge_select_filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void menuitem_projection(char key) {
|
|
|
|
dialog::addSelItem(XLAT("projection"), current_proj_name(), key);
|
|
|
|
dialog::add_action_push(models::model_menu);
|
|
|
|
}
|
|
|
|
|
2021-02-01 16:14:28 +00:00
|
|
|
EX void menuitem_binary_width(char key) {
|
|
|
|
dialog::addSelItem(XLAT("binary tiling width"), fts(vid.binary_width), key);
|
|
|
|
dialog::add_action([] {
|
|
|
|
dialog::editNumber(vid.binary_width, 0, 2, 0.1, 1, XLAT("binary tiling width"), "");
|
|
|
|
dialog::reaction = [] () {
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
texture::config.remap();
|
|
|
|
#endif
|
2021-03-30 09:27:48 +00:00
|
|
|
#if CAP_SOLV
|
2021-02-01 16:14:28 +00:00
|
|
|
if(asonov::in()) asonov::prepare();
|
2021-03-30 09:27:48 +00:00
|
|
|
#endif
|
2021-02-01 16:14:28 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-21 11:50:32 +00:00
|
|
|
EX void menuitem_nilwidth(char key) {
|
2021-05-23 13:47:45 +00:00
|
|
|
dialog::addSelItem(XLAT("Nil width"), fts(nilv::nilwidth), key);
|
2021-03-21 11:50:32 +00:00
|
|
|
dialog::add_action([] {
|
|
|
|
dialog::editNumber(nilv::nilwidth, 0.01, 2, 0.1, 1, XLAT("Nil width"), "");
|
|
|
|
dialog::reaction = ray::reset_raycaster;
|
|
|
|
dialog::bound_low(0.01);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-07 12:44:38 +00:00
|
|
|
EX void edit_stretch() {
|
|
|
|
stretch::mstretch = false;
|
|
|
|
ray::reset_raycaster();
|
|
|
|
dialog::editNumber(stretch::factor, -1, 9, 0.1, 0, XLAT("stretched geometry"),
|
|
|
|
XLAT(
|
|
|
|
"Stretch the metric along the fibers. This can currently be done in rotation spaces and in 8-cell, 24-cell and 120-cell. "
|
|
|
|
"Value of 0 means not stretched, -1 means S2xE or H2xE (works only in the limit). (Must be > -1)"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
dialog::reaction = [] { if(abs(stretch::factor+1) < 1e-3) stretch::factor = -.9; ray::reset_raycaster(); };
|
|
|
|
}
|
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
#if HDR
|
|
|
|
struct geometry_data {
|
|
|
|
int ts, tv, nom, denom, euler, demigenus, worldsize;
|
|
|
|
int area;
|
|
|
|
string spf;
|
|
|
|
string size_str;
|
|
|
|
};
|
|
|
|
#endif
|
2018-11-27 01:32:11 +00:00
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
EX geometry_data compute_geometry_data() {
|
|
|
|
geometry_data gd;
|
|
|
|
auto& ts = gd.ts;
|
|
|
|
auto& tv = gd.tv;
|
|
|
|
ts = ginf[geometry].sides;
|
|
|
|
tv = ginf[geometry].vertex;
|
|
|
|
gd.nom = (BITRUNCATED ? tv+ts : tv) * 4;
|
|
|
|
gd.denom = (2*ts + 2*tv - ts * tv);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2020-07-24 14:20:49 +00:00
|
|
|
if(GOLDBERG || INVERSE) {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.area = PIU(cgi.gpdata->area);
|
2020-07-23 11:02:25 +00:00
|
|
|
|
2020-07-24 14:20:49 +00:00
|
|
|
if(GOLDBERG || WARPED) {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom = 2 * (2*tv + (S3-2) * ts * (gd.area-1));
|
2020-07-24 14:20:49 +00:00
|
|
|
}
|
|
|
|
else if(UNRECTIFIED) {
|
|
|
|
if((gp::param.first + gp::param.second) % 2 == 0)
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom = ts * 2 * gd.area;
|
2020-07-24 14:20:49 +00:00
|
|
|
else
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom = (2*tv + (S3-2) * ts * (gd.area-1));
|
2020-07-24 14:20:49 +00:00
|
|
|
}
|
|
|
|
else if(UNTRUNCATED) {
|
|
|
|
if((gp::param.first - gp::param.second) % 3 == 0) {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom = ts * 4 * gd.area;
|
|
|
|
gd.denom *= 3;
|
2020-07-24 14:20:49 +00:00
|
|
|
}
|
|
|
|
else {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom = 2 * (2*tv + (S3-2) * ts * (gd.area-1));
|
|
|
|
gd.denom *= 3;
|
2020-07-24 14:20:49 +00:00
|
|
|
}
|
2020-07-23 11:02:25 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-27 10:06:10 +00:00
|
|
|
else
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.area = PURE ? 1 : 3;
|
|
|
|
|
|
|
|
gd.euler = 0;
|
|
|
|
if(euclid) gd.euler = 0;
|
|
|
|
else if(sphere && nonorientable) gd.euler = 1;
|
|
|
|
else if(sphere) gd.euler = 2;
|
2022-05-21 11:08:42 +00:00
|
|
|
else if(!closed_manifold) gd.euler = -2;
|
2021-08-27 10:06:10 +00:00
|
|
|
else if(WDIM == 3) gd.euler = 0;
|
2019-02-06 15:34:22 +00:00
|
|
|
else switch(geometry) {
|
|
|
|
case gFieldQuotient:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize = isize(currentmap->allcells());
|
|
|
|
gd.euler = 2 * gd.worldsize * gd.denom / gd.nom;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
case gMinimal:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.euler = -1;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case gZebraQuotient:
|
|
|
|
case gBolza:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.euler = -2;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
case gKleinQuartic:
|
|
|
|
case gSchmutzM2:
|
|
|
|
case gBolza2:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.euler = -4;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case gSchmutzM3:
|
|
|
|
case gBring:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.euler = -6;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case gMacbeath:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.euler = -12;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize = isize(currentmap->allcells());
|
|
|
|
println(hlog, "warning: Euler characteristics unknown, worldsize = ", gd.worldsize);
|
|
|
|
gd.euler = 2 * gd.worldsize * gd.denom / gd.nom;
|
2019-02-06 15:34:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom *= gd.euler;
|
|
|
|
gd.denom *= 2;
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
if(hybri) gd.nom *= hybrid::csteps, gd.denom *= cgi.single_step;
|
2019-08-27 19:42:23 +00:00
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
int g = gcd(gd.nom, gd.denom);
|
2019-02-06 15:34:22 +00:00
|
|
|
if(g) {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.nom /= g;
|
|
|
|
gd.denom /= g;
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 11:08:42 +00:00
|
|
|
if(euclid && closed_manifold) {
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize = euc::eu.det;
|
|
|
|
if(BITRUNCATED) gd.worldsize *= (a4 ? 2 : 3);
|
|
|
|
if(GOLDBERG) gd.worldsize *= cgi.gpdata->area;
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_IRR
|
2021-08-27 10:06:10 +00:00
|
|
|
if(IRREGULAR) gd.worldsize *= isize(irr::cells) / isize(irr::cells_of_heptagon);
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
2019-11-27 17:07:39 +00:00
|
|
|
else
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize = gd.denom ? gd.nom / gd.denom : 0;
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2022-05-21 11:08:42 +00:00
|
|
|
if(gd.euler < 0 && !closed_manifold)
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize = -gd.worldsize;
|
2019-02-06 15:34:22 +00:00
|
|
|
|
|
|
|
string spf = its(ts);
|
2019-02-17 17:28:20 +00:00
|
|
|
if(0) ;
|
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
else if(arcm::in()) {
|
2019-02-06 15:34:22 +00:00
|
|
|
spf = "";
|
|
|
|
for(int i: arcm::current.faces) {
|
|
|
|
if(spf != "") spf += ",";
|
|
|
|
spf += its(i);
|
|
|
|
}
|
|
|
|
if(BITRUNCATED) spf = "[" + spf + "]," + its(arcm::current.N * 2) + "," + its(arcm::current.N * 2);
|
|
|
|
if(DUAL) spf = its(arcm::current.N) + "^[" + spf + "]";
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_BT
|
2019-12-27 00:44:52 +00:00
|
|
|
else if(bt::in()) switch(geometry) {
|
|
|
|
case gBinaryTiling: spf = "6,[6,7],7"; break;
|
|
|
|
case gBinary4: spf = "5,5,5[,5]"; break;
|
|
|
|
case gTernary: spf = "6,6,6[,6]"; break;
|
|
|
|
default: spf = "?"; break;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-12-14 10:26:03 +00:00
|
|
|
else if(BITRUNCATED)
|
2019-02-06 15:34:22 +00:00
|
|
|
spf = spf + "," + its(S6) + "," + its(S6);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2019-02-06 15:34:22 +00:00
|
|
|
else if(IRREGULAR && irr::bitruncations_performed)
|
|
|
|
spf = "[4..8],6,6";
|
|
|
|
else if(IRREGULAR)
|
|
|
|
spf = "[4..8]^3";
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_GP
|
2020-07-23 11:11:52 +00:00
|
|
|
else if(UNRECTIFIED || UNTRUNCATED) {
|
|
|
|
if(UNRECTIFIED && (gp::param.first-gp::param.second) % 2 != 0)
|
|
|
|
spf = "(?)";
|
|
|
|
else if(UNTRUNCATED && (gp::param.first-gp::param.second) % 3 != 0)
|
|
|
|
spf = "(?)";
|
|
|
|
else {
|
|
|
|
string each = UNRECTIFIED ? "4" : "3";
|
|
|
|
int first = UNRECTIFIED ? 4 : 6;
|
|
|
|
int second = S7;
|
|
|
|
if(gp::param == gp::loc(1, 1))
|
|
|
|
first = second;
|
|
|
|
else if(second < first)
|
|
|
|
swap(first, second);
|
|
|
|
spf = each;
|
|
|
|
for(int z=1; z<first; z++) spf += "," + each;
|
|
|
|
if(first != second) {
|
|
|
|
spf += "[";
|
|
|
|
for(int z=first; z<second; z++) spf += "," + each;
|
|
|
|
spf += "]";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-06 15:34:22 +00:00
|
|
|
else if(GOLDBERG && S3 == 4 && gp::param == gp::loc(1, 1))
|
|
|
|
spf = spf + ",4," + spf + ",4";
|
|
|
|
else if(GOLDBERG && S3 == 4 && gp::param == gp::loc(2, 0))
|
|
|
|
spf = spf + ",4,4,4";
|
|
|
|
else if(GOLDBERG && S3 == 4)
|
|
|
|
spf = "[" + spf + ",4],4,4,4";
|
2020-07-23 11:11:52 +00:00
|
|
|
else if(WARPED && S3 == 3 && gp::param == gp::loc(1,1))
|
|
|
|
spf = spf + ",3,3";
|
|
|
|
else if(WARPED && S3 == 3)
|
|
|
|
spf = "[" + spf + ",6],3,3";
|
2019-02-06 15:34:22 +00:00
|
|
|
else if(GOLDBERG && S3 == 3)
|
|
|
|
spf = "[" + spf + ",6],6,6";
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-11-06 20:18:40 +00:00
|
|
|
else {
|
2019-02-06 15:34:22 +00:00
|
|
|
string spf0 = spf;
|
|
|
|
for(int z=1; z<S3; z++) spf = spf + "," + spf0;
|
|
|
|
}
|
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.size_str =
|
2022-05-21 11:08:42 +00:00
|
|
|
disksize ? its(isize(currentmap->allcells())) :
|
2021-08-27 10:06:10 +00:00
|
|
|
#if CAP_BT
|
|
|
|
bt::in() ? fts(8 * M_PI * sqrt(2) * log(2) / pow(vid.binary_width, WDIM-1), 4) + " exp(∞)" :
|
|
|
|
#endif
|
|
|
|
#if CAP_ARCM
|
|
|
|
arcm::in() && (WDIM == 2) ? arcm::current.world_size() :
|
|
|
|
(arcm::in() && sphere) ? its(isize(currentmap->allcells())) :
|
|
|
|
#endif
|
|
|
|
#if CAP_CRYSTAL
|
|
|
|
cryst ? "∞^" + its(ts/2) :
|
|
|
|
#endif
|
2022-05-21 11:08:42 +00:00
|
|
|
WDIM == 3 && closed_manifold ? its(isize(currentmap->allcells())) :
|
2021-08-27 10:06:10 +00:00
|
|
|
WDIM == 3 && euclid ? "∞" :
|
|
|
|
gd.worldsize < 0 ? (gd.nom%gd.denom ? its(gd.nom)+"/"+its(gd.denom) : its(-gd.worldsize)) + " exp(∞)":
|
2022-05-21 11:08:42 +00:00
|
|
|
(euclid && quotient && !closed_manifold) ? "∞" :
|
2021-08-27 10:06:10 +00:00
|
|
|
gd.worldsize == 0 ? "∞²" :
|
|
|
|
its(gd.worldsize);
|
|
|
|
|
|
|
|
#if CAP_IRR
|
|
|
|
if(hyperbolic && IRREGULAR) {
|
|
|
|
gd.nom = isize(irr::cells);
|
|
|
|
// both Klein Quartic and Bolza2 are double the Zebra quotiennt
|
|
|
|
gd.denom = -2;
|
|
|
|
if(!quotient) gd.worldsize = gd.nom / gd.denom;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(WDIM == 3) gd.euler = 0;
|
|
|
|
gd.demigenus = 2 - gd.euler;
|
|
|
|
|
|
|
|
return gd;
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void showEuclideanMenu() {
|
|
|
|
// for(int i=2; i<lt; i++) landvisited[i] = true;
|
|
|
|
|
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2021-08-27 10:06:10 +00:00
|
|
|
|
|
|
|
dialog::init(XLAT("experiment with geometry"));
|
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("geometry"), geometry_name(), 'd');
|
|
|
|
dialog::add_action([] { pushScreen(ge_select_tiling); pushScreen(ge_select_filter); });
|
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("basic tiling"), XLAT(ginf[geometry].tiling_name), 't');
|
|
|
|
dialog::add_action([] {
|
|
|
|
if(!current_filter || !current_filter->test()) set_default_filter();
|
|
|
|
pushScreen(ge_select_tiling);
|
|
|
|
});
|
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
string qstring = ginf[geometry].quotient_name;
|
|
|
|
|
|
|
|
if(qstring == "none")
|
|
|
|
dialog::addBoolItem(XLAT("quotient space"), false, 'q');
|
|
|
|
else
|
|
|
|
dialog::addSelItem(XLAT("quotient space"), XLAT(qstring), 'q');
|
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
dialog::add_action(select_quotient);
|
2019-02-25 23:42:38 +00:00
|
|
|
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_ARCM
|
2020-05-09 16:29:09 +00:00
|
|
|
if(arcm::in()) {
|
|
|
|
dialog::addItem(XLAT("advanced parameters"), '4');
|
|
|
|
dialog::add_action_push(arcm::show);
|
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2020-05-09 16:29:09 +00:00
|
|
|
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_CRYSTAL
|
2020-05-09 16:29:09 +00:00
|
|
|
if(cryst) {
|
|
|
|
dialog::addItem(XLAT("advanced parameters"), '4');
|
|
|
|
dialog::add_action_push(crystal::show);
|
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2020-05-09 16:29:09 +00:00
|
|
|
|
2020-05-16 00:15:34 +00:00
|
|
|
if(fake::available()) {
|
2020-05-31 14:44:44 +00:00
|
|
|
dialog::addItem(XLAT("fake curvature"), '4');
|
|
|
|
|
|
|
|
dialog::add_action([] {
|
|
|
|
if(fake::in()) fake::configure();
|
|
|
|
else dialog::cheat_if_confirmed(
|
|
|
|
fake::configure
|
|
|
|
);
|
|
|
|
});
|
2020-05-16 00:15:34 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 20:09:54 +00:00
|
|
|
if(arb::in() && !(arb::current.sliders.empty() && arb::current.intsliders.empty())) {
|
2020-06-02 00:29:31 +00:00
|
|
|
dialog::addItem(XLAT("tessellation sliders"), '4');
|
|
|
|
dialog::add_action_push(arb::set_sliders);
|
|
|
|
}
|
2022-05-01 09:18:39 +00:00
|
|
|
if(arb::is_apeirogonal()) add_edit(arb::apeirogon_simplified_display);
|
2022-10-06 10:01:31 +00:00
|
|
|
if(arb::in()) add_edit(debug_tiles);
|
2020-06-02 00:29:31 +00:00
|
|
|
|
2020-05-31 15:21:16 +00:00
|
|
|
#if MAXMDIM >= 4
|
2020-05-27 23:50:00 +00:00
|
|
|
if(cgflags & qULTRA) {
|
|
|
|
dialog::addBoolItem(XLAT("truncate ultra-vertices with mirrors"), reg3::ultra_mirror_on, 'Z');
|
|
|
|
dialog::add_action([] {
|
|
|
|
reg3::ultra_mirror_on = !reg3::ultra_mirror_on;
|
|
|
|
ray::reset_raycaster();
|
|
|
|
});
|
|
|
|
}
|
2020-05-31 15:21:16 +00:00
|
|
|
#endif
|
2020-05-27 23:50:00 +00:00
|
|
|
|
2019-08-18 21:12:36 +00:00
|
|
|
if(prod) {
|
|
|
|
dialog::addSelItem(XLAT("Z-level height factor"), fts(vid.plevel_factor), 'Z');
|
|
|
|
dialog::add_action([] {
|
|
|
|
dialog::editNumber(vid.plevel_factor, 0, 2, 0.1, 0.7, XLAT("Z-level height factor"), "");
|
|
|
|
});
|
|
|
|
}
|
2019-08-27 19:42:23 +00:00
|
|
|
else if(hybri) {
|
2020-07-24 14:20:27 +00:00
|
|
|
dialog::addSelItem(XLAT("number of levels"), its(hybrid::csteps / cgi.single_step), 'L');
|
|
|
|
dialog::add_action(hybrid::configure_period);
|
2019-08-27 19:42:23 +00:00
|
|
|
}
|
2019-12-14 11:05:01 +00:00
|
|
|
else if(bt::in()) {
|
2021-02-01 16:14:28 +00:00
|
|
|
menuitem_binary_width('v');
|
2019-05-09 15:54:30 +00:00
|
|
|
add_edit_wall_quality('W');
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
2021-03-21 11:50:32 +00:00
|
|
|
else if(nil) {
|
|
|
|
menuitem_nilwidth('v');
|
|
|
|
}
|
2022-08-13 20:42:59 +00:00
|
|
|
else if((WDIM == 3 || kite::in() || arb::in()) && !reg3::in() && geometry != gCubeTiling) dialog::addBreak(100);
|
2021-02-01 14:10:03 +00:00
|
|
|
else
|
|
|
|
menuitem_change_variation('v');
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2019-09-12 12:24:02 +00:00
|
|
|
if(in_s2xe()) {
|
2019-11-13 19:48:38 +00:00
|
|
|
dialog::addSelItem(XLAT("precision of S2xE rings"), its(s2xe::qrings), '5');
|
2019-09-08 23:35:45 +00:00
|
|
|
dialog::add_action([] {
|
|
|
|
dialog::editNumber(s2xe::qrings, 1, 256, 4, 32, XLAT("precision of S2xE rings"),
|
|
|
|
XLAT(
|
|
|
|
"In S2xE, objects at spherical distances which are multiples of π will look like "
|
|
|
|
"rings, and objects close to these will look like crescents. "
|
2019-09-12 18:27:00 +00:00
|
|
|
"This setting controls the quality of rendering these rings and crescents.")
|
2019-09-08 23:35:45 +00:00
|
|
|
);
|
|
|
|
dialog::bound_low(1);
|
|
|
|
dialog::bound_up(256);
|
|
|
|
});
|
|
|
|
}
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2021-03-30 09:27:48 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-11-13 19:48:38 +00:00
|
|
|
if(hybri) {
|
2019-09-13 17:36:16 +00:00
|
|
|
auto r = rots::underlying_scale;
|
2019-11-13 19:48:38 +00:00
|
|
|
dialog::addSelItem(XLAT("view the underlying geometry"), r > 0 ? fts(r)+"x" : ONOFF(false), '6');
|
2019-09-13 17:36:16 +00:00
|
|
|
dialog::add_action([] {
|
2021-05-23 12:33:25 +00:00
|
|
|
dialog::editNumber(rots::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
|
|
|
geometry == gRotSpace ?
|
|
|
|
XLAT("The space you are currently in is the space of rotations of the underlying hyperbolic or spherical geometry. ")
|
|
|
|
: XLAT("You are currently in a product space.") +
|
2019-10-28 16:26:59 +00:00
|
|
|
XLAT(
|
2019-09-09 13:31:49 +00:00
|
|
|
"This option lets you see the underlying space. Lands and some walls (e.g. in the Graveyard) are based on "
|
|
|
|
"the respective features in the underlying world, but details such as monsters or items are ignored."
|
|
|
|
)
|
|
|
|
);
|
|
|
|
dialog::bound_low(0);
|
|
|
|
dialog::bound_up(1);
|
|
|
|
dialog::extra_options = [] () { rots::draw_underlying(true); };
|
|
|
|
});
|
|
|
|
}
|
2021-03-30 09:27:48 +00:00
|
|
|
#endif
|
2019-09-09 13:31:49 +00:00
|
|
|
|
2020-05-09 08:41:15 +00:00
|
|
|
if(stretch::applicable()) {
|
|
|
|
dialog::addSelItem(XLAT("stretched geometry"), fts(stretch::factor), 'S');
|
2021-04-07 12:44:38 +00:00
|
|
|
dialog::add_action(edit_stretch);
|
2020-05-09 08:41:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-24 22:39:19 +00:00
|
|
|
dialog::addBreak(100);
|
2021-04-11 20:15:40 +00:00
|
|
|
menuitem_land_structure('l');
|
2022-05-21 11:08:42 +00:00
|
|
|
add_edit(req_disksize);
|
2019-04-04 12:36:45 +00:00
|
|
|
|
2022-05-21 11:08:42 +00:00
|
|
|
if(specialland == laMinefield && closed_or_bounded) {
|
2019-04-04 12:36:45 +00:00
|
|
|
dialog::addSelItem(XLAT("number of mines"), its(bounded_mine_quantity), 'm');
|
|
|
|
dialog::add_action([] {
|
2019-04-04 15:14:46 +00:00
|
|
|
dialog::editNumber(bounded_mine_quantity, 0, bounded_mine_max, 1, (bounded_mine_max+5)/10,
|
2019-04-04 12:36:45 +00:00
|
|
|
XLAT("number of mines"), "");
|
|
|
|
dialog::reaction = [] {
|
|
|
|
if(bounded_mine_quantity < 0) bounded_mine_quantity = 0;
|
|
|
|
if(bounded_mine_quantity > bounded_mine_max) bounded_mine_quantity = bounded_mine_max;
|
|
|
|
};
|
|
|
|
dialog::reaction_final = [] {
|
|
|
|
bounded_mine_percentage = bounded_mine_quantity * 1. / bounded_mine_max;
|
|
|
|
stop_game();
|
|
|
|
start_game();
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2019-04-08 12:58:54 +00:00
|
|
|
|
2019-12-26 18:04:32 +00:00
|
|
|
if(geometry_has_alt_mine_rule()) {
|
2021-05-23 12:33:25 +00:00
|
|
|
dialog::addSelItem(XLAT("adjacency rule"), mine_adjacency_rule ? XLAT("vertex") : WDIM == 3 ? XLAT("face") : XLAT("edge"), 'M');
|
2019-04-08 12:58:54 +00:00
|
|
|
dialog::add_action([] {
|
|
|
|
stop_game();
|
|
|
|
mine_adjacency_rule = !mine_adjacency_rule;
|
|
|
|
start_game();
|
2019-12-26 18:04:32 +00:00
|
|
|
addMessage(XLAT("Note: adjacency rule affects environmental effects, but not movement."));
|
2019-04-08 12:58:54 +00:00
|
|
|
});
|
|
|
|
}
|
2019-04-04 12:36:45 +00:00
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addBoolItem(XLAT("pattern"), specialland == laCanvas, 'p');
|
|
|
|
if(specialland == laCanvas) dialog::lastItem().value = patterns::whichCanvas;
|
2019-03-30 22:59:51 +00:00
|
|
|
dialog::add_action_push(patterns::showPrePattern);
|
2019-02-06 15:34:22 +00:00
|
|
|
validity_info();
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) {
|
2019-03-20 01:10:53 +00:00
|
|
|
dialog::addItem(XLAT("3D configuration"), '9');
|
2019-03-30 22:59:51 +00:00
|
|
|
dialog::add_action_push(show3D);
|
2019-02-28 02:41:12 +00:00
|
|
|
}
|
2021-02-01 14:10:03 +00:00
|
|
|
menuitem_projection('1');
|
2019-08-27 19:42:59 +00:00
|
|
|
if(nonisotropic && !sl2)
|
2019-08-06 10:00:46 +00:00
|
|
|
dialog::addBoolItem_action(XLAT("geodesic movement in Sol/Nil"), nisot::geodesic_movement, 'G');
|
2019-03-06 15:36:10 +00:00
|
|
|
#if CAP_CRYSTAL && MAXMDIM >= 4
|
|
|
|
crystal::add_crystal_transform('x');
|
|
|
|
#endif
|
2019-02-06 15:34:22 +00:00
|
|
|
|
|
|
|
dialog::addBreak(50);
|
|
|
|
|
2019-02-08 15:52:44 +00:00
|
|
|
#if CAP_SHOT
|
2019-04-04 15:13:15 +00:00
|
|
|
dialog::addItem(XLAT("take screenshot"), 's');
|
2019-03-30 22:59:51 +00:00
|
|
|
dialog::add_action_push(shot::menu);
|
2019-02-08 15:52:44 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-06 15:34:22 +00:00
|
|
|
dialog::addHelp();
|
|
|
|
dialog::addBack();
|
|
|
|
|
|
|
|
dialog::addBreak(150);
|
|
|
|
|
2020-01-06 21:03:45 +00:00
|
|
|
dialog::addTitle(XLAT("info about: %1", full_geometry_name()), 0xFFFFFF, 150);
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
auto gd = compute_geometry_data();
|
|
|
|
if(WDIM == 2 && !arb::in() && !kite::in()) dialog::addSelItem(XLAT("faces per vertex"), gd.spf, 0);
|
2019-12-27 01:07:44 +00:00
|
|
|
|
|
|
|
if(arb::in() && arb::current.comment != "") {
|
|
|
|
dialog::addBreak(100);
|
|
|
|
dialog::addHelp(arb::current.comment);
|
|
|
|
}
|
2019-02-25 23:42:38 +00:00
|
|
|
|
2021-08-27 10:06:10 +00:00
|
|
|
dialog::addSelItem(XLAT("size of the world"), gd.size_str, '3');
|
2019-02-06 15:34:22 +00:00
|
|
|
|
2022-08-26 10:27:57 +00:00
|
|
|
if(WDIM == 2 || reg3::exact_rules()) dialog::add_action([] {
|
2019-02-06 15:34:22 +00:00
|
|
|
if(!viewdists) { enable_viewdists(); pushScreen(viewdist_configure_dialog); }
|
|
|
|
else if(viewdists) viewdists = false;
|
|
|
|
});
|
|
|
|
|
2022-05-21 11:08:42 +00:00
|
|
|
if(closed_manifold) {
|
2021-08-27 10:06:10 +00:00
|
|
|
dialog::addSelItem(XLAT("Euler characteristics"), its(gd.euler), 0);
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) ;
|
2019-02-25 23:42:38 +00:00
|
|
|
else if(nonorientable)
|
2021-08-27 10:06:10 +00:00
|
|
|
dialog::addSelItem(XLAT("demigenus"), its(gd.demigenus), 0);
|
2019-02-06 15:34:22 +00:00
|
|
|
else
|
2021-08-27 10:06:10 +00:00
|
|
|
dialog::addSelItem(XLAT("genus"), its(gd.demigenus/2), 0);
|
2019-02-06 15:34:22 +00:00
|
|
|
}
|
|
|
|
else dialog::addBreak(200);
|
|
|
|
|
|
|
|
dialog::display();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX void runGeometryExperiments() {
|
2019-03-10 18:15:48 +00:00
|
|
|
if(!geometry && specialland == laIce)
|
2018-08-17 22:46:45 +00:00
|
|
|
specialland = getLandForList(cwt.at);
|
2017-11-06 20:18:40 +00:00
|
|
|
pushScreen(showEuclideanMenu);
|
|
|
|
}
|
|
|
|
|
2018-07-19 21:46:58 +00:00
|
|
|
#if CAP_COMMANDLINE
|
2019-03-06 15:32:38 +00:00
|
|
|
|
2020-04-17 15:17:22 +00:00
|
|
|
EX eGeometry readGeo(const string& ss) {
|
2019-10-05 11:02:28 +00:00
|
|
|
for(int i=0; i<isize(ginf); i++) if(ginf[i].shortname == ss) return eGeometry(i);
|
2019-03-06 15:32:38 +00:00
|
|
|
bool numeric = true;
|
|
|
|
for(char c: ss) if(c < '0' || c > '9') numeric = false;
|
|
|
|
if(numeric) return eGeometry(atoi(ss.c_str()));
|
|
|
|
for(int i=0; i<isize(ginf); i++) if(appears(ginf[i].menu_displayed_name, ss)) {
|
|
|
|
return eGeometry(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return gNormal;
|
|
|
|
}
|
|
|
|
|
2021-04-07 12:45:05 +00:00
|
|
|
EX void field_quotient_3d(int p, unsigned hash) {
|
|
|
|
check_cgi();
|
|
|
|
cgi.require_basics();
|
|
|
|
stop_game_and_switch_mode(rg::nothing);
|
|
|
|
fieldpattern::field_from_current();
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
for(;; p++) {
|
|
|
|
println(hlog, "trying p = ", p);
|
|
|
|
currfp.Prime = p; currfp.force_hash = hash; if(!currfp.solve()) break;
|
|
|
|
}
|
|
|
|
println(hlog, "set prime = ", currfp.Prime);
|
|
|
|
}
|
|
|
|
|
2021-04-23 18:10:06 +00:00
|
|
|
EX void field_quotient_2d(int group, int id, int triplet) {
|
|
|
|
using namespace fieldpattern;
|
|
|
|
current_extra = group;
|
|
|
|
|
|
|
|
auto& gxcur = fgeomextras[current_extra];
|
|
|
|
while(id >= isize(gxcur.primes)) nextPrime(gxcur);
|
|
|
|
|
|
|
|
fgeomextras[current_extra].current_prime_id = id;
|
|
|
|
if(triplet != -1)
|
|
|
|
triplet_id = triplet;
|
|
|
|
enableFieldChange();
|
|
|
|
set_geometry(gFieldQuotient);
|
|
|
|
}
|
|
|
|
|
2018-07-19 21:46:58 +00:00
|
|
|
int read_geom_args() {
|
|
|
|
using namespace arg;
|
2019-02-17 17:33:15 +00:00
|
|
|
if(0) ;
|
|
|
|
#if CAP_FIELD
|
|
|
|
else if(argis("-qpar")) {
|
2018-07-19 21:46:58 +00:00
|
|
|
int p;
|
|
|
|
shift(); sscanf(argcs(), "%d,%d,%d",
|
|
|
|
&p, "ientspace::rvadd, "ientspace::rvdir
|
|
|
|
);
|
|
|
|
autocheat = true;
|
|
|
|
currfp.init(p);
|
|
|
|
}
|
|
|
|
else if(argis("-qpar2")) {
|
|
|
|
stop_game_and_switch_mode(rg::nothing);
|
|
|
|
int a, b;
|
|
|
|
shift(); sscanf(argcs(), "%d,%d", &a, &b);
|
2021-04-23 18:10:06 +00:00
|
|
|
field_quotient_2d(a, b, -1);
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
2021-03-08 12:30:55 +00:00
|
|
|
else if(argis("-triplet")) {
|
|
|
|
stop_game();
|
|
|
|
shift(); fieldpattern::triplet_id = argi();
|
|
|
|
fieldpattern::enableFieldChange();
|
|
|
|
}
|
2020-01-15 16:58:41 +00:00
|
|
|
else if(argis("-to-fq")) {
|
2020-07-07 20:25:09 +00:00
|
|
|
int p = 2;
|
|
|
|
shift();
|
|
|
|
if(args() == "p") {
|
|
|
|
shift(); p = argi();
|
|
|
|
shift();
|
|
|
|
}
|
|
|
|
unsigned hash = arghex();
|
2021-04-07 12:45:05 +00:00
|
|
|
field_quotient_3d(p, hash);
|
2020-01-15 16:58:41 +00:00
|
|
|
}
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-cs")) {
|
|
|
|
shift(); cheat();
|
|
|
|
fieldpattern::matrix M = currfp.strtomatrix(args());
|
|
|
|
fieldpattern::subpathid = currfp.matcode[M];
|
|
|
|
fieldpattern::subpathorder = currfp.order(M);
|
|
|
|
}
|
2020-01-26 00:18:30 +00:00
|
|
|
else if(argis("-fwrite")) {
|
|
|
|
shstream hs;
|
|
|
|
hwrite_fpattern(hs, currfp);
|
2021-05-23 13:51:03 +00:00
|
|
|
println(hlog, "current fieldpattern hash: ", currfp.hashv);
|
2020-02-26 00:29:01 +00:00
|
|
|
println(hlog, "current fieldpattern: ", as_cstring(hs.s));
|
2020-01-26 00:18:30 +00:00
|
|
|
}
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-csp")) {
|
|
|
|
cheat();
|
|
|
|
currfp.findsubpath();
|
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2019-04-08 12:58:54 +00:00
|
|
|
else if(argis("-mineadj")) {
|
|
|
|
shift(); mine_adjacency_rule = argi();
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
TOGGLE('7', PURE, set_variation(PURE ? eVariation::bitruncated : eVariation::pure))
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-geo")) {
|
2018-08-17 11:29:00 +00:00
|
|
|
PHASEFROM(2);
|
2018-08-28 15:17:34 +00:00
|
|
|
shift();
|
2019-03-06 15:32:38 +00:00
|
|
|
set_geometry(readGeo(args()));
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-gp")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); gp::param.first = argi();
|
|
|
|
shift(); gp::param.second = argi();
|
2018-08-28 15:17:34 +00:00
|
|
|
set_variation(eVariation::goldberg);
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
2022-01-08 18:20:53 +00:00
|
|
|
else if(argis("-gph")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); int x = argi();
|
|
|
|
shift(); int y = argi();
|
|
|
|
gp::whirl_set({x, y});
|
|
|
|
}
|
2020-07-12 18:52:32 +00:00
|
|
|
else if(argis("-unrectified")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
set_variation(eVariation::unrectified);
|
|
|
|
}
|
|
|
|
else if(argis("-untruncated")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
set_variation(eVariation::untruncated);
|
|
|
|
}
|
|
|
|
else if(argis("-warped")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
set_variation(eVariation::warped);
|
|
|
|
}
|
2022-02-17 20:00:10 +00:00
|
|
|
#if MAXMDIM >= 4
|
2021-07-06 23:48:20 +00:00
|
|
|
else if(argis("-subcubes")) {
|
|
|
|
PHASEFROM(2);
|
2021-07-18 09:15:13 +00:00
|
|
|
stop_game();
|
2021-07-06 23:48:20 +00:00
|
|
|
set_variation(eVariation::subcubes);
|
|
|
|
shift(); reg3::subcube_count = argi();
|
|
|
|
}
|
2021-07-07 16:26:03 +00:00
|
|
|
else if(argis("-dual-subcubes")) {
|
|
|
|
PHASEFROM(2);
|
2021-07-18 09:15:13 +00:00
|
|
|
stop_game();
|
2021-07-07 16:26:03 +00:00
|
|
|
set_variation(eVariation::dual_subcubes);
|
|
|
|
shift(); reg3::subcube_count = argi();
|
|
|
|
}
|
|
|
|
else if(argis("-bch-subcubes")) {
|
|
|
|
PHASEFROM(2);
|
2021-07-18 09:15:13 +00:00
|
|
|
stop_game();
|
2021-07-07 16:26:03 +00:00
|
|
|
set_variation(eVariation::bch);
|
|
|
|
shift(); reg3::subcube_count = argi();
|
|
|
|
}
|
2021-07-13 13:12:03 +00:00
|
|
|
else if(argis("-bch-oct")) {
|
|
|
|
PHASEFROM(2);
|
2021-07-18 09:15:13 +00:00
|
|
|
stop_game();
|
2021-07-13 13:12:03 +00:00
|
|
|
set_variation(eVariation::bch_oct);
|
|
|
|
shift(); reg3::subcube_count = argi();
|
|
|
|
}
|
2021-07-08 22:07:35 +00:00
|
|
|
else if(argis("-coxeter")) {
|
|
|
|
PHASEFROM(2);
|
2021-07-18 09:15:13 +00:00
|
|
|
stop_game();
|
2021-07-08 22:07:35 +00:00
|
|
|
set_variation(eVariation::coxeter);
|
|
|
|
shift(); reg3::coxeter_param = argi();
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2022-02-17 20:00:10 +00:00
|
|
|
#endif
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-fi")) {
|
|
|
|
fieldpattern::info();
|
|
|
|
exit(0);
|
|
|
|
}
|
2019-11-22 13:00:22 +00:00
|
|
|
else if(argis("-fi-at")) {
|
|
|
|
geometry = gNormal;
|
|
|
|
shift(); dynamicval<int> s7(S7, argi());
|
|
|
|
shift(); dynamicval<int> s3(S3, argi());
|
|
|
|
fieldpattern::info();
|
|
|
|
exit(0);
|
|
|
|
}
|
2020-01-15 16:58:41 +00:00
|
|
|
else if(argis("-fi-geo")) {
|
|
|
|
fieldpattern::info();
|
|
|
|
exit(0);
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-qs")) {
|
|
|
|
cheat();
|
|
|
|
shift(); currfp.qpaths.push_back(args());
|
|
|
|
}
|
2020-05-31 15:21:16 +00:00
|
|
|
#if MAXMDIM >= 4
|
2020-05-27 23:50:00 +00:00
|
|
|
else if(argis("-truncate-ultra")) {
|
|
|
|
shift(); reg3::ultra_mirror_on = argi();
|
|
|
|
}
|
2020-05-31 15:21:16 +00:00
|
|
|
#endif
|
2018-11-11 10:06:32 +00:00
|
|
|
else if(argis("-d:quotient"))
|
|
|
|
launch_dialog(showQuotientConfig);
|
2021-07-07 16:27:26 +00:00
|
|
|
else if(argis("-uqf"))
|
|
|
|
fieldpattern::use_quotient_fp = true;
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2018-11-11 10:06:32 +00:00
|
|
|
else if(argis("-d:geom"))
|
|
|
|
launch_dialog(showEuclideanMenu);
|
2018-07-19 21:46:58 +00:00
|
|
|
else return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ah_geom = addHook(hooks_args, 0, read_geom_args);
|
|
|
|
#endif
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|