rogueviz:: reorganized the presentations

This commit is contained in:
Zeno Rogue 2021-03-30 21:48:04 +02:00
parent 30b79de1f5
commit bdf97fc6de
14 changed files with 95 additions and 47 deletions

View File

@ -558,10 +558,11 @@ int readArgs() {
auto hook = addHook(hooks_args, 100, readArgs) auto hook = addHook(hooks_args, 100, readArgs)
+ addHook(hooks_initgame, 100, bantar) + addHook(hooks_initgame, 100, bantar)
+ addHook(hooks_frame, 100, bantar_stats) + addHook(hooks_frame, 100, bantar_stats)
+ addHook(pres::hooks_build_rvtour, 140, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 140, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
using namespace pres; using namespace pres;
v.push_back( v.push_back(
tour::slide{"unsorted/Banach-Tarski-like", 62, LEGAL::NONE, tour::slide{"Banach-Tarski-like", 62, LEGAL::NONE,
"Banach-Tarski-like decomposition. Break a hyperbolic plane into two hyperbolic planes.\n\n" "Banach-Tarski-like decomposition. Break a hyperbolic plane into two hyperbolic planes.\n\n"
"Press '5' to show the decomposition. Press any key to stop.\n\n" "Press '5' to show the decomposition. Press any key to stop.\n\n"
"You will see a map of the decomposition. Press '5' again to return.", "You will see a map of the decomposition. Press '5' again to return.",

View File

@ -313,10 +313,11 @@ int readArgs() {
} }
int ah = addHook(hooks_args, 100, readArgs) + int ah = addHook(hooks_args, 100, readArgs) +
addHook(pres::hooks_build_rvtour, 142, [] (vector<tour::slide>& v) { addHook(pres::hooks_build_rvtour, 42, [] (string s, vector<tour::slide>& v) {
if(s != "data") return;
using namespace tour; using namespace tour;
v.push_back( v.push_back(
tour::slide{"unsorted/Collatz conjecture", 51, LEGAL::UNLIMITED | QUICKGEO, tour::slide{"Collatz conjecture", 51, LEGAL::UNLIMITED | QUICKGEO,
"The following slide is a visualization of the Collatz conjecture. " "The following slide is a visualization of the Collatz conjecture. "
"Press '5' for a spiral rendering of the Collatz conjecture visualization.\n\n" "Press '5' for a spiral rendering of the Collatz conjecture visualization.\n\n"
"Note that this, and many other RogueViz visualizations, have " "Note that this, and many other RogueViz visualizations, have "

View File

@ -496,10 +496,11 @@ auto hook = addHook(hooks_args, 100, readArgsG)
}) })
+ addHook(hooks_initialize, 100, create_grigorchuk_geometry) + addHook(hooks_initialize, 100, create_grigorchuk_geometry)
+ addHook(rogueviz::pres::hooks_build_rvtour, 140, [] (vector<tour::slide>& v) { + addHook(rogueviz::pres::hooks_build_rvtour, 140, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
using namespace rogueviz::pres; using namespace rogueviz::pres;
v.push_back(tour::slide{ v.push_back(tour::slide{
"unsorted/Grigorchuk group", 10, tour::LEGAL::NONE, "Grigorchuk group", 10, tour::LEGAL::NONE,
"This is a visualization of the Grigorchuk group. It is the first known group with " "This is a visualization of the Grigorchuk group. It is the first known group with "
"intermediate growth (i.e., superpolynomial and subexponential).\n\n" "intermediate growth (i.e., superpolynomial and subexponential).\n\n"

View File

@ -290,10 +290,11 @@ auto hchook = addHook(hooks_drawcell, 100, draw_ptriangle)
+ addHook(hooks_o_key, 80, o_key) + addHook(hooks_o_key, 80, o_key)
+ addHook(pres::hooks_build_rvtour, 167, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 167, [] (string s, vector<tour::slide>& v) {
if(s != "noniso") return;
using namespace tour; using namespace tour;
v.push_back( v.push_back(
tour::slide{"non-isotropic geometries/Impossible architecture in Nil/impossible ring", 18, LEGAL::NONE | QUICKGEO, tour::slide{"Impossible architecture in Nil/impossible ring", 18, LEGAL::NONE | QUICKGEO,
"Ring with a square cross-section. Cut it in half. Rotate one of the two halves by 90°, " "Ring with a square cross-section. Cut it in half. Rotate one of the two halves by 90°, "
"keeping one of the two ends connected to the other half. Do this in Nil geometry, so the other pair of ends remains connected too.\n\n" "keeping one of the two ends connected to the other half. Do this in Nil geometry, so the other pair of ends remains connected too.\n\n"
"Move with mouse/arrows/PgUpDn. Press '5' to enable animation, 'o' to change ring size.\n\n", "Move with mouse/arrows/PgUpDn. Press '5' to enable animation, 'o' to change ring size.\n\n",

View File

@ -84,9 +84,10 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
}; };
} }
string cap = "non-isotropic geometries/honeycombs/"; string cap = "honeycombs/";
void honey(vector<tour::slide>& v) { void honey(string s, vector<tour::slide>& v) {
if(s != "noniso") return;
using namespace tour; using namespace tour;
v.emplace_back( v.emplace_back(
@ -146,11 +147,13 @@ void honey(vector<tour::slide>& v) {
} }
void start_noniso(vector<tour::slide>& v) { vector<tour::slide> noniso_slides;
tour::slide *gen_noniso_demo() {
noniso_slides.clear();
using namespace tour; using namespace tour;
v.emplace_back( noniso_slides.emplace_back(
slide{"non-isotropic geometries/intro slide", 999, LEGAL::NONE | QUICKSKIP, slide{"Non-isotropic geometry demo", 999, LEGAL::NONE | QUICKSKIP,
"This is a collection of non-isotropic geometry demos.", "This is a presentation of non-isotropic geometries.",
[] (presmode mode) { [] (presmode mode) {
if(mode == pmStart) { if(mode == pmStart) {
stop_game(); stop_game();
@ -159,9 +162,19 @@ void start_noniso(vector<tour::slide>& v) {
} }
} }
}); });
callhooks(pres::hooks_build_rvtour, "noniso", noniso_slides);
pres::add_end(noniso_slides);
return &noniso_slides[0];
} }
auto hooks = addHook(pres::hooks_build_rvtour, 163, honey) auto hooks = addHook(pres::hooks_build_rvtour, 163, honey)
+ addHook(pres::hooks_build_rvtour, 160, start_noniso); + addHook(tour::ss::hooks_extra_slideshows, 120, [] (tour::ss::slideshow_callback cb) {
if(noniso_slides.empty())
gen_noniso_demo();
cb(XLAT("non-isotropic geometries"), &noniso_slides[0], 'n');
});
} } } }

View File

@ -347,10 +347,11 @@ auto xhook = addHook(hooks_args, 100, readArgs)
+ addHook(hooks_handleKey, 0, handleKey) + addHook(hooks_handleKey, 0, handleKey)
+ addHook(hooks_prestats, 0, frame) + addHook(hooks_prestats, 0, frame)
+ addHook(hooks_clearmemory, 40, [] () { snubon = false; } ) + addHook(hooks_clearmemory, 40, [] () { snubon = false; } )
+ addHook(pres::hooks_build_rvtour, 142, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 142, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
using namespace tour; using namespace tour;
v.push_back( v.push_back(
tour::slide{"unsorted/Pentagonal Exploration", 62, LEGAL::NONE | QUICKGEO, tour::slide{"Pentagonal Exploration", 62, LEGAL::NONE | QUICKGEO,
"Pentagonal Exploration explained at: http://www.roguetemple.com/z/sims/snub/\n\n" "Pentagonal Exploration explained at: http://www.roguetemple.com/z/sims/snub/\n\n"
"Move the mouse nearer and further away from the X.\n\n" "Move the mouse nearer and further away from the X.\n\n"
"Press 3 4 5 6 7 8 9 shift+4 shift+5 shift+6 to change the geometry.", "Press 3 4 5 6 7 8 9 shift+4 shift+5 shift+6 to change the geometry.",

View File

@ -303,28 +303,48 @@ void compare_projections(presmode mode, eModel a, eModel b) {
/* default RogueViz tour */ /* default RogueViz tour */
vector<slide> rvslides; vector<slide> rvslides_mixed;
vector<slide> rvslides_data;
extern vector<slide> rvslides_default; extern vector<slide> rvslides_default;
slide *gen_rvtour() { void add_end(vector<slide>& s) {
rvslides = rvslides_default; s.emplace_back(
callhooks(hooks_build_rvtour, rvslides);
rvslides.emplace_back(
slide{"THE END", 99, LEGAL::ANY | FINALSLIDE, slide{"THE END", 99, LEGAL::ANY | FINALSLIDE,
"Press '5' to leave the presentation.", "Press '5' to leave the presentation.",
[] (presmode mode) { [] (presmode mode) {
firstland = specialland = laIce; if(mode == pmStart) firstland = specialland = laIce;
if(mode == 4) restart_game(rg::tour); if(mode == 4) restart_game(rg::tour);
} }
}); });
return &rvslides[0]; }
slide *gen_rvtour_data() {
rvslides_data = rvslides_default;
callhooks(hooks_build_rvtour, "data", rvslides_data);
add_end(rvslides_data);
return &rvslides_data[0];
}
slide *gen_rvtour_mixed() {
rvslides_mixed.emplace_back(slide{
"RogueViz", 999, LEGAL::ANY,
"This presentation is mostly composed from various unsorted demos, mostly posted on Twitter and YouTube. Press Enter to continue, ESC to look at other functions of this presentation.",
[] (presmode mode) {}
});
callhooks(hooks_build_rvtour, "mixed", rvslides_mixed);
add_end(rvslides_mixed);
return &rvslides_mixed[0];
} }
vector<slide> rvslides_default = { vector<slide> rvslides_default = {
{"RogueViz", 999, LEGAL::ANY, {"intro", 999, LEGAL::ANY,
"This is a presentation of RogueViz, which " "Hyperbolic space is great "
"is an adaptation of HyperRogue as a visualization tool "
"rather than a game. Hyperbolic space is great "
"for visualizing some kinds of data because of the vast amount " "for visualizing some kinds of data because of the vast amount "
"of space.\n\n" "of space.\n\n"
"Press '5' to switch to the standard HyperRogue tutorial. " "Press '5' to switch to the standard HyperRogue tutorial. "
@ -346,7 +366,7 @@ vector<slide> rvslides_default = {
[] (presmode mode) { [] (presmode mode) {
using namespace linepatterns; using namespace linepatterns;
slidecommand = "toggle the Palace lines"; slidecommand = "toggle the Palace lines";
if(mode == 4) patPalace.color = 0xFFD500FF; if(mode == 4) patPalace.color = (patPalace.color == 0xFFD500FF ? 0 : 0xFFD500FF);
if(mode == 3) patPalace.color = 0xFFD50000; if(mode == 3) patPalace.color = 0xFFD50000;
} }
}, },
@ -363,15 +383,18 @@ int pres_hooks =
"common HyperRogue tutorial first is useful too, " "common HyperRogue tutorial first is useful too, "
"as an introduction to hyperbolic geometry."; "as an introduction to hyperbolic geometry.";
if(mode == 4) { if(mode == 4) {
slides = gen_rvtour();
while(tour::on) restart_game(rg::tour); while(tour::on) restart_game(rg::tour);
tour::start(); pushScreen(choose_presentation);
} }
} }
}) + }) +
addHook(tour::ss::hooks_extra_slideshows, 100, [] (tour::ss::slideshow_callback cb) { addHook(tour::ss::hooks_extra_slideshows, 100, [] (tour::ss::slideshow_callback cb) {
if(rogueviz::pres::rvslides.empty()) pres::gen_rvtour(); if(rogueviz::pres::rvslides_data.empty()) pres::gen_rvtour_data();
cb(XLAT("RogueViz mixed bag"), &pres::rvslides[0], 'r'); cb(XLAT("non-Euclidean geometry in data analysis"), &pres::rvslides_data[0], 'd');
if(rogueviz::pres::rvslides_mixed.empty()) pres::gen_rvtour_mixed();
cb(XLAT("unsorted RogueViz demos"), &pres::rvslides_mixed[0], 'u');
}) + }) +
0; 0;

View File

@ -208,7 +208,8 @@ auto msc =
walkers.clear(); walkers.clear();
total_time = 0; total_time = 0;
}) })
+ addHook(pres::hooks_build_rvtour, 180, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 180, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
v.push_back(tour::slide{ v.push_back(tour::slide{
cap+"random walk visualization", 10, tour::LEGAL::NONE | tour::QUICKSKIP, cap+"random walk visualization", 10, tour::LEGAL::NONE | tour::QUICKSKIP,
"Here we see random walk in various geometries.\n" "Here we see random walk in various geometries.\n"

View File

@ -560,9 +560,10 @@ int ah = addHook(hooks_args, 100, readArgs)
dialog::addSelItem(XLAT("SAG mode"), sag::sagmodes[sag::sagmode], 'm'); dialog::addSelItem(XLAT("SAG mode"), sag::sagmodes[sag::sagmode], 'm');
dialog::add_action([] { sag::sagmode = sag::eSagmode( (1+sag::sagmode) % 3 ); }); dialog::add_action([] { sag::sagmode = sag::eSagmode( (1+sag::sagmode) % 3 ); });
}) })
+ addHook(pres::hooks_build_rvtour, 120, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 120, [] (string s, vector<tour::slide>& v) {
if(s != "data") return;
using namespace pres; using namespace pres;
string sagf = "hyperbolic geometry and data/SAG/"; string sagf = "SAG/";
v.push_back( v.push_back(
slide{sagf+"Roguelikes", 63, LEGAL::UNLIMITED | QUICKGEO, slide{sagf+"Roguelikes", 63, LEGAL::UNLIMITED | QUICKGEO,
"A visualization of roguelikes, based on discussion on /r/reddit. " "A visualization of roguelikes, based on discussion on /r/reddit. "

View File

@ -140,7 +140,7 @@ bool draw_snow(cell *c, const shiftmatrix& V) {
bool cylanim = false; bool cylanim = false;
string cap = "non-isotropic geometries/non-Euclidean snowballs/"; string cap = "non-Euclidean snowballs/";
void snow_slide(vector<tour::slide>& v, string title, string desc, reaction_t t) { void snow_slide(vector<tour::slide>& v, string title, string desc, reaction_t t) {
using namespace tour; using namespace tour;
@ -236,7 +236,8 @@ auto hchook = addHook(hooks_drawcell, 100, draw_snow)
}) })
#endif #endif
+ addHook(pres::hooks_build_rvtour, 161, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 161, [] (string s, vector<tour::slide>& v) {
if(s != "noniso") return;
v.push_back(tour::slide{ v.push_back(tour::slide{
cap+"snowball visualization", 10, tour::LEGAL::NONE | tour::QUICKSKIP, cap+"snowball visualization", 10, tour::LEGAL::NONE | tour::QUICKSKIP,
"Non-Euclidean visualizations usually show some regular constructions. Could we visualize the geometries themselves? Let's distribute the snowballs randomly." "Non-Euclidean visualizations usually show some regular constructions. Could we visualize the geometries themselves? Let's distribute the snowballs randomly."

View File

@ -353,10 +353,11 @@ int phooks = addHook(hooks_args, 100, readArgs)
if(staircase::on) { staircase::showMenu(); return true; } if(staircase::on) { staircase::showMenu(); return true; }
return false; return false;
}) })
+ addHook(pres::hooks_build_rvtour, 141, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 141, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
using namespace tour; using namespace tour;
v.push_back( v.push_back(
tour::slide{"unsorted/Spiral Staircase", 62, LEGAL::NONE | QUICKGEO, tour::slide{"Spiral Staircase", 62, LEGAL::NONE | QUICKGEO,
"Spiral Staircase Demo. Press '5' to change the curvature or other parameters.", "Spiral Staircase Demo. Press '5' to change the curvature or other parameters.",
[] (presmode mode) { [] (presmode mode) {

View File

@ -269,10 +269,11 @@ auto hook = 0
#endif #endif
+ addHook(hooks_o_key, 80, o_key) + addHook(hooks_o_key, 80, o_key)
+ addHook(hooks_drawcell, 100, sunflower_cell) + addHook(hooks_drawcell, 100, sunflower_cell)
+ addHook(pres::hooks_build_rvtour, 144, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 144, [] (string s, vector<tour::slide>& v) {
if(s != "mixed") return;
using namespace tour; using namespace tour;
v.push_back( v.push_back(
tour::slide{"unsorted/sunflower spirals", 18, LEGAL::ANY | QUICKGEO, tour::slide{"sunflower spirals", 18, LEGAL::ANY | QUICKGEO,
"A sunflower sends out its n-th seed at angle 180° (3-sqrt(5)). " "A sunflower sends out its n-th seed at angle 180° (3-sqrt(5)). "
"As new seeds are created, older seeds are pushed out. Therefore. " "As new seeds are created, older seeds are pushed out. Therefore. "
"the distance d(n) of the n-th seed from the center will be such that " "the distance d(n) of the n-th seed from the center will be such that "

View File

@ -122,10 +122,11 @@ int readArgs() {
} }
int ah = addHook(hooks_args, 120, readArgs) int ah = addHook(hooks_args, 120, readArgs)
+ addHook(pres::hooks_build_rvtour, 120, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 120, [] (string s, vector<tour::slide>& v) {
if(s != "data") return;
using namespace pres; using namespace pres;
v.push_back( v.push_back(
tour::slide{"hyperbolic geometry and data/Tree of Life", 61, LEGAL::UNLIMITED | QUICKGEO, tour::slide{"Tree of Life", 61, LEGAL::UNLIMITED | QUICKGEO,
"Hyperbolic geometry is much better than the Euclidean geometry at visualizing large trees and other hierarchical structures. " "Hyperbolic geometry is much better than the Euclidean geometry at visualizing large trees and other hierarchical structures. "
"Here we visualize the data from the Tree of Life project.", "Here we visualize the data from the Tree of Life project.",

View File

@ -523,10 +523,10 @@ void slide_itri(tour::presmode mode, int id) {
start_game(); start_game();
playermoved = false; playermoved = false;
tour::on_restore(reset); tour::on_restore(reset);
} }
} }
string cap = "non-isotropic geometries/Impossible architecture in Nil/"; string cap = "Impossible architecture in Nil/";
auto hchook = addHook(hooks_drawcell, 100, draw_ptriangle) auto hchook = addHook(hooks_drawcell, 100, draw_ptriangle)
@ -549,8 +549,9 @@ auto hchook = addHook(hooks_drawcell, 100, draw_ptriangle)
return 0; return 0;
}) })
+ addHook(pres::hooks_build_rvtour, 166, [] (vector<tour::slide>& v) { + addHook(pres::hooks_build_rvtour, 166, [] (string s, vector<tour::slide>& v) {
using namespace tour; using namespace tour;
if(s != "noniso") return;
v.push_back( v.push_back(
tour::slide{cap+"impossible triangle", 18, LEGAL::NONE | QUICKGEO, tour::slide{cap+"impossible triangle", 18, LEGAL::NONE | QUICKGEO,