CSc 8710 Deductive Databases and Logic Programming
Fall 2008
Programming Assignment # 4
Due: November 1st, 2008
Write a Prolog program to draw Hilbert Curves, which are defined as follows:
There are four kinds of Hilbert curves which we shall name
A-curves, B-curves, C-curves and D-curves. Each of these
curves come in various sizes and are defined (recursively) as follows:
, and
all occupy no space (i.e. they
are empty curves). These are curves of size zero. Curves of bigger sizes are
defined as follows:
Write the program so that it will draw
where N is a parameter.
Notes on the Implementation
?- hilbertC(1).
ooo
o
ooo
Yes
?- hilbertC(2).
o ooooo
o o o
ooo ooo
o
ooo ooo
o o o
o ooooo
Yes
?- hilbertC(3).
ooo ooooo ooooo
o o o o o
ooo ooo ooo ooo
o o o
o ooo o ooo ooo
o o o o o o o
ooo ooo o ooooo
o
ooo ooo o ooooo
o o o o o o o
o ooo o ooo ooo
o o o
ooo ooo ooo ooo
o o o o o
ooo ooooo ooooo
Yes