comp.lang.ada
 help / color / mirror / Atom feed
* Anybody with a Cray T3D want to help me?
@ 1996-05-10  0:00 Ian Ward
  1996-05-11  0:00 ` Richard Kenner
  1996-05-11  0:00 ` Anybody with a Cray T3D want to help me? Theodore E. Dennison
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Ward @ 1996-05-10  0:00 UTC (permalink / raw)



My mother reckons she can solve solitaire faster than me,
but I'm not going to give her an even break if I can help
it, especially as there's money involved.

Does anybody out there fancy running this for me?

with TEXT_IO,SYSTEM;
procedure SOL is
   BOO_ARRAY : array (1 .. 49) of BOOLEAN :=
      (FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE,
       FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE,
       TRUE,  TRUE,  TRUE, TRUE, TRUE, TRUE,  TRUE,
       TRUE,  TRUE,  TRUE, FALSE,TRUE, TRUE,  TRUE,
       TRUE,  TRUE,  TRUE, TRUE, TRUE, TRUE,  TRUE,
       FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE,
       FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE);
   TRIP1 : constant array (1 .. 136) of INTEGER :=
      (3,3,3,4,4,4,5,5,5,10,10,10,10,11,
       11,11,12,12,12,12,15,15,15,16,16,
       16,16,17,17,17,17,17,17,17,18,18,
       18,18,18,18,19,19,19,19,19,19,19,
       20,20,20,20,21,21,21,22,22,22,23,
       23,23,24,24,24,24,24,24,25,25,25,
       25,26,26,26,26,26,26,27,27,27,28,
       28,28,29,29,29,30,30,30,30,31,31,
       31,31,31,31,31,32,32,32,32,32,32,
       33,33,33,33,33,33,33,34,34,34,34,
       35,35,35,38,38,38,38,39,39,39,40,
       40,40,40,45,45,45,46,46,46,47,47,47);
   TRIP2 : constant array (1 .. 136) of INTEGER :=
      (4,11,10,12,11,10,12,11,4,11,18,
       17,16,19,18,17,20,19,18,11,16,23,22,
       17,24,23,10,18,25,24,23,16,10,11,
       19,26,25,24,17,11,20,27,26,25,18,
       11,12,27,26,19,12,28,27,20,23,30,
       16,24,31,17,25,32,31,23,17,18,26,
       32,24,18,27,33,32,25,18,19,33,26,
       19,34,27,20,30,22,23,31,38,23,24,
       32,39,38,30,23,24,25,33,39,31,24,
       25,26,34,40,39,32,25,26,27,40,33,
       26,27,34,27,28,39,30,31,32,31,32,
       33,39,32,33,34,46,38,39,38,39,40,
       46,39,40);
   TRIP3 : constant array (1 .. 136) of INTEGER :=
      (5,19,17,20,18,16,19,17,3,12,26,
       24,22,27,25,23,28,26,24,10,17,31,29,
       18,32,30,4,19,33,31,29,15,3,5,20,
       34,32,30,16,4,21,35,33,31,17,3,5,
       34,32,18,4,35,33,19,24,38,10,25,
       39,11,26,40,38,22,10,12,27,39,23,
       11,28,40,38,24,10,12,39,25,11,40,
       26,12,31,15,17,32,46,16,18,33,47,
       45,29,15,17,19,34,46,30,16,18,20,
       35,47,45,31,17,19,21,46,32,18,20,
       33,19,21,40,22,24,26,23,25,27,38,
       24,26,28,47,31,33,30,32,34,45,31,33);
   PASS                 : BOOLEAN := FALSE;
   MAX_CNT              : INTEGER := 33;
   procedure SOLVE2 (CNT : in INTEGER) is
   begin -- SOLVE2
--      if CNT < MAX_CNT
--      then
--         TEXT_IO.PUT (integer'image (CNT));
--         MAX_CNT := CNT;
--      end if;
      if CNT = 1
      then
         PASS := BOO_ARRAY (25);
      else
         for COUNT in 1 .. 136
         loop
            if BOO_ARRAY (TRIP1 (COUNT)) and then
               BOO_ARRAY (TRIP2 (COUNT)) and then
               not BOO_ARRAY (TRIP3 (COUNT))
            then
               BOO_ARRAY (TRIP1 (COUNT)) := FALSE;
               BOO_ARRAY (TRIP2 (COUNT)) := FALSE;
               BOO_ARRAY (TRIP3 (COUNT)) := TRUE;
               SOLVE2 (CNT => CNT - 1);
               if PASS
               then
                  TEXT_IO.PUT_LINE (INTEGER'image (COUNT));
                  exit;
               end if;
               BOO_ARRAY (TRIP1 (COUNT)) := TRUE;
               BOO_ARRAY (TRIP2 (COUNT)) := TRUE;
               BOO_ARRAY (TRIP3 (COUNT)) := FALSE;
            end if;
         end loop;
      end if;
   end SOLVE2;
begin -- SOL
   SOLVE2 (CNT => 32);
end SOL;



Best regards,
Ian.

---
Ian Ward's opinions only : ian@rsd.bel.alcatel.be




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-05-13  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-10  0:00 Anybody with a Cray T3D want to help me? Ian Ward
1996-05-11  0:00 ` Richard Kenner
1996-05-12  0:00   ` Boaz Chow
1996-05-13  0:00   ` Anybody with a Cray T3D want to help m Ian Ward
1996-05-11  0:00 ` Anybody with a Cray T3D want to help me? Theodore E. Dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox