From 76c303f80ab6100f8ee45a38203a040862688f08 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 30 Aug 2018 16:05:24 +0200 Subject: [PATCH] improved valence computation --- archimedean.cpp | 13 +++++++++++++ hyper.h | 5 ++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index f04feb4f..580b6a65 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -1204,6 +1204,19 @@ string archimedean_tiling::world_size() { int degree(heptagon *h) { return isize(current.adjacent[id_of(h)]); } + +int valence() { + if(PURE) return arcm::current.N; + if(BITRUNCATED) return 3; + // in DUAL, usually valence would depend on the vertex. + // 3 is the most interesting, as it allows us to kill hedgehog warriors + int total = 0; + for(int i: current.faces) { + if(i == 3) return 3; + total += i; + } + return total / isize(current.faces); + } } diff --git a/hyper.h b/hyper.h index 5244d315..57efdded 100644 --- a/hyper.h +++ b/hyper.h @@ -106,8 +106,6 @@ void addMessage(string s, char spamtype = 0); #define masterless among(geometry, gEuclid, gEuclidSquare, gTorus) #define sphere_narcm (sphere && !archimedean) -#define AS3 (archimedean?arcm::current.N : S3) - #define a4 (S3 == 4) #define a45 (S3 == 4 && S7 == 5) #define a46 (S3 == 4 && S7 == 6) @@ -138,13 +136,14 @@ void addMessage(string s, char spamtype = 0); #define PURE (variation == eVariation::pure) #define BITRUNCATED (variation == eVariation::bitruncated) #define DUAL (variation == eVariation::dual) +#define DUALMUL (DUAL ? 2 : 1) #define CHANGED_VARIATION (variation != ginf[geometry].default_variation) #define STDVAR (PURE || BITRUNCATED) #define NONSTDVAR (!STDVAR) -#define VALENCE (BITRUNCATED ? 3 : AS3) +#define VALENCE (BITRUNCATED ? 3 : archimedean ? arcm::valence() : S3) #define NUMWITCH 7