Skip to main content
Commonmark migration
Source Link

#Logo, 43 bytes

Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answerprevious ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

added 429 characters in body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R;R L; if k mod 4 is 3 then the nth turn is LL R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R; if k mod 4 is 3 then the nth turn is L

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

#Logo, 43 bytes

for[i 1 512][fd 9 lt :i/(bitand :i -:i)*90] 

Try with interpreter at http://www.calormen.com/jslogo/#

This uses the same principle as my previous ASCII art answer and the formula on at wikipedia except I reversed the direction to match the image in the question:

First, express n in the form k*(2^m) where k is an odd number. The direction of the nth turn is determined by k mod 4 i.e. the remainder left when k is divided by 4. If k mod 4 is 1 then the nth turn is R L; if k mod 4 is 3 then the nth turn is L R

bitand :i -:i finds the least significant bit of i. We divide i by this to shitft i right the required amount, giving the required odd number k. There is no need to distinguish between left and right turns; we just turn left by k*90 degrees and rely on the fact that rotation is a modulo 360 operaton to perform the modulo for us.

Output

use ht to hide turtle if required.

enter image description here

Output (modified)

The following shows how the curve is a single strand.

bk 6 for[i 1 512][fd 6 rt :i/(bitand :i -:i)%4*45-90 fd 3 rt :i/(bitand :i -:i)%4*45-90] 

enter image description here

Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112
Loading