/** Do the inverse of a positive action ?- notsamedirection(-1, 2, -1, 8, -1, 1, -1, 4, Result). Result = 1 ; No ?- notsamedirection(-1, 2, -1, 8, 1, 1, 1, 4, Result). Result = 0 ; notsamedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY, Result) Returns a result of 0 if the kite on the ground is pointing in the same direction as the wind. In the following, the wind vector is the direction a √2 m-length flag is pointing, the x-component (the distance of the flag in the x-direction) is equal to 1 m, and the y-component (the distance of the flag in the y-direction) is equal to 1 m. The sign of a value is +1 if it is in the positive half of the x or y axis and -1 if it is in the negative half of the x or y axis. SignWindX - Sign of the wind vector's X component (1 or -1) WindX - Wind vectors's X component SignWindY - Sign of the wind vector's Y component (1 or -1) WindY - Wind vector's Y component SignKiteX - Sign of the kite vector's X component (1 or -1) KiteX - Kite vector's X component SignKiteY - Sign of the Kite vector's Y component (1 or -1) KiteY - Kite vector's Y component Result - 0 if the kite is pointing in the same direction as the wind **/ notsamedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY, 0) :- not(samedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY)). notsamedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY, 1) :- samedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY). /** samedirection(SignWindX, WindX, SignWindY, WindY, SignKiteX, KiteX, SignKiteY, KiteY checks whether the kite is pointing in the same direction as the wind. Variables - same as some of those for notsamedirection/9. **/ samedirection(SignX, 0, SignY, _WindY, SignX, 0, SignY, _KiteY) :- !. samedirection(SignX, WindX, SignY, WindY, SignX, KiteX, SignY, KiteY) :- WindGradient is (SignY * WindY) / (SignX * WindX), KiteGradient is (SignY * KiteY) / (SignX * KiteX), WindGradient is KiteGradient.