<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Sudoku solving program problems' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Sudoku solving program problems' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 19:01:47 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 19:01:47 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429394/sudoku-solving-program-problems/</link>
      <description>I was trying to write a program that would solve sudokus, and as far as I can tell what I have done should work. It presents no error messages, but if you enter a valid sudoku puzzle, it does nothing at all and accepts no further input. The only thing that it does strangely is if you enter a solved sudoku, the final line that it prints after it thinks it has solved it is a row of zeros. Any help would be greatly appreciated!&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program sudoku;

var
   input : array[1..9, 1..9] of integer;
   cell : array[1..9, 1..9, 1..9] of integer;
   output : array[1..9, 1..9] of integer;
   cposs : array[1..9, 1..9,  1..9] of integer;
   cloop, cloop2, rloop, rloop2, bloop, bloop2, loop, loop2, loop3, c, d : integer;
   cloop3, rloop3, bloop3 : integer;
   cloop4, rloop4, bloop4 : integer;
   cloop5, rloop5, bloop5 : integer;
   solved : boolean;

begin



     {sets all items of input array to 0}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do

                input[loop2,loop] := 0;
       end;

     {sets all items of cell array to 10}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do
              begin

                   for loop3 := 1 to 9 do
                   begin

                        cell[loop3,loop2,loop] := 10;
                   end;
              end;
       end;

     {instructions}
     writeln('== Sudoku Solver ==':50);
     writeln;
     writeln;
     writeln('Please enter the numbers of your sudoku from left to right, one row at a time from top to bottom, WITH A SPACE BETWEEN EACH CHARACTER, pressing enter after each row. If the cell is empty, please write a 0.');
     writeln;

     {reading inputs}
     for rloop := 1 to 9 do

       begin

          for cloop := 1 to 9 do

               read( input[cloop,rloop] );
       end;

     {copies inputs to "cell" array, and adds box position}
     for rloop := 1 to 9 do
         begin

            for cloop := 1 to 9 do
                begin

                   if cloop in [1..3] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,1] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,4] := input[cloop,rloop] else

                            if rloop in [7..8] then
                              cell[cloop,rloop,7] := input[cloop,rloop];


                   if cloop in [4..6] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,2] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,5] := input[cloop,rloop] else

                            if rloop in [7..8] then
                              cell[cloop,rloop,8] := input[cloop,rloop];

                   if cloop in [7..9] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,3] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,6] := input[cloop,rloop] else

                            if rloop in [7..8] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
                end;
         end;


     repeat


     c := 0;
     d := 0;

     {the big block}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 {checks if it is possible to have cell in that box
                  by checking if a value from input has been copied
                  over (the value wont be 10}
                  if cell[cloop,rloop,bloop] &amp;lt; 10 then
                  begin
                    if cell[cloop,rloop,bloop] &amp;gt; 0 then
                    begin

                      {no possibility for that number in the cells in this box}
                      for bloop2 := 1 to 9 do
                        begin

                          for rloop2 := 1 to 9 do
                            begin
                              for cloop2 := 1 to 9 do
                                begin
                                  if cell[cloop2,rloop2,bloop2] &amp;lt; 10 then
                                    begin
                                      if bloop2 = bloop then
                                        cposs[cloop2, rloop2, cell[cloop,rloop,bloop] ] := 1;
                                    end;
                                end;
                            end;
                        end;

                          {no possibility for that number in the cells in that row}
                          for bloop3 := 1 to 9 do
                            begin
                              for rloop3 := 1 to 9 do
                                begin
                                  for cloop3 := 1 to 9 do
                                    begin
                                      if cell[cloop3,rloop3,bloop3] &amp;lt; 10 then
                                        begin
                                          if rloop3 = rloop then
                                            cposs[cloop3, rloop3, cell[cloop,rloop,bloop] ] := 1;
                                        end;
                                    end;
                                end;
                            end;

                            {no possibility for that number in the cells in that column}
                            for bloop4 := 1 to 9 do
                              begin
                                for rloop4 := 1 to 9 do
                                  begin
                                    for cloop4 := 1 to 9 do
                                      begin
                                        if cell[cloop4,rloop4,bloop4] &amp;lt; 10 then
                                          begin
                                            if cloop4 = cloop then
                                              cposs[cloop4, rloop4, cell[cloop,rloop,bloop] ] := 1;
                                          end;
                                      end;
                                  end;
                              end;

                    end;

                  end;

                  {checks if cell has only one possible answer}
                  for loop := 1 to 9 do
                    begin
                         if cposs[cloop,rloop,loop] = 0 then
                            c := c + 1;
                    end;
                  if c = 1 then
                    begin
                         for loop := 1 to 9 do
                           begin
                           if cposs[cloop, rloop, loop] = 0 then
                             cell[cloop,rloop,bloop] := loop;
                           end;
                    end;

               end;
           end;
       end;
     {checks if sudoku is finished}
     for bloop5 := 1 to 9 do
       begin
         for rloop5 := 1 to 9 do
           begin
             for cloop5 := 1 to 9 do
               begin
                 if cell[cloop5, rloop5, bloop5] = 0 then
                   d := d + 1;
               end;
           end;
       end;
     if d = 0 then solved := true;

     until solved = true;

     {copying}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 if cell[cloop,rloop,bloop] &amp;lt; 10 then
                   begin

                     output[cloop,rloop] := cell[cloop,rloop,bloop];
                   end;
               end;
           end;
       end;

     writeln;

     {printing}
     for rloop := 1 to 9 do
       begin

         for cloop := 1 to 9 do
           begin

             write(output[cloop,rloop],' ');
           end;
         writeln;

       end;
     writeln;
     writeln('Solved!');
     readln;
     readln;

end.&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429394/sudoku-solving-program-problems/</guid>
      <pubDate>Thu, 30 Aug 2012 14:54:41 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429402/re-sudoku-solving-program-problems/#429402</link>
      <description>Looks fine except for some testing that you have.  And why all the Begin .. end statements in loops that only have one statement.  Just a lot of extra writing on your part.  &lt;br /&gt;
I think you need to change these:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                           if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,7] := input[cloop,rloop];

