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

* Re: Anybody with a Cray T3D want to help me?
  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
  1 sibling, 2 replies; 5+ messages in thread
From: Richard Kenner @ 1996-05-11  0:00 UTC (permalink / raw)



In article <4mvmj5$sl6@btmpjg.god.bel.alcatel.be> ian@rsd.bel.alcatel.be writes:
>Does anybody out there fancy running this for me?

I don't have a Cray T3D, but just got a 266 MHz 21164-based system
running Linux.

I modified your code to make BOO_ARRAY packed and ran this on GNAT
(with -O2).  It took two hours and 43 minutes and produced the following
output (I've removed line breaks to condense this posting):

15 112 97 86 129 63 135 114 133 80 126 12 21 100 119 84 79 65 74 3 65
8 60 54 47 21 39 9 3 24 15




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

* Re: Anybody with a Cray T3D want to help me?
  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-11  0:00 ` Theodore E. Dennison
  1 sibling, 0 replies; 5+ messages in thread
From: Theodore E. Dennison @ 1996-05-11  0:00 UTC (permalink / raw)



Ian Ward wrote:
> 
> 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


Whatever happened to that Ada-compiler server I was hearing about
a few months ago? That would be ideal for Ian's situation.

-- 
T.E.D.          
                |  Work - mailto:dennison@escmail.orl.mmc.com  |
                |  Home - mailto:dennison@iag.net              |
                |  URL  - http://www.iag.net/~dennison         |




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

* Re: Anybody with a Cray T3D want to help me?
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Boaz Chow @ 1996-05-12  0:00 UTC (permalink / raw)



I think you can make the program run faster if you don't use the recursive
call. 
 
use the dynamic programming technique.  use a table to store the perviously
calculated values, etc. 
 
On May 11, 1996 11:49:05 in article <Re: Anybody with a Cray T3D want to
help me?>, 'kenner@lab.ultra.nyu.edu (Richard Kenner)' wrote: 
 
 
>In article <4mvmj5$sl6@btmpjg.god.bel.alcatel.be> ian@rsd.bel.alcatel.be  
>writes: 
>>Does anybody out there fancy running this for me? 
> 
>I don't have a Cray T3D, but just got a 266 MHz 21164-based system 
>running Linux. 
> 
>I modified your code to make BOO_ARRAY packed and ran this on GNAT 
>(with -O2).  It took two hours and 43 minutes and produced the following 
>output (I've removed line breaks to condense this posting): 
> 
>15 112 97 86 129 63 135 114 133 80 126 12 21 100 119 84 79 65 74 3 65 
>8 60 54 47 21 39 9 3 24 15 
-- 
   ______   Meow 
   \ OO /  _/  
  :(__ =) 
    U \\ 
Due to some students who mess up 
some legal issue, my school is being 
sued by some company. In return, 
all the web pages are no longer 
accessable from the rest of the world. 
http://www.sci.csupomona.edu/~cchow 





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

* Re: Anybody with a Cray T3D want to help m
  1996-05-11  0:00 ` Richard Kenner
  1996-05-12  0:00   ` Boaz Chow
@ 1996-05-13  0:00   ` Ian Ward
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Ward @ 1996-05-13  0:00 UTC (permalink / raw)



Richard Kenner writes :

> >In article <4mvmj5$sl6@btmpjg.god.bel.alcatel.be> ian@rsd.bel.alcatel.be writes:
> >Does anybody out there fancy running this for me?

> I don't have a Cray T3D, but just got a 266 MHz 21164-based system
> running Linux.

> I modified your code to make BOO_ARRAY packed and ran this on GNAT
> (with -O2).  It took two hours and 43 minutes and produced the following
> output (I've removed line breaks to condense this posting):

> 15 112 97 86 129 63 135 114 133 80 126 12 21 100 119 84 79 65 74 3 65
> 8 60 54 47 21 39 9 3 24 15


Thanks a lot Richard.
The next time you're in Antwerp, I'll buy you a beer.

---
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