Nice math lessons for those learning math! lol

Good explaination

]]>
In this thread im going to try and post solutions to math problems that come up fairly often in Illy but that non-mathematicians (me included) sometimes struggle with.

Where I know who created/published the tip I'll give a link to it.

Lets start with the problem of 'Is that nice group of NPCs within 5 tiles of that players town?'.

The commonly given answer is to use pythagoras to calculate the distance and while that works it does mean calculating the square root which if you don't have a calculator at your fingertips is way beyond me so I was overjoyed to recently find a video on youtube explaining several very mathy ways to select a random point within a circle. the reason I was so happy was that the very first method whilest based on pythagoras only needs you to do some subtraction and multiplication!

- Get the difference in the x coords of the two tiles (x1 - x2) which I'll call
*dx*. - Do the same for the y coords (y1-y2) and call that
*dy*. - Multiply the two differeces by each other (
*dx***dx*and*dy***dy*). I'll call these*sx*and*sy*respectively. - Add these together (
*sx*+*sy*). I'll call that*sh*. - If
*sh*is greater than 25 then the tile is more than 5 tiles away from the town!

Why greater than 25? Well it's 5*5 and since we're checking to see if it is within 5 tiles. If you want to see if it is within 10 tiles you just compare it to 100 instead of 25.

Big thanks to nubdotDev for creating the video that explained it all in a way even I could understand! and a link to the video: http://https://youtu.be/4y_nmpv-9lI (warning - it contains some very mathy stuff!!!)

Tens

]]>