+ 26

[🏆 CHALLENGE 🏆]:: TYPEOF QUAD ⬛⬜🔢

Challenge #4 Let's do some geometry this time. The challenge is to write a code which takes 4 pairs of XY coordinates and tell if the quad made by joining them is a square, rect, parallelogram, rhombus, trapezium, kite or none of them. You can use any algorithm. Test cases: (-1,0),(1,2),(2,1),(0,-1)->Rect (-1,0),(0,2),(1,0),(0,-2)->Rhombus (0,1),(1,2),(2,1),(1,0)->Square (0,0),(0,2),(3,3),(2,0)->Kite Good luck.👍 All languages allowed. Happy Coding 😀. At least try to participate.😀

6th Jan 2018, 8:38 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
14 Respuestas
+ 5
https://code.sololearn.com/cm2PS6WN6hwp/?ref=app Coming soon, extracted all useful info so far
6th Jan 2018, 1:22 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 17
yes @Pegasus @Calvin Thanks
6th Jan 2018, 9:31 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 16
@Brains can you explain your idea in detail?😀
6th Jan 2018, 9:37 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 13
@Pegasus Test case 4 is a kite. In your code, it has to be kite if lengths[0]==lengths[1] that is false in that case but lengths[1]==lengths[2] and lengths[0]==lengths[3]. So there's more work to be done. 😀 Nice code by the way. Good luck.👍
6th Jan 2018, 2:12 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 12
Hello everyone. Thanks for participating in this challenge. Hope you like the next one in this series also: https://www.sololearn.com/discuss/993834/?ref=app
10th Jan 2018, 2:32 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 9
So some quadrilaterals are: Square Rectangle Rhombus (or diamond) Parallelogram Trapezium Kite Will this do?
6th Jan 2018, 8:52 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 9
Another great challenge task. @Swapnil 👍🏼 ps. @Pegasus I like your mod badge. Congrats.
6th Jan 2018, 9:15 AM
Calviղ
Calviղ - avatar
+ 8
An interactive solution, have fun 😊😊😊 https://code.sololearn.com/Wft535TH6VA2/
7th Jan 2018, 1:47 AM
Aryeh
Aryeh - avatar
+ 7
would be more fun if more than four coordinates where allowed
6th Jan 2018, 9:36 AM
᠌᠌Code X
᠌᠌Code X - avatar
6th Jan 2018, 2:00 PM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 4
@Swapnil but the other 2 lengths are not equal. A kite must have 2 pairs of equal lengths
6th Jan 2018, 2:17 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
@Pegasus, (0,2)->(3,3) and (3,3)->(2,0) are equal, (0,0)->(0,2) and (2,0)->(0,0) are equal. 2pairs of equal length.
6th Jan 2018, 2:24 PM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 2
@Pegasus good code ya
6th Jan 2018, 2:30 PM
Venkataraman Sai Krishna
Venkataraman Sai Krishna - avatar
9th Jan 2018, 1:05 PM
István Ócsai
István Ócsai - avatar