SHENZHEN I/O

SHENZHEN I/O

Not enough ratings
Tesla Challenge 22: City Planning Tool
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
1.865 KB
8 Apr, 2017 @ 11:25am
1 Change Note ( view )

Subscribe to download
Tesla Challenge 22: City Planning Tool

In 1 collection by 89o
SHENZHEN I/O Tesla Challenge Pack
24 items
Description
Subject: Important!
From: Wu Lili 吴丽丽 <wulili@longteng-co-ltd.gd.cn>

It seems as though Sun Haotian has a big project in mind, like a whole city. He has contacted us to create a simple city planner for him. All it does is work out the lengths of a triangle's edges, but he says he wants hundreds of devices like this alone. We must do our best work here.

Subject: Re: Important!
From: Carl Tesky <carl@longteng-co-ltd.gd.cn>

In case you didn't know, I'll tell you the distance formula: if x1 and y1 are the coordinates of point 1, and x2 and y2 are the coordinates of point 2, according to Pythagoras' theorem the distance between them is

sqrt((x1-x2)^2+(y1-y2)^2)

---------

Small hint: Yes, you will need to implement a square root calculator. This time there is no way around it.

Big hint: To calculate the floor function of the square root, test all perfect squares until you get one that is greater than the input. Then subtract 1.

Optimization tip: Squaring a number is as easy as doing
mul acc