Triangles: unable to pass tests "no_sides_are_equal" and "no_sides_are_equal"

Hi to everyone!

Trying to solve the triangle exercise in Prolog, I can’t pass the test “no_sides_are_equal”.

Checking test code, I see it have to fail (I supouse, I am totally new with tests).

    test(no_sides_are_equal, [fail, condition(pending)]) :-          
        triangle(5, 4, 6, "equilateral").

I have checked the response for my code in SWI Prolog and the response is “fail”. Would someone be so kind as to help me with this?

I have not been able to find a solution to the “no_sides_are_equal” test either.

This is my code:

% triangle(Side1, Side2, Side3, Type).

triangle(A, B, C, T):- check_sum_restriction(A, B, C), 
  triangle2(A, B, C, T).

triangle2(A, B, C, "equilateral"):-
 A = B, B = C, A \= 0.

triangle2(A, B, C, "isosceles"):-
 A = B, B = C, A \= 0.
triangle2(A,B,C, "isosceles"):- 
 A=B, B \= C.

triangle2(A,B,C, "isosceles"):- 
 A=C, B \= C.

triangle2(A,B,C, "isosceles"):- 
 B=C, A \= C.

triangle2(A,B,C, "escalene"):- 
  A \= B , B\= C , A \= C.

check_sum_restriction(A, B, C):- R1 is A + B, R1 >= C, R2 is B + C, R2 >= A, R3 is A + C, R3 >= B.

Any help is welcome.

Have a happy day! :pray:

There is a typo in your code. Change "escalene" to "scalene" and all tests will pass.

Thank you so much Angelika! I didn’t see it :slight_smile: