[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

"Hey /g/ here's a great programming exercise for you

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 3

File: united-states-time-zone-map.gif (28KB, 600x425px) Image search: [Google]
united-states-time-zone-map.gif
28KB, 600x425px
"Hey /g/ here's a great programming exercise for you to try..."

Okay no bullshit, I need a computer to solve a real-life problem for me. If you know how to do it or know of a site or program which already does it, please help.

>Input: an origin street address (US)
>Output: a destination street address
>Criterion: the route between origin and destination is the shortest/fastest by road for the traveler to enter a new time zone
>>
>>
>>59782463
"Fastest" meaning shortest distance or shortest travel time (regarding speed limits, avg traffic, etc...)

Draw the lines that section off the time zones
Djikstra using that each line as a set of nodes
Get the shortest one, you win.

To speed it up, use some trig to draw a line to the point on that line closest to you (aka directly across horizontally, in most cases); use that as your starting path. Of course there will be outliers because you can't have a road follow that straight line path.

Use google maps data btw.
>>
>>59782463
>>59782530
since time zones are retarded - like with overlaps, switching zones and leaps - it will be a pain in the ass, OP.

Your best bet is probably to use a route calculation library/tool/whatever and check each mile or so for the time zone.
http://stackoverflow.com/questions/16086962/how-to-get-a-time-zone-from-a-location-using-latitude-and-longitude-coordinates
>>
>>59782463
Just implement A* you twat
>>
>>59782463
webdev solution:
Query the google maps api through a node.js framework
>>
Real solution: every road is an edge, every intersection is a vertex, the weight of the road is its speed limit times its length

Do Dijkstra's on this model

(No traffic accounted for in this shit)
>>
>>59782463
>the route between origin and destination is the shortest/fastest by road for the traveler to enter a new time zone
This makes no fucking sense. Why?
>>
>>59782463
We're not doing your homework for you, fgt. Or your job.
>>
>>59782732
This sounds handiest. Thank you.

>>59783093
Because I want to know the fastest way to drive into a new time zone from where I am.

>>59783107
It's neither of those things.
>>
File: 1462725642526.png (213KB, 450x472px) Image search: [Google]
1462725642526.png
213KB, 450x472px
>>59782463
>his country has more than 1 timezone
>>
>>59783682
Thankfully. Otherwise this would be much more difficult.
Thread posts: 12
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.