TAN Network puzzle discussion

Haha i had the same issue.

1 Like

Me too, i did a mistake with the radians conversionā€¦ and i searched for hours why only the fifth submit test fails!
Thanks for the tip :smiley:

1 Like

passed this with a* for the first time, coded in c++, got no problem in case 5 tho.
thereā€™s a very familiar verson of this puzzle, called ā€œDefibrillatorsā€, in the easy puzzle, where you too have to calculate the distance of two points based on their lat and lon after converted from deg to rad, if anyone has done the puzzle they might not go through the radians to degrees mistake thingy

Weird, I had a seemingly wrong answer on #5 :

  • ā€¦
  • Commerce
  • Republique
  • Pirmil
  • ā€¦

where the solution is supposed to be :

  • ā€¦
  • Commerce
  • Hotel Dieu
  • Aime Delrue
  • Vincent Gache
  • Wattignies
  • Mangin
  • Pirmil
  • ā€¦

Couldnā€™t see any reason why my algo got the wrong result (radians OK, inverting lat/long doesnā€™t change anything,ā€¦) so I submitted anyway and got 100%.

Not sure what to think about thisā€¦

Edit : Oh cr*p ! Right after posting, I realized I forgot a condition in the update of cost and heuristic ! Now Iā€™ve got the right result !

Iā€™m having a weird issue possibly within the algorithm itself, and this is the first time Iā€™ve implemented a Dijkstra (thanks codingame for giving me motivation on that). I canā€™t even pass all the IDE tests (stuck on test 05 -large number of stages-, the rest are ok) Comparing previous help on this thread, Iā€™ve compared and made sure that Iā€™ve used radians, implemented distance properly (and final distances match up with the ones listed here) except case 05 which is of 13.424056863059045

When debugging, Iā€™m noticing that my code never finds a replacement path for existing nodes, which is weird. My current code is something like this: (pseudocode)

[redacted for obsoleteness; view post history]

solved: I had an incorrect implementation where I was looking at the wrong path in a specific edge case.

If anyone can point out if anything jumps out at them, please do share. Iā€™ve been debugging this for two days now.

Hi All,

Just a short feedback. I had the same result as slava_spamec.
And I was sure to have a correct dijkstra, units in radians and no inversion in lat/lon.
After a few logs, I realized that none of my nodes had coordinates initialized at all. They all had 0/0 in lat/lon. What a stupid bug !!!
But even with that, I was still passing correctly all the test except #5 ā€¦ dijkstra power :slight_smile:
Of course, after correction, #5 passed like a charm.
To sum up, review carrefully your code, something very basic and stupid is hiding somewhere. And donā€™t really trust the fact that you passed test 1,2,3,4 and 6
Good luck ā€¦

Thatā€™s my problem!! Thanks!

Thanks, I also overlooked the degree/radian problem, and was wondering why only the validation did not run through ā€¦

Hello,

There is a minor bug on the display of the description of the ā€œTan Networkā€ puzzle: some html is displayed as text.

Kind regards

1 Like

Hi,
Does anyone know how to get test cases for debugging outside of CG?
I cannot print more than ~100 lines of text in Console Output Window.

Ok, Problem solved (the hard way). Anyway, you can download test case 03 from here:
http://s000.tinyupload.com/?file_id=07139910495220821165

In the top right edge of the test cases, there are three lines. When you click them, you will see each test case input and output. Doesnā€™t work for round based puzzles, though.

2 Likes

Wow. Thanks a lot, I donā€™t know how I could have missed it :slight_smile:

I really disliked this puzzle as it taught me only about anger management. I got Dijkstra right for the first time, but I missed

  • converting from degrees to radians
  • longitude and latitude order in input
    also browsing the forum a typical mistake is
  • name is not unique (and I cannot think a reason to have two stops with the same name in a cityā€¦).
    Unfortunately these really donā€™t teach me anything other than you should spend more time reading badly designed inputs than solving a problem.
2 Likes

