#include <PiSimple.ci>

int main (int argc, char **argv)
{
	ctl::vector<ctl::location> loc = ctl::readLocation("../../../../locs.txt");
	if (loc.size() < 1)
	{
		std::cerr << "No valid location found.\n";
		return 1;
	}
	ctl::link lnk(loc[0]);

	try
	{
		PiSimple::use(lnk);
		int iterations = 100000000, step = 100000, i = 0;
		double w = 1.0/iterations;
		double sum = 0;

		sum = w * PiSimple::calc(w, i, iterations);
		std::cout << "Pi = " << sum << "\n";
	}
	catch (ctl::exception &e)
	{
		std::cerr << e << "\n";
	}
	return 0;
}
