Scheme Java -> Tiles
AVVISO! Le informazioni di questo post potrebbero non essere più valide in quanto non aggiornate. Usa i commenti per contribuire a tenere il post aggiornato.
ULTIMA REVISIONE DEL POST: 29/08/2010
Scheme:
(define ht
(lambda (d)
(lambda (k)
(if (= k 0)
(if (> d 0) 0 1)
(+ (* 2 ((ht d) (- k 1)))
((ht (remainder (+ d 3) 4)) (- k 1))
((ht (remainder (+ d 1) 4)) (- k 1)))
))))
(let ((f (ht 1))) (f 2))
Java:
public class tile {
public static int tiles (int d, int k){
if (k == 0)
if (d > 0)
return 0;
else
return 1;
else
return (2* (tile.tiles (d, (k-1)))) + (tiles (((d + 3) %4), (k -1))) + (tiles (((d + 1) % 4), (k - 1)));
}
}

