Skip to main content
added 125 characters in body
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

TI-BASIC, 104 107 102 100100 98

For TI-83+/84+ series calculators.

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                      //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^int(e^(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Y is 0 by default, so either run this with a freshly memory-cleared calculator or store 0 to Y manually before running this.

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

TI-BASIC, 104 107 102 100

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                      //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^int(e^(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

TI-BASIC, 104 107 102 100 98

For TI-83+/84+ series calculators.

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^int(e^(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Y is 0 by default, so either run this with a freshly memory-cleared calculator or store 0 to Y manually before running this.

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

Golfed from 102 to 100
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

TI-BASIC, 104 107 102102 100

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                      //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^+Y^int(1+e^(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

TI-BASIC, 104 107 102

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                   //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^(1+(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

TI-BASIC, 104 107 102 100

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                      //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^int(e^(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

Golfed from 107 to 102.
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

TI-BASIC, 104 107 107102

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

DelvarZStandard XInput                  //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ocskixd"ixskd?oc",sub(Str1,I,1
If Ans=1Ans=4
Disp XY
X^(1+imag(Ans=2)i^Ans)+sum+Y^(ΔList1+(Ans={4,3Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256->XAns≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be almost as short asshorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

TI-BASIC, 104 107

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

Delvar XInput ">>",Str1
For(I,1,length(Str1
int(.5inString("?ocskixd",sub(Str1,I,1
If Ans=1
Disp X
X^(1+(Ans=2))+sum(ΔList(Ans={4,3
min(0,Ans(Ans≠256->X
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be almost as short as Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

TI-BASIC, 104 107 102

Name this prgmD; it eventually overflows the stack by calling itself. Replace the recursion with a While 1, at the cost of two bytes, to fix this.

ZStandard                   //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^(1+(Ans=2     //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD

Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.

EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.

107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.

Fixed code.
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127
Loading
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127
Loading