sorry, i have same issue with slava_spamec, canā€™t i ask is it right about test 5th which has a link linking the stop to itself, such as"stop a stop a". ?

Ok I finally beat the game at my 4th day working in that problem. Finally :slight_smile:
Your answer got me on the right track.
I made a test case to be able to identify my problem. It helped me found was I was doing wrong In my code. So I put it here if someone need it.

Input:
StopArea:ABDU
StopArea:ACHA
3
StopArea:ABDU,ā€œAbel Durandā€,47.22019661,-1.60337553,1,
StopArea:ABLA,ā€œAvenue Blancheā€,47.22973509,-1.58937990,1,
StopArea:ACHA,ā€œAngle Chaillouā€,47.26979248,-1.57206627,1,
2
StopArea:ABDU StopArea:ABLA
StopArea:ABLA StopArea:ACHA

Output:
Abel Durand
Avenue Blanche
Angle Chaillou

My code was not working in this case because ACHA was never in the ā€œlinksā€ list and when I checked his distance propriety my code throw an error because he didnā€™t exist.

Similar problem to: @slava_spamec, @Rafalon and @Unihedron, beside that I have no Gaston Veil stop. Iā€™m getting following distances:

  • 1.497307141189208
  • 0.3348154821409763
  • 0
  • 2.3022053696674005
  • 13.424056863058826
  • inf

Stop list:
stops: 27 [ā€˜EINSā€™, ā€˜GERAā€™, ā€˜PCSIā€™, ā€˜RVREā€™, ā€˜RTSCā€™, ā€˜ECSUā€™, ā€˜FACUā€™, ā€˜MORHā€™, ā€˜MICHā€™, ā€˜SFELā€™, ā€˜MOTEā€™, ā€˜SMHIā€™, ā€˜OTAGā€™, ā€˜CRQUā€™, ā€˜COMMā€™, ā€˜RPBLā€™, ā€˜PIRMā€™, ā€˜PROUā€™, ā€˜MAI8ā€™, ā€˜BALIā€™, ā€˜MELIā€™, ā€˜XREZā€™, ā€˜MHUIā€™, ā€˜JGUEā€™, ā€˜JVALā€™, ā€˜LAILā€™, ā€˜GALHā€™]
endpoint: [ā€˜Galheurā€™, 13.424056863058826]
EINS ==> GALH
Einstein
Geraudiere
Petite Censive
Riviere
Recteur Schmitt
Ecole Centrale - Audencia
Facultes
Morrhonniere
Michelet
St-Felix
Motte Rouge
St-Mihiel
50 Otages
Place du Cirque
Commerce
Republique
Pirmil
Pont-Rousseau - Martyrs
8 Mai
Baliniere
Melies
Croix de Reze
Moulin a lā€™Huile
Jaguere
Jules Valles
Les Ailes
Galheur

It seems that algorithm goes in a wrong way. Que is sorted from the smallest distance. Looking forward for your remarks as I feel annoyed I cannot find the bug.

What is the point of the ā€œ5 stops, 2 routesā€ validator? I could pass every other (ā€œlarge numberā€ included) but not that one((

Iā€™m clueless. :frowning_face:
05 Large number of stages

Should go:
Einstein
Rene Cassin

but my algo goes:
Einstein
Geraudiere

which is strange, because GERA is closer:
[[0.3901467877398925, ā€˜GERAā€™], [0.41235770095082147, ā€˜RCASā€™]]

Any hint, where I made assumption mistake?

I liked this puzzle because it handles real data and problem. But I think there should be at least 2 more passing test:

  • one to check that algorithm donā€™t take path in reverse B->A when there is only A->B,
  • another to check distance are well calculated, i.e well converted in radians, with maybe data where two path that have almost the same distance.

Also there should be an example in statement of a distance calculation (with A(lat, lon) and B(lat, lon), distance is exactly N)

I get errors only on the large dataset test, and even the large dataset after submit, so it took me time to figure out what were the reasons.

Thanks to this thread it helped me.

3 Likes