#include <CGAL/Exact_circular_kernel_2.h>
#include <CGAL/point_generators_2.h>
template <typename T>
double prob_2() {
  CGAL::Random_points_in_square_2<Point_2> g(1.0);
  double prob = 0.0;
  for (int i = 0; i < 10000; i++) {
    Point_2 p1, p2, p3, p4, p5, p6;
    p1 = *g++; p2 = *g++; p3 = *g++;
    p4 = *g++; p5 = *g++; p6 = *g++;
    
    
    T o1 = T(p1, p2, p3);
    T o2 = T(p4, p5, p6);
    typedef typename CGAL::CK2_Intersection_traits<Circular_k, T, T>::type 
      Intersection_result;
    std::vector<Intersection_result> res;
    prob += (res.size() != 0) ? 1.0 : 0.0;
  }
  return prob/10000.0;
}
int main()
{
  std::cout << "What is the probability that two arcs formed by" << std::endl;
  std::cout << "three random counterclockwise-oriented points on" << std::endl;
  std::cout << "an unit square intersect? (wait a second please)" << std::endl;
  std::cout << "The probability is: " << prob_2<Circular_arc_2>() <<
    std::endl << std::endl;
  std::cout << "And what about the probability that two circles formed by" 
    << std::endl;
  std::cout << "three random counterclockwise-oriented points on" << std::endl;
  std::cout << "an unit square intersect? (wait a second please)" << std::endl;
  std::cout << "The probability is: " << prob_2<Circle_2>() << std::endl;
  return 0;
}