/* Copyright (c) 2018 -- 2022
   Charles Jordan (Hokkaido University, Sapporo, Japan),
   Michael Joswig, Lars Kastner (Technische Universitaet Berlin, Germany)

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 3, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
-----------------------------------------------------------------------------
*/

#include "CommandlineOptions.hh"
#include "ComputeTriangs.hh"
#include "PointConfiguration.hh"
#include "Symmetry.hh"
#include "Chirotope.hh"
#include "PlacingTriang.hh"
#include "ReverseSearchTriangulations.hh"

int main(const int argc, const char** argv) {
   CommandlineOptions::init(argc, argv);
   ReverseSearchWrapper *r;
   
   PointConfiguration points;
   if(!points.read(std::cin)){
      std::cerr << "Error while reading point configuration." << std::endl;
      return 1;
   }
   Chirotope chiro(points, false);
   
   SymmetryGroup group(points.no());
   if(!group.read(std::cin)){
      std::cerr << "No symmetry group provided." << std::endl;
   }
   r = constructReverseSearch(points, chiro, group);
   
   SimplicialComplex seed;
   if(!seed.read(std::cin)){
      seed = PlacingTriang(chiro);
      std::cerr << "No initial triangulation provided." << std::endl;
   }
   TriangNode initial = r->get_initial_triang(chiro.no(), chiro.rank(), seed);

   r->randomized_bfs(initial);
   
   
   return 0;
}
