// triangle.h 

#ifndef TRIANGLECLASS_H_
#define TRIANGLECLASS_H_

/*
   We represent a board as an array with 15 positions numbered
          0
        1   2
       3  4  5
      6  7  8  9
    10 11 12 13 14
   Each position but one is initially filled with a peg. One position
   is a hole. A move involves three consecutive positions, horizontal
   or diagonal, with two consecutive positions occupied and the third
   free. Then the two pegs are removed and a peg is inserted in the 
   original hole. The objective is to start with only one hole and to
   finish with only one peg.
   A position that is empty is represented with 0, one full with 1.
   Thus the triangle
          X
         X o
        X o X
       o X X o
      X X o o X
   is represented as [1,1,0,1,0,1,0,1,1,0,1,1,0,0,1].
   There are 36 possible moves of three positions in sequence, the
   first two with pegs, the third empty. 

  There are a total of 438,984 solutions, not all different because of 
  the symmetries of the board. The users are asked if they want to see
  solutions. In any case the program prints for each 
  initial configuration the number of solutions obtained starting at that 
  configuration, and then the total number of solutions
 */

class Triangle {
	int atriangle[15]; // State of triangle
public:
	// Constructor
	Triangle() 
	{
		for (int k = 0; k < 15; ++k)
			atriangle[k] = 1;
	}

	// Print out triangle
	void print_triangle(void) const;

	// Given integer conf = 0, 1, .. or 14, print out the
	// solutions found starting from a triangle with the only
	// hole at position conf. It returns the number of solutions found;
	// The users are asked if to print individual solutions.
	int solve(int conf);
};

#endif

