{this program site did not run the whole peg solitare of me http://e...content-available-to-author-only...a.org/wiki/Peg_solitaire becauuse of time 
limit exceed therefore i used a small o shaped structure like this
	           .   .   .           
                   *   *   *
           .   *   *   .   *   *   .  
           .   *   .   .   .   *   . 
           .   *   *   .   *   *   .
                   *   *   *         
                   .   .   .   }
                   {here '.' dots represets make moves and '*' represents which is to nove rest you lrn from wikipedia}
  {also if want to add full solitare then you can run on free pascal compiler download "geany" and run this code by editing it}
  			{all coments are requested to gauravalgo@gmail.com}
  			
  			{how to see please see the resuts from bottom of the page to top }
  			{beacuse of its recursive nature i am configuring it for new version}
  			{enjoy the play at facebook!! :) }
program io;

{$APPTYPE CONSOLE}
{$ExtendedSyntax On}

uses
  SysUtils;

{ TODO -oUser -cConsole Main : Insert code here }

  {dedining dynamic array of characters}
  type

    pegboard = Array[1..7,1..7]of Char;

    var
    global:Array[1..100,1..3] of Integer;
    type
    moves = Array[1..4,1..2]of integer;
    var
    m : moves =((-2,0),
                (0,+2),
                (+2,0),
                (0,-2));
procedure place (row,col,dir:integer;var tempboard:pegboard);
begin
	if dir=1 then
	begin
		tempboard[row,col]:='.';
		tempboard[row+m[1,1]+1,col+m[1,2]]:='.';
		tempboard[row+m[1,1],col+m[1,2]]:='*';

	end;
	if dir=2 then
	begin
		tempboard[row,col]:='.';
		tempboard[row+m[2,1],col+m[2,2]-1]:='.';
		tempboard[row+m[2,1],col+m[2,2]]:='*';
		
	end;
	if dir=3 then
	begin
		tempboard[row,col]:='.';
		tempboard[row+m[3,1]-1,col+m[3,2]]:='.';
		tempboard[row+m[3,1],col+m[3,2]]:='*';
		
	end;
	if dir=4 then
	begin
		tempboard[row,col]:='.';
		tempboard[row+m[4,1],col+m[4,2]+1]:='.';
		tempboard[row+m[4,1],col+m[4,2]]:='*';
		
	end;
end;
procedure unplace (row,col,dir:integer;var tempboard:pegboard);
begin
	if dir=1 then
	begin
		tempboard[row,col]:='*';
		tempboard[row+m[1,1]+1,col+m[1,2]]:='*';
		tempboard[row+m[1,1],col+m[1,2]]:='.';
		
	end;
	if dir=2 then
	begin
		tempboard[row,col]:='*';
		tempboard[row+m[2,1],col+m[2,2]-1]:='*';
		tempboard[row+m[2,1],col+m[2,2]]:='.';
		
	end;
	if dir=3 then
	begin
		tempboard[row,col]:='*';
		tempboard[row+m[3,1]-1,col+m[3,2]]:='*';
		tempboard[row+m[3,1],col+m[3,2]]:='.';
		
	end;
	if dir=4 then
	begin
		tempboard[row,col]:='*';
		tempboard[row+m[4,1],col+m[4,2]+1]:='*';
		tempboard[row+m[4,1],col+m[4,2]]:='.';

	end;
end;
 function count (tempboard : pegboard):integer;
 var
 i,j : integer;
 counter:integer;
 begin
 counter:=0;
  for i:=1 to 7 do
      begin
        for j:=1 to 7 do
        begin
          if tempboard[i,j]='*' then
          begin
			inc(counter);
          end;
        end;
      end;
      count:=counter;
 end;

procedure show (tempboard : pegboard);
 var
 i,j : integer;
 begin
  for i:=1 to 7 do
      begin
        for j:=1 to 7 do
        begin
          Write(tempboard[i,j],' ');
        end;
        Writeln;
      end;
 end;
function testValid(temppegboard: pegboard):integer;
 var
 f,k:integer;
  row1,col1,i,j:integer;

  begin
       f:=0;
       for i:=1 to 7 do
      begin
        for j:=1 to 7 do
        begin
          if temppegboard[i,j]='*' then
          begin
             row1:= i;
             col1:= j;
             for k:=1 to 4 do
             begin
              row1:=row1+m[k,1];
              col1:=col1+m[k,2];
             if((row1>0) and (col1 >0) and (row1<8) and (col1<8)) then
             begin 

					  if ((k=1) and (temppegboard[row1+1,col1]='*') and (temppegboard[row1,col1]='.')) then
					  begin
						 global[f+1,1]:=i;
						 global[f+1,2]:=j;
						 global[f+1,3]:=1;
						 Inc(f);
					  end;

					  if((k=2) and (temppegboard[row1,col1-1]='*') and (temppegboard[row1,col1]='.'))  then
					  begin
						  global[f+1,1]:=i;
						  global[f+1,2]:=j;
						  global[f+1,3]:=2;
						  Inc(f);
					  end;

					  if((k=3) and (temppegboard[row1-1,col1]='*') and (temppegboard[row1,col1]='.'))   then
					  begin
						  global[f+1,1]:=i;
						  global[f+1,2]:=j;
						  global[f+1,3]:=3;
						  Inc(f);
					  end;

					  if((k=4) and (temppegboard[row1,col1+1]='*') and (temppegboard[row1,col1]='.'))   then
					  begin
							global[f+1,1]:=i;
							global[f+1,2]:=j;
							global[f+1,3]:=4;
							Inc(f);
					  end;
				end;
				row1:=i;
				col1:=j;
             end;

          end;

        end;
      end;
      testValid:=f;
  end;


  function pegsolver(row,col,dir:integer;tempboard:pegboard):integer;
  var
  counter,i,r:integer;
  begin
	counter := testValid(tempboard);
	i:=1;

	while i<=counter do
		begin

			row:=global[i,1];
			col:=global[i,2];
			dir:=global[i,3];

			place(row,col,dir,tempboard);
			if count(tempboard) = 1 then
			begin
      writeln('row1= ',row,' col1= ',col);
      show(tempboard);
      writeln;
			pegsolver:=1 ;
      exit;
			end;
				r:=pegsolver(row,col,dir,tempboard);
				if r=1 then
				begin
         writeln('row1= ',row,' col1= ',col);
        show(tempboard);
        writeln;
				pegsolver:=1;


        exit;
				end;
         unplace(row,col,dir,tempboard);
         counter:=testValid(tempboard);
			inc(i);
		end;

	pegsolver:=0;
  end;


  var
    p : pegboard=
        ((' ',' ','.','.','.',' ',' '),
         (' ',' ','*','*','*',' ',' '),
         ('.','*','*','.','*','*','.'),
         ('.','*','.','.','.','*','.'),
         ('.','*','*','.','*','*','.'),
         (' ',' ','*','*','*',' ',' '),
         (' ',' ','.','.','.',' ',' '));
  temppegboard : pegboard;
    var
 i,j ,re,row,col,dir: integer;
  begin
   row:=1;
   col:=1;
   dir:=1;
 for i:=1 to 7 do
  begin
  for j:=1 to 7 do
    begin
    temppegboard[i,j]:=p[i,j];
    end;
  end;
     re:=pegsolver(row,col,dir,temppegboard);
     writeln('start solving...');
     show(temppegboard);
     writeln(re);
     readln;
 end.
