Skip to main content
Commonmark migration
Source Link

#Befunge 98 - 103 100

Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*8*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*8* pushes 8*225**2 (405000) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


Taylor Series

#Taylor Series AlthoughAlthough this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*8*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*8*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*8*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*8* pushes 8*225**2 (405000) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


#Taylor Series Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*8*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*8*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*8*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*8* pushes 8*225**2 (405000) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


Taylor Series

Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*8*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*8*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

added 1337 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*f*kz1+*8*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*f**8* pushes 15*225**28*225**2 (759375405000) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


#Taylor Series Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*f*kz1+*8*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*f*kz1+*8*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*f*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*f* pushes 15*225**2 (759375) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


#Taylor Series Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*f*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*f*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*8*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*8* pushes 8*225**2 (405000) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


#Taylor Series Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*8*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*8*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

added 1336 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*f*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*f* pushes 15*225**2 (759375) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I haven't found a shorter way of generatingused this to generate the data.


#Taylor Series Although this version is 105 chars, so I'llI just leavehad to include it like this:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*f*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (for nowsine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I usedcompute the taylor series for this to generatex - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the datataylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*f*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*f*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*f* pushes 15*225**2 (759375) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I haven't found a shorter way of generating the data, so I'll just leave it like this (for now).

I used this to generate the data.

#Befunge 98 - 103 100

:1g:02p' \k:02gk,'|,a,$ff*:*f*kz1+:'<\`*
468:<=?ABDEFGGGHGGGFEDBA?=<:86420.,+)'&$#"!!! !!!"#$&')+,.02

Cheers for a program that does this, in a language without trigonometric capabilities; the first program in fact. The second line is simply data; the character corresponding with the ascii value of the sin, added to a space character.

EDIT: I saved 3 chars by not subtracting the space away; the sinusoid is translated 32 units to the right (which is valid).

Befunge also does not have a sleep command, or something similar. It would be nice to find a fingerprint, but I couldn't find one, so ff*:*f* pushes 15*225**2 (759375) and kz runs a noop that many times (well, that many times + 1). On windows command line with pyfunge, this turns out to be about 50 milliseconds, so I say I'm good. Note: if anyone knows a good fingerprint for this, please let me know.

The last part of the code simply checks if the counter (for the data line) is past the data, if it is, the the counter is reset to 0.

I used this to generate the data.


#Taylor Series Although this version is 105 chars, I just had to include it:

:::f`!4*jf2*-:::*:*9*\:*aa*:*:01p*-01g9*/a2*+\$\f`!4*j01-*b2*+:01p' \k:01gk,$'|,a,ff*:*f*kz1+:f3*`!3*j$e-

I was trying to shorten my program, and decided to look at the taylor series for cosine (sine is harder to calculate). I changed x to pi * x / 30 to match the period requested here, then multiplied by 20 to match the amplitude. I made some simplifications (adjusted factors for canceling, without changing the value of the function by much). Then I implemented it. Sadly, it is not a shorter implementation.

:f`!4*jf2*-

checks whether the values of the taylor series are getting inaccurate (about x = 15). If they are, then I compute the taylor series for x - 30 instead of x.

:::*:*9*\:*aa*:*:01p*-01g9*/a2*+

is my implementation of the taylor series at x = 0, when x is the value on the stack.

\$\f`!4*j01-* 

negates the value of the taylor series if the taylor series needed adjustment.

b2*+

make the cosine wave positive; otherwise, the printing would not work.

:01p' \k:01gk,$'|,a,

prints the wave

ff*:*f*kz1+

makeshift wait for 50 milliseconds, then increment x

:f3*`!3*j$e-

If x is greater than 45, change it to -14 (again, taylor series error adjustment).

added 116 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114
Loading
added 66 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114
Loading
deleted 11 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114
Loading
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114
Loading