RE: Can solve the N-queens - but can't count!

Subject: RE: Can solve the N-queens - but can't count!
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 15 Jun 1999 10:39:52 +0100
> I've written an XSL stylesheet which solves the N queens 
> problem (place N chess queens on an NxN square board so that no queen 
> threatens another), just to see whether it can be done.

Brilliant. For the record, it ran first time on SAXON 4.3, in 76 seconds
under the interpreter, and in 21 seconds when compiled. (Pentium II 233MHz,
Win NT 4.0, Sun JDK 1.2)
> 
> Granted that solving the N-queens problem isn't what XSL was 
> designed for, but this problem is real. As things stand, one can only
count 
> things if they (i) can appear inside a 'count' expression or (ii) if you
are 
> willing to accept a nested template call for each increase in the count
(without
> exiting the nested template as long as you need the count!).

Yes. Functional programming depends on very efficient recursion, and on some
unfamiliar ways of thinking. Those are the two reasons I added an assignment
statement to SAXON!

> Have fun,
> 
>     Oren Ben-Kiki
> 
It's made my day... 
(But it will probably be spoilt when someone reports that SAXON's
performance is uncompetitive!)

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread