8
\$\begingroup\$

Figure

Given a random coordinate (x,y), determine in which square (squares are referenced by their sidelength) it is (or the borders of which squares). The squares are drawn in a counter clockwise direction, that is, the first square is drawn in the first quadrant, the one after is to the right, the one after that above, the next to the left and so on. The length of the square sides follows the fibonacci sequence (each new one is the sum of the two previous ones).

So, for example, given a coordinate (0,3) it should display 8, whereas (0,1) would display 0,1,2. Decimal coordinates are also aloud.

\$\endgroup\$

closed as off-topic by mbomb007, Sriotchilism O'Zaic, Quintec, user202729, Timtech Oct 8 '18 at 4:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." – Sriotchilism O'Zaic, Quintec, user202729, Timtech
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Welcome to the site! I think this challenge is really interesting, but needs a couple edits as the people who put it on hold indicated. There needs to be a winning criterion, so I'm going to add the code-golf tag since that is most commonly used. I'm also going to replace switch the x-y coordinates that you used as examples since the horizontal axis component is shown first in most notations. Feel free to revert any of the edits if they are not what you intended \$\endgroup\$ – dylnan Oct 6 '18 at 20:35
  • 3
    \$\begingroup\$ Should \$0,1,2\$ be \$0,1,5\$? \$0,1,2\$ looks like the output of \$(1,1)\$ to me. \$\endgroup\$ – Erik the Outgolfer Oct 6 '18 at 22:02
  • 1
    \$\begingroup\$ @dylnan Don't edit challenges to add winning criteria without OP's words.... codegolf.meta.stackexchange.com/questions/14838/… \$\endgroup\$ – user202729 Oct 7 '18 at 1:57
  • 1
    \$\begingroup\$ Welcome to PPCG! Nice concept. But you have a weird case with the square you label 0. Unlike all other squares, it does not have area 0^2, instead it has area 1^2. Also, the 2 square is not the sum of preceding labels 1 and 0. The fib sequence is 0,1,1,2,3,5,8... but your sequence is 0,1,2,3,5,8.... Frustrating to answerers; many bytes of code just to avoid duplicate 1 labels. An alternative: same idea, but label the squares with the index 0,1,2,3,4,5... of the Fib sequence instead. So x=10, y=3 would yield (5,6,9) with 0-based labels instead of (8,13,55). \$\endgroup\$ – Chas Brown Oct 7 '18 at 3:19
  • 1
    \$\begingroup\$ Why is the middle square labeled \$0\$ if it has side length \$1\$? \$\endgroup\$ – Sriotchilism O'Zaic Oct 7 '18 at 19:53