[Community Puzzle] Hello, World!


#1

https://www.codingame.com/training/easy/hello-world

Send your feedback or ask for help here!

Created by @TBali,validated by @bbb000bbbyyy,@PatrickMcGinnisII and @Deltaspace.
If you have any issues, feel free to ping them.


#2

My code passes exactly half of the cases.
It doesn’t pass, for instance, test # 2:

Found: Haile to thee, Noble Master!
Expected: Chairete! Haile to thee, Noble Master!

My program counts the distance between locations using Haversine formula, and it indicates that the smallest distance is 2607 km to The_Globe_Theatre. While “Chariete!” can only be heard from Epidaurus, which is 9305 km from my location.

Even if I’m using a wrong formula, the discrepancy can’t be that big. What am I doing wrong?


#3

Based on the expected output you mentioned, I assume we are talking about Test case #02, travel location #3, which is: N450915 E0125549. That is near Venice, halfway between London and Epidauros, Greece. See it on for example Google Maps:
https://www.google.hu/maps/place/45°09'15.0"N+12°55'49.0"E/@45.1559524,11.809514,8z/data=!4m5!3m4!1s0x0:0x0!8m2!3d45.1541667!4d12.9302778

PS: beware, based on reviewer feedback, I just changed the order of input of the puzzle, so you shall update your input parser code.


#4

Sorry, somehow after your update all my code got deleted, so I probably won’t come back to this puzzle in the nearest future :cry:


#5

If you ever submitted, you can get it back going to ‘results’ menu on the left, then to ‘history’ and ‘send to ide’. Sorry for the inconvenience.


#6

My code passes all the cases except the second one…

I found “Chairete!” instead of “Chairete! Haile to thee, Noble Master!”
I used the wikipedia page given in the exercise and all the other cases seem right that’s why I don’t understand why it doesn’t seem good for test #2.

If someone can help me, it would be great !
Thanks in advance !


#7

I assume it is the 4th location of IDE TEST #2, that is N450915 E0125549. Distance to both Epidauros Theater and London Globe Theater shall be 1191 km. I suggest try to print out to error log the distance values that your code calculates and see where is the difference.


#8

Check your distances to the capitals, you certainly have two capitals that should be considered at equal distance but that you do not properly detect (due to rounding error or floating point inaccuracy).

Unfortunately, it’s a problem that is likely to happen as there are several possible formulas to compute the distance, which might lead to slightly different results. Anyway make sure (if appropriate to your programming language) to use 64-bit floating-point numbers (double instead of float in C/C++) to reduce that risk.


#9

my code was with same error: used lat & lon as lon & lat :cry:


#10

Hi,
To be honest, as the puzzle creator, I am a bit sad, that my puzzle received not too favourable average rating, with quite a big variance between 5s and 2s. As this was my very first puzzle candidate, I kindly ask for any feedback, what shall I do differently next time?

Did you find the puzzle too easy? Or too hard? Should it have been Medium instead of Easy?
Would you have needed more exact distance calculation formula in the description, instead of a wikipedia link and the need to figure it out yourself: sexagesimal DMS to decimal conversion, converting cardinal directions as the sign of the value, degree to radian conversion, which distance formula to use (with 64 bit float: any), rounding, etc.? (I thought if I write it all down, it is no longer a puzzle, maybe I was wrong.)
Were the test cases sufficient? Funny enough?


#11

A few remarks:

  • There are only 16 ratings for now (7 are <=2 stars).
  • The “round and treat all values equal to the min” part could be trickier than you imagined (see my previous post in this thread), it can be frustrating to beginners who either do not know how to handle the boring floating-point issues or even are not aware of these issues. It seems to me that some easy (and maybe sometimes medium) puzzles have received bad ratings because of such issues.
    + I also checked very quickly and apparently you cannot solve this problem using the formula from Defibrillators.
  • Your puzzle did not benefit from a serious reviewing which could have spotted a few annoying points such as the previous one.

#12

Well if you can take it, here’s what I commented on my own solution (that’s where I usually leave my hot takes, to remember them later on):

This puzzle has just about all it takes to tear the fun out.
Tedious input, useless input, numerical stability unawareness, voluntary hunting for rounding limits, unnatural output.
And quasiduplicate with an official puzzle, no less.

Not that I gave you a bad rating. I don’t remember what rating I gave, I just closed the page.


#13

For me, this was such a nice puzzle - I have to learn few things on my own, which is fine. What I don’t like is validation on submitting result. I pass all test cases but didn’t pass Validator 6 on submit. And to be honest - looking for a bug in such mathematical code without any hint is nothing I would like to do. So I left this puzzle.


#14

@Niako, @JBM, @Mejla: Thanks for the feedback. (And yes, I can take it :slight_smile:)
The main takeaway for me is, that as a puzzle creator I need to focus much more on the ‘customer experience’.
If it is not too much to ask, I kindly ask to review and comment also my other puzzle (currently on the ‘contributions to be reviewed’ page) - maybe with the help of you it will be better in the end than this one.


#15

I just finished it and there is too me few points missing making the debug a more complex. For example, I was having problem with puzzle 2 and 6. I realized that this is the only ones having a mix of N/S or E/W.

My first bet :

  • I was using the wrong way of making conversion (to decimal but also for the +/-). I had to checked on several online converter to ensure it’s fine.

Second bet:

  • I was using the wrong formula for the distance (because the formula is not given)… still no error.

Third bet:

  • Rounding issue… but no

At the end it was because I didn’t realized that the angle for E/W had 3 digits and 2 for N/S (you mentionned it but I missed it). As a result, in the first debug, I checked E0162100 as 01° 62’ 100" and it was according my converter but instead it was 016° 21’ 00"

Maybe having the formula given and a step by step example would help a lot


#16

Thanks for the feedback. Yes, 3 or 2 digits of longitude degree can make quite a difference.
I updated the puzzle description with some more specific hints on formula usage, coordinate conversions, 64-bit floats.