/* explore the Janko group J1: https://en.wikipedia.org/wiki/Janko_group_J1 */ #include "rogueviz.h" #if !ISWEB namespace hr { eGeometry gJanko1(eGeometry(-1)); struct jmatrix : array, 7> { jmatrix operator * (const jmatrix other) { jmatrix res; for(int a=0; a<7; a++) for(int b=0; b<7; b++) res[a][b] = 0; for(int a=0; a<7; a++) for(int b=0; b<7; b++) for(int c=0; c<7; c++) res[a][c] += self[a][b] * other[b][c]; for(int a=0; a<7; a++) for(int b=0; b<7; b++) res[a][b] %= 11; return res; } }; vector jms; std::map ids; jmatrix J, Z, id; int get_id(const jmatrix& m) { if(ids.count(m)) return ids[m]; ids[m] = isize(jms); jms.push_back(m); return isize(jms)-1; } void build_group(const jmatrix& m) { if(ids.count(m)) return; jmatrix m2 = m; for(int a=0; a<7; a++) { get_id(m2); m2 = m2 * J; } } void build() { for(int a=0; a<7; a++) for(int b=0; b<7; b++) J[a][b] = ((a+1-b)%7 == 0) ? 1 : 0; int v[49] = { 0, 4, 0, 3, 9, 2, 1, 4, 0, 4, 3, 7, 1, 3, 0, 4, 10, 6, 9, 8, 1, 3, 3, 6, 1, 7, 6, 9, 9, 7, 9, 7, 0, 9, 10, 2, 1, 8, 6, 9, 2, 3, 1, 3, 1, 9, 10, 3, 8, /* -3,+2,-1,-1,-3,-1,-3, -2,+1,+1,+3,+1,+3,+3, -1,-1,-3,-1,-3,-3,+2, -1,-3,-1,-3,-3,+2,-1, -3,-1,-3,-3,+2,-1,-1, +1,+3,+3,-2,+1,+1,+3, +3,+3,-2,+1,+1,+3,+1*/ }; int a = 0; for(auto& row: Z) for(auto& i: row) { i = v[a++]; if(i < 0) i += 11; } for(int a=0; a<7; a++) for(int b=0; b<7; b++) id[a][b] = a==b ? 1 : 0; build_group(id); for(int k=0; k connections; connections.clear(); for(int i=0; i