diff --git a/cpp/switchchain.cpp b/cpp/switchchain.cpp index 436dc7a20821815e95ec973e42b11561b121fa49..f04edcc8adb2969cddb286f0b1183810f3345c5f 100644 --- a/cpp/switchchain.cpp +++ b/cpp/switchchain.cpp @@ -104,18 +104,24 @@ int main() { } std::ofstream outfile("graphdata.m"); + outfile << '{'; outfile << '{' << g; std::cout << "Starting switch Markov chain" << std::endl; int movesDone = 0; - int movesTotal = 100000; + constexpr int movesTotal = 10000; + int triangles[movesTotal]; for (int i = 0; i < movesTotal; ++i) { if (chain.doMove()) ++movesDone; + triangles[i] = chain.g.countTriangles(); if (i % (movesTotal / 50) == (movesTotal / 50 - 1)) outfile << ',' << chain.g; } - outfile << '}'; + outfile << '}' << ',' << '{' << triangles[0]; + for (int i = 1; i < movesTotal; ++i) + outfile << ',' << triangles[i]; + outfile << '}' << '}'; std::cout << movesDone << '/' << movesTotal << " moves succeeded." << std::endl;