exercise_area.pl

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:08.0
disk size 485 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
%Source: http://colin.barker.pagesperso-orange.fr/sands.htm
%query:area(g,f).
/* area(Points,Area) is true if Area is the area of the polygon enclosed   */
/*   by the list of points Points, where the coordinates of each point are */
/*   represented by a pair p(X,Y) of integers.                             */
area(Ps,Area):- area(Ps,0,Area).

area([Pair],Area,Area).
area([p(X1,Y1),p(X2,Y2)|XYs],Temp,Area):-
  Temp1 is Temp + (X1*Y2 - Y1*X2)/2,
  area([p(X2,Y2)|XYs],Temp1,Area).

popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark