I am trying to write a simple function that checks if a list of entered coordinates are a square in prolog for example: isSquare(x1,y1,x2,y2,x3,y3,x4,y4) and the response would be either true or false
I currently have the following
isSquare(x1, y1, x2, y2, x3, y3, x4, y4)
Slope1 = (y2 - y1) / (x2 - x1)
Slope2 = (y3 - y2) / (x3 - x2)
Slope3 = (y4 - y3) / (x4 - x3)
Slope4 = (y1 - y4) / (x1 - x4)
If Slope1 * Slope2 == Slope3 * Slope4
return true
else
return false
but i have hit a wall, I would appreciate any guidance as I am totally new to prolog and am learning as I go
X1
, notx1
. – Willem Van Onsem