You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.
For the following problem you need to know some mathematical operations in Ruby. Namely, exponentiation.
In Ruby, (x^n) is written as x ** n.
It is known that for a positive number, its square root can be written in exponent notation: (\sqrt[n]{x} = x^{1/n}). So, to calculate the principal square root of x you can do x ** 0.5.
2 ** 4# => 169 ** 0.5# => 3.0
Problem
You are given two points:
with coordinates 230, 240
with coordinates 410, 240
Draw all pixels for which the distance to any one of the two given points is less than to 150.
Use the Pythagorean theorem to calculate distances, where legs are equal to the horizontal and vertical difference between points.
[\Delta = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}]
Result
Try to solve the problem on your own and guess what the result should look like, before running it. Then compare with [the correct result](Conditionals and Looping 2 (Result)).