we describe here bijections between natural numbers
% and lists, multi-sets and sets of natural numbers
% arithmetic emulation of LISP operations
% XY is (2*X)*(2*Y+1)
cons(X,Y,XY):-X>=0,Y>=0,XY is (1+(Y<1)<X.
% decomposes a "cons" into a
This procedure finds the shortest path from a given vertex to all other vertices in a graph.
% dijkstra(Vertex0, Ss) is true if Ss is a list of structures s(Vertex, Dist,
% Path) containing the shortest Path from Vertex0 to Vertex, the distance of
public class Ball cfw_
int x, y;
/ current location
int dx, dy;
/ motion delta
int diameter = 10;
Color color = Color.red;
public Ball (int x, int y) cfw_
this.x = x;
this.y = y;
dx = x % 10 + 1;
dy = y % 10 + 1;
color = new Color(x % 256, y % 256, (x+y)
Using the notifyAll and wait Methods
The CubbyHole stores its value in a private member variable
called contents. CubbyHole has another private member variable, available, that is
a boolean. available is true when the value has just been put but not yet g
Three friends like different kinds of music. From the clues given
below, can you identify them, say how old each is, and work out
his musical preference?
1. Rob is older than Queen, who likes classical music.
2. The pop-music fan, who is
This is a framework for an A* with Iterative Deepening (IDA*) search, inspired by the other similar search
frameworks given in Sterling and Shapiro's "The Art of Prolog".
Only one solution is found.
A more efficient version is obtained if, instead of incr