Revision: 3586
Author: ksprotte
URL: http://bknr.net/trac/changeset/3586
removed stripes from allocation - still ongoing work with try-allocation
U trunk/projects/bos/m2/allocation.lisp
Change set too large, please see URL above
Revision: 3582
Author: hans
URL: http://bknr.net/trac/changeset/3582
Experimental new allocator
A trunk/projects/bos/m2/test-allocation.lisp
Added: trunk/projects/bos/m2/test-allocation.lisp
===================================================================
--- trunk/projects/bos/m2/test-allocation.lisp (rev 0)
+++ trunk/projects/bos/m2/test-allocation.lisp 2008-07-23 12:29:36 UTC (rev 3582)
@@ -0,0 +1,39 @@
+(in-package :bos.m2)
+
+(defun try-allocation (n x y pred)
+ "Try to find N free square meters that are adjacent and that begin
+at X and Y. PRED is a predicate function of two arguments that
+returns a true value if the arguments specify the coordinates of an
+allocatable square meter."
+ (unless (funcall pred x y)
+ (error "sqm ~A/~A not allocatable" x y))
+ (let ((allocated (make-hash-table :test #'equal))
+ (connected (list (list x y)))
+ (border-queue (bos.web::make-queue)))
+ (labels
+ ((try-get (&rest key)
+ (when (and (not (gethash key allocated))
+ (apply pred key))
+ (setf (gethash key allocated) t)
+ (bos.web::enqueue key border-queue)
+ key))
+ (get-next-neighbor (x y)
+ "Return the next neighbor of M2 that can be allocated or NIL if none of the neighbor can be allocated."
+ (or (try-get (1+ x) y)
+ (try-get x (1+ y))
+ (try-get (1- x) y)
+ (try-get x (1- y)))))
+ (dotimes (i (1- n)
+ (append connected (bos.web::elements border-queue)))
+ (tagbody
+ retry
+ (let ((next (get-next-neighbor x y)))
+ (unless next
+ (cond
+ ((bos.web::queue-empty-p border-queue)
+ (return nil))
+ (t
+ (push (list x y) connected)
+ (multiple-value-setq (x y)
+ (values-list (bos.web::dequeue border-queue)))
+ (go retry))))))))))
\ No newline at end of file
Revision: 3581
Author: edi
URL: http://bknr.net/trac/changeset/3581
Update to current dev version
U trunk/thirdparty/cl-ppcre/CHANGELOG
D trunk/thirdparty/cl-ppcre/README
U trunk/thirdparty/cl-ppcre/api.lisp
A trunk/thirdparty/cl-ppcre/charmap.lisp
U trunk/thirdparty/cl-ppcre/charset.lisp
A trunk/thirdparty/cl-ppcre/chartest.lisp
D trunk/thirdparty/cl-ppcre/cl-ppcre-test.system
A trunk/thirdparty/cl-ppcre/cl-ppcre-unicode/
A trunk/thirdparty/cl-ppcre/cl-ppcre-unicode/packages.lisp
A trunk/thirdparty/cl-ppcre/cl-ppcre-unicode/resolver.lisp
A trunk/thirdparty/cl-ppcre/cl-ppcre-unicode.asd
U trunk/thirdparty/cl-ppcre/cl-ppcre.asd
D trunk/thirdparty/cl-ppcre/cl-ppcre.system
U trunk/thirdparty/cl-ppcre/closures.lisp
U trunk/thirdparty/cl-ppcre/convert.lisp
D trunk/thirdparty/cl-ppcre/doc/benchmarks.2002-12-22.txt
U trunk/thirdparty/cl-ppcre/doc/index.html
U trunk/thirdparty/cl-ppcre/errors.lisp
U trunk/thirdparty/cl-ppcre/lexer.lisp
D trunk/thirdparty/cl-ppcre/lispworks-defsystem.lisp
D trunk/thirdparty/cl-ppcre/load.lisp
U trunk/thirdparty/cl-ppcre/optimize.lisp
U trunk/thirdparty/cl-ppcre/packages.lisp
U trunk/thirdparty/cl-ppcre/parser.lisp
D trunk/thirdparty/cl-ppcre/perltest.pl
D trunk/thirdparty/cl-ppcre/ppcre-tests.lisp
A trunk/thirdparty/cl-ppcre/regex-class-util.lisp
U trunk/thirdparty/cl-ppcre/regex-class.lisp
U trunk/thirdparty/cl-ppcre/repetition-closures.lisp
U trunk/thirdparty/cl-ppcre/scanner.lisp
U trunk/thirdparty/cl-ppcre/specials.lisp
A trunk/thirdparty/cl-ppcre/test/
A trunk/thirdparty/cl-ppcre/test/packages.lisp
A trunk/thirdparty/cl-ppcre/test/perl-tests.lisp
A trunk/thirdparty/cl-ppcre/test/perltest.pl
A trunk/thirdparty/cl-ppcre/test/perltestdata
A trunk/thirdparty/cl-ppcre/test/perltestinput
A trunk/thirdparty/cl-ppcre/test/simple
A trunk/thirdparty/cl-ppcre/test/tests.lisp
A trunk/thirdparty/cl-ppcre/test/unicode-tests.lisp
A trunk/thirdparty/cl-ppcre/test/unicodetestdata
D trunk/thirdparty/cl-ppcre/testdata
D trunk/thirdparty/cl-ppcre/testinput
U trunk/thirdparty/cl-ppcre/util.lisp
Change set too large, please see URL above