&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                           if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,7] := input[cloop,rloop];

&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,8] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,8] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
I have another program that I found on a european site that I altered for doing sudoku puzzles on screen.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429402/re-sudoku-solving-program-problems/#429402</guid>
      <pubDate>Fri, 31 Aug 2012 12:58:57 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429403/re-sudoku-solving-program-problems/#429403</link>
      <description>Looks fine except for some testing that you have.  And why all the Begin .. end statements in loops that only have one statement.  Just a lot of extra writing on your part.  &lt;br /&gt;
I think you need to change these:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                           if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,7] := input[cloop,rloop];

&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                           if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,7] := input[cloop,rloop];

&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,8] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,8] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Green;"&gt;7..8&lt;/span&gt;] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;                            if rloop in [&lt;span style="color: Red;"&gt;7..9&lt;/span&gt;] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
&lt;/pre&gt;&lt;br /&gt;
I have another program that I found on a european site that I altered for doing sudoku puzzles on screen.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429403/re-sudoku-solving-program-problems/#429403</guid>
      <pubDate>Fri, 31 Aug 2012 13:06:55 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429414/re-sudoku-solving-program-problems/#429414</link>
      <description>You're absolutely right about needing to change those, and doing so does stop the row of zeroes appearing when I enter a solved sudoku, but the program still doesn't solve an unsolved sudoku; it refuses input after you enter the final line, suggesting that it is stuck in a loop. Any ideas why?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429414/re-sudoku-solving-program-problems/#429414</guid>
      <pubDate>Sun, 02 Sep 2012 08:10:49 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429415/re-sudoku-solving-program-problems/#429415</link>
      <description>You're absolutely right about needing to change those, and doing so does stop the row of zeroes appearing when I enter a solved sudoku, but the program still doesn't solve an unsolved sudoku; it refuses input after you enter the final line, suggesting that it is stuck in a loop. Any ideas why?&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program sudoku;

var
   input : array[1..9, 1..9] of integer;
   cell : array[1..9, 1..9, 1..9] of integer;
   output : array[1..9, 1..9] of integer;
   cposs : array[1..9, 1..9,  1..9] of integer;
   cloop, cloop2, rloop, rloop2, bloop, bloop2, loop, loop2, loop3, c, d : integer;
   cloop3, rloop3, bloop3 : integer;
   cloop4, rloop4, bloop4 : integer;
   cloop5, rloop5, bloop5 : integer;
   solved : boolean;

begin



     {sets all items of input array to 0}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do

                input[loop2,loop] := 0;
       end;

     {sets all items of cell array to 10}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do
              begin

                   for loop3 := 1 to 9 do
                   begin

                        cell[loop3,loop2,loop] := 10;
                   end;
              end;
       end;

     {instructions}
     writeln('== Sudoku Solver ==':50);
     writeln;
     writeln;
     writeln('Please enter the numbers of your sudoku from left to right, one row at a time from top to bottom, WITH A SPACE BETWEEN EACH CHARACTER, pressing enter after each row. If the cell is empty, please write a 0.');
     writeln;

     {reading inputs}
     for rloop := 1 to 9 do

       begin

          for cloop := 1 to 9 do

               read( input[cloop,rloop] );
       end;

     {copies inputs to "cell" array, and adds box position}
     for rloop := 1 to 9 do
         begin

            for cloop := 1 to 9 do
                begin

                   if cloop in [1..3] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,1] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,4] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,7] := input[cloop,rloop];


                   if cloop in [4..6] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,2] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,5] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,8] := input[cloop,rloop];

                   if cloop in [7..9] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,3] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,6] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
                end;
         end;


     repeat


     c := 0;
     d := 0;

     {the big block}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 {checks if it is possible to have cell in that box
                  by checking if a value from input has been copied
                  over (the value wont be 10}
                  if cell[cloop,rloop,bloop] &amp;lt; 10 then
                  begin
                    if cell[cloop,rloop,bloop] &amp;gt; 0 then
                    begin

                      {no possibility for that number in the cells in this box}
                      for bloop2 := 1 to 9 do
                        begin

                          for rloop2 := 1 to 9 do
                            begin
                              for cloop2 := 1 to 9 do
                                begin
                                  if cell[cloop2,rloop2,bloop2] &amp;lt; 10 then
                                    begin
                                      if bloop2 = bloop then
                                        cposs[cloop2, rloop2, cell[cloop,rloop,bloop] ] := 1;
                                    end;
                                end;
                            end;
                        end;

                          {no possibility for that number in the cells in that row}
                          for bloop3 := 1 to 9 do
                            begin
                              for rloop3 := 1 to 9 do
                                begin
                                  for cloop3 := 1 to 9 do
                                    begin
                                      if cell[cloop3,rloop3,bloop3] &amp;lt; 10 then
                                        begin
                                          if rloop3 = rloop then
                                            cposs[cloop3, rloop3, cell[cloop,rloop,bloop] ] := 1;
                                        end;
                                    end;
                                end;
                            end;

                            {no possibility for that number in the cells in that column}
                            for bloop4 := 1 to 9 do
                              begin
                                for rloop4 := 1 to 9 do
                                  begin
                                    for cloop4 := 1 to 9 do
                                      begin
                                        if cell[cloop4,rloop4,bloop4] &amp;lt; 10 then
                                          begin
                                            if cloop4 = cloop then
                                              cposs[cloop4, rloop4, cell[cloop,rloop,bloop] ] := 1;
                                          end;
                                      end;
                                  end;
                              end;

                    end;

                  end;

                  {checks if cell has only one possible answer}
                  for loop := 1 to 9 do
                    begin
                         if cposs[cloop,rloop,loop] = 0 then
                            c := c + 1;
                    end;
                  if c = 1 then
                    begin
                         for loop := 1 to 9 do
                           begin
                           if cposs[cloop, rloop, loop] = 0 then
                             cell[cloop,rloop,bloop] := loop;
                           end;
                    end;

               end;
           end;
       end;
     {checks if sudoku is finished}
     for bloop5 := 1 to 9 do
       begin
         for rloop5 := 1 to 9 do
           begin
             for cloop5 := 1 to 9 do
               begin
                 if cell[cloop5, rloop5, bloop5] = 0 then
                   d := d + 1;
               end;
           end;
       end;
     if d = 0 then solved := true;

     until solved = true;

     {copying}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 if cell[cloop,rloop,bloop] &amp;lt; 10 then
                   begin

                     output[cloop,rloop] := cell[cloop,rloop,bloop];
                   end;
               end;
           end;
       end;

     writeln;

     {printing}
     for rloop := 1 to 9 do
       begin

         for cloop := 1 to 9 do
           begin

             write(output[cloop,rloop],' ');
           end;
         writeln;

       end;
     writeln;
     writeln('Solved!');
     readln;
     readln;

end.&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429415/re-sudoku-solving-program-problems/#429415</guid>
      <pubDate>Sun, 02 Sep 2012 08:12:39 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429416/re-sudoku-solving-program-problems/#429416</link>
      <description>You're absolutely right about needing to change those, and doing so does stop the row of zeroes appearing when I enter a solved sudoku, but the program still doesn't solve an unsolved sudoku; it refuses input after you enter the final line, suggesting that it is stuck in a loop. Any ideas why?&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program sudoku;

var
   input : array[1..9, 1..9] of integer;
   cell : array[1..9, 1..9, 1..9] of integer;
   output : array[1..9, 1..9] of integer;
   cposs : array[1..9, 1..9,  1..9] of integer;
   cloop, cloop2, rloop, rloop2, bloop, bloop2, loop, loop2, loop3, c, d : integer;
   cloop3, rloop3, bloop3 : integer;
   cloop4, rloop4, bloop4 : integer;
   cloop5, rloop5, bloop5 : integer;
   solved : boolean;

begin



     {sets all items of input array to 0}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do

                input[loop2,loop] := 0;
       end;

     {sets all items of cell array to 10}
     for loop := 1 to 9 do
       begin

            for loop2 := 1 to 9 do
              begin

                   for loop3 := 1 to 9 do
                   begin

                        cell[loop3,loop2,loop] := 10;
                   end;
              end;
       end;

     {instructions}
     writeln('== Sudoku Solver ==':50);
     writeln;
     writeln;
     writeln('Please enter the numbers of your sudoku from left to right, one row at a time from top to bottom, WITH A SPACE BETWEEN EACH CHARACTER, pressing enter after each row. If the cell is empty, please write a 0.');
     writeln;

     {reading inputs}
     for rloop := 1 to 9 do

       begin

          for cloop := 1 to 9 do

               read( input[cloop,rloop] );
       end;

     {copies inputs to "cell" array, and adds box position}
     for rloop := 1 to 9 do
         begin

            for cloop := 1 to 9 do
                begin

                   if cloop in [1..3] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,1] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,4] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,7] := input[cloop,rloop];


                   if cloop in [4..6] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,2] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,5] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,8] := input[cloop,rloop];

                   if cloop in [7..9] then
                            if rloop in [1..3] then
                              cell[cloop,rloop,3] := input[cloop,rloop] else

                            if rloop in [4..6] then
                              cell[cloop,rloop,6] := input[cloop,rloop] else

                            if rloop in [7..9] then
                              cell[cloop,rloop,9] := input[cloop,rloop];
                end;
         end;


     repeat


     c := 0;
     d := 0;

     {the big block}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 {checks if it is possible to have cell in that box
                  by checking if a value from input has been copied
                  over (the value wont be 10}
                  if cell[cloop,rloop,bloop] &amp;lt; 10 then
                  begin
                    if cell[cloop,rloop,bloop] &amp;gt; 0 then
                    begin

                      {no possibility for that number in the cells in this box}
                      for bloop2 := 1 to 9 do
                        begin

                          for rloop2 := 1 to 9 do
                            begin
                              for cloop2 := 1 to 9 do
                                begin
                                  if cell[cloop2,rloop2,bloop2] &amp;lt; 10 then
                                    begin
                                      if bloop2 = bloop then
                                        cposs[cloop2, rloop2, cell[cloop,rloop,bloop] ] := 1;
                                    end;
                                end;
                            end;
                        end;

                          {no possibility for that number in the cells in that row}
                          for bloop3 := 1 to 9 do
                            begin
                              for rloop3 := 1 to 9 do
                                begin
                                  for cloop3 := 1 to 9 do
                                    begin
                                      if cell[cloop3,rloop3,bloop3] &amp;lt; 10 then
                                        begin
                                          if rloop3 = rloop then
                                            cposs[cloop3, rloop3, cell[cloop,rloop,bloop] ] := 1;
                                        end;
                                    end;
                                end;
                            end;

                            {no possibility for that number in the cells in that column}
                            for bloop4 := 1 to 9 do
                              begin
                                for rloop4 := 1 to 9 do
                                  begin
                                    for cloop4 := 1 to 9 do
                                      begin
                                        if cell[cloop4,rloop4,bloop4] &amp;lt; 10 then
                                          begin
                                            if cloop4 = cloop then
                                              cposs[cloop4, rloop4, cell[cloop,rloop,bloop] ] := 1;
                                          end;
                                      end;
                                  end;
                              end;

                    end;

                  end;

                  {checks if cell has only one possible answer}
                  for loop := 1 to 9 do
                    begin
                         if cposs[cloop,rloop,loop] = 0 then
                            c := c + 1;
                    end;
                  if c = 1 then
                    begin
                         for loop := 1 to 9 do
                           begin
                           if cposs[cloop, rloop, loop] = 0 then
                             cell[cloop,rloop,bloop] := loop;
                           end;
                    end;

               end;
           end;
       end;
     {checks if sudoku is finished}
     for bloop5 := 1 to 9 do
       begin
         for rloop5 := 1 to 9 do
           begin
             for cloop5 := 1 to 9 do
               begin
                 if cell[cloop5, rloop5, bloop5] = 0 then
                   d := d + 1;
               end;
           end;
       end;
     if d = 0 then solved := true;

     until solved = true;

     {copying}
     for bloop := 1 to 9 do
       begin

         for rloop := 1 to 9 do
           begin

             for cloop := 1 to 9 do
               begin

                 if cell[cloop,rloop,bloop] &amp;lt; 10 then
                   begin

                     output[cloop,rloop] := cell[cloop,rloop,bloop];
                   end;
               end;
           end;
       end;

     writeln;

     {printing}
     for rloop := 1 to 9 do
       begin

         for cloop := 1 to 9 do
           begin

             write(output[cloop,rloop],' ');
           end;
         writeln;

       end;
     writeln;
     writeln('Solved!');
     readln;
     readln;

end.&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429416/re-sudoku-solving-program-problems/#429416</guid>
      <pubDate>Sun, 02 Sep 2012 08:15:02 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Sudoku solving program problems</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429394/429426/re-sudoku-solving-program-problems/#429426</link>
      <description>Okay, the obvious problems has been taken care of.  Now for the difficult.  I use Free Pascal Compiler 2.6.0, &lt;span style="color: Purple;"&gt;http://www.freepascal.org&lt;/span&gt;, with the IDE.  It has Debug and works quite well if you take the time to check out the features.  So, set up your variables to watch, step through the program to see what's going on with each statement.  If you're like me, you'll have an intuitive feel what it should be doing and what the variables should be.  I've done this with many programs to discover my blunders and misthoughts.  Debug can really find those problems that you thought weren't happenning.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429394/429426/re-sudoku-solving-program-problems/#429426</guid>
      <pubDate>Mon, 03 Sep 2012 18:24:58 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>