[Community Puzzle] Nature of quadrilaterals

salut!

je vais faire ça, mais ça sera pas beau, et vraiment pas lisible, je te préviens.

question con, c’est quoi comme cas qui te faisait dérailler la validation du “everything”? parce que chez moi la validation de test fonctionne, mais pas celle du submit… alors à moins que dans le test du submit il y ait un cas rare à controler avant de vouloir faire quelque opération que ce soit (un parallélogramme plat, ou 4 points identiques, un cas que j’aurais oublié qui mette tout en l’air)

parce qu’en gros, je teste d’abord si c’est un parallélogramme, ensuite je regarde si c’est pas un losange (un parallélogramme, avec 2 côtés consécutifs de même longueur suffit) puis si c’est pas un rectangle (parallélogramme et 1 angle droit suffit), et enfin je teste si c’est pas un carré (losange et rectangle à la fois), en changeant à chaque fois le contenu d’un String qui participe à la réponse… enfin j’ai tout commenté dès que c’est illisible, tu verras

merci par avance de ton aide, en tout cas.

Il n’y a pas de cas dégénéré (plat, quoi).
Teste peut-être le cas du carré avant puis fais suivre par des else if.

Hi, I’m looking for a little hint. My code pass in the IDE but fails on “square” in the submit. Quite surprising as I thought square was the easy test. I test that all segments are same length and that there’s one right angle.

How could it not pass during the submit?

1 Like

@nicola1 hi, also failed at submit test on square. i think that it’s necessary and sufficient conditions that all sides are equal and side1^2+side2^2=diagonal^2, i also put equal of diagonals, but it’s not neccesary.

I’m stuck in the same state. No idea what I could be doing wrong. I basically test for is_rhombus and is_rectangle, and if both are true I call it a square (and test for that first).

I fixed it. Issue was using equality with floats (I should know better), replacing it with “almostEqual” I rolled. It was the right triangle test that was failing.

You don’t need floats. :wink:

“The coordinates are integers between -20 and 20”

Hey look, it’s right there in the constraints! :smiley:

Thanks, Nicola. Good puzzle, I hadn’t thought about trig in a while.

When i try to do smth in main function with variables in predefined code, i get an error
First i just try to cout point’s coordinate and get: error: ‘xA’ was not declared in this scope

How can i solve this problem?

The code is:

int main()
{
    //auto-generated code
    cout << xA << endl;
    //some more auto-generated code
    
    for (int i = 0; i < n; i++) {
        // Write an action using cout. DON'T FORGET THE "<< endl"
        // To debug: cerr << "Debug messages..." << endl;
        //cout << xA << endl;
        cout << "answer" << endl;
    }
}

UPD: never dealt with variables defined in loop :slight_smile:

You are right, I had the same issue, and I fix it with “AlmostEquals”

Bonjour à tous.

Je me retrouve dans un cas similaire à picalex06, c’est-à-dire que mon code passe tous les tests, mais pas la soumission.
Mon code échoue à la soumission sur :

  • 01:Quadrilateral
  • 06:Everything

Et comme je ne veux pas publier mon code à la vue de tous pour éviter les tricheries… :wink:

Comment partager ce code et qui peut m’aider ?

Merci d’avance !

Tu peux m’envoyer ton code, c’est mon puzzle.

1 Like

See https://www.codingame.com/forum/t/nature-of-quadrilaterals-test-cases-bug/78369

The sixth test case “Everything” doesn’t work correctly.

3
H -4 3 A 2 5 R 4 2 D 10 4
J -2 0 A 0 1 C 2 0 K 0 -1
A 1 -2 B 5 0 C 3 4 D -1 2

The figure HARD is drawn on https://www.wolframalpha.com/input/?i=(-4,+3)+,+(2,+5)+,+(4,+2)+,+(10,+4).
It is a parallelogram , but the test expects answer quadrilateral.

This bug does not occur when you submit the submission.

Nope, HADR is a parallelogram, not HARD.

2 Likes

@nicola1 Thanks,
Then the final tests should be adjusted to contain test for such case.

Hello, I’m stuck at 83% success.

I pass all the tests successfully but when submitting, I have a problem with the 05-square case (the others are ok).

To test if I have a square, I do a test to know if the quadrilateral is rectangle and rhombus.

My rectangle test in rapid:

if (dist_ac2 == (dist_ab2 + dist_bc2)) and (dist_db2 == (dist_dc2 + dist_bc2)):
return True

my rhombus test in rapid:

if dist_ab == dist_bc == dist_cd == dist_da:

I don’t use the right properties to check the nature of the quadrilateral?

Don’t use the square root.

@nicola really nice puzzle!

I’ve created tiny script that shows how test case quadrilaterals look like

1 Like

  • all points must be connected
    now I understand what do you mean.
    :+1: