I have decided to create an esoteric programming language. It is called radish. The only instructions are the letters in the word radish. I have no idea how I thought of this.
Here is the instruction set

r = reset the value in memory to 0
a = add 1 to the counter
d = decrement the value in memory
i = increment the value in memory
s = multiply the value in memory by the value of the counter, and reset the counter
h = output the RCS (radish character set) character in memory

RCS Characters

0 = newline
-1 to -10 = 1 to 0, as in -1 = 1, -2=2... and -10 = 0
1-26 = A-Z
27-29 = . , ?
30 = π

I am probably going to try writing an interpreter in TI-BASIC on calc.
Here is a program that prints "radish"

Code:

aaaaaaiiish
rih
riiiih
raaaiiish
raaaaaaiiisih
raaaaiish

any suggestions
Here you go:


Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define MAX_PROGRAM_SIZE 10000

// RCS character set mapping
char rcs_to_char(int code) {
    if (code == 0) return '\n';
    if (code >= -1 && code <= -10) return '0' + (10 + code);
    if (code >= 1 && code <= 26) return 'A' + (code - 1);
    if (code >= 27 && code <= 29) {
        switch(code) {
            case 27: return '=';
            case 28: return ',';
            case 29: return '?';
        }
    }
    if (code == 30) return ' ';
    return '?'; // Unknown character
}

void interpret_radish(const char* program) {
    int memory = 0;
    int counter = 0;
   
    for (int i = 0; program[i] != '\0'; i++) {
        char instruction = tolower(program[i]);
       
        switch(instruction) {
            case 'r':
                // Reset the value in memory to 0
                memory = 0;
                break;
               
            case 'a':
                // Add 1 to the counter
                counter++;
                break;
               
            case 'd':
                // Decrement the value in memory
                memory--;
                break;
               
            case 'i':
                // Increment the value in memory
                memory++;
                break;
               
            case 's':
                // Multiply the value in memory by the value of the counter, and reset the counter
                memory *= counter;
                counter = 0;
                break;
               
            case 'h':
                // Output the RCS character
                putchar(rcs_to_char(memory));
                break;
               
            default:
                // Ignore non-radish characters
                break;
        }
    }
}

int main(int argc, char* argv[]) {
    if (argc < 2) {
        printf("Usage: %s <radish_program>\n", argv[0]);
        printf("Example: %s \"raaaaaiiish\"\n", argv[0]);
        return 1;
    }
   
    // Concatenate all arguments (in case the program has spaces)
    char program[MAX_PROGRAM_SIZE] = "";
    for (int i = 1; i < argc; i++) {
        strcat(program, argv[i]);
        if (i < argc - 1) {
            strcat(program, " ");
        }
    }
   
    interpret_radish(program);
    printf("\n");
   
    return 0;
}
That's not TI-Basic...
wow. that was really fast. did you use ai? (also, that was your 4000th post)
was it Claude?
Yes it was, I don't think it's quite right because I just took a screenshot of the post but most of the core logic is there.
I just tested it, and yes, it is completely broken. I think Claude forgot what a pause in a program is.
PROGRAM:RADISH
:ClrHome
:Disp "RADISH INTERPRETER"
:Disp ""
:Input "PROGRAM: ",Str1
:0→M
:0→C
:1→P
:While P≤length(Str1)
:sub(Str1,P,1)→I
:If I="r"
:Then
:0→M
:End
:If I="a"
:Then
:C+1→C
:End
:If I="d"
:Then
:M-1→M
:End
:If I="i"
:Then
:M+1→M
:End
:If I="s"
:Then
:M*C→M
:0→C
:End
:If I="h"
:Then
:If M=0
:Then
:Disp ""
:End
:If M≥-10 and M≤-1
:Then
:Disp sub("1234567890",-M,1)
:End
:If M≥1 and M≤26
:Then
:Disp sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",M,1)
:End
:If M=27
:Then
:Disp "."
:End
:If M=28
:Then
:Disp ","
:End
:If M=29
:Then
:Disp "?"
:End
:If M=30
:Then
:Disp "π"
:End
:End
:P+1→P
:End
:Disp ""
:Disp "DONE"

More AI code
I'm not going to use AI, so I am currently writing a TI-BASIC interpreter on calc.

I have finished writing the interpreter. Here is the code:

Code:

If Str1=" "
Then
   Disp "NO PROGRAM IN STR1"
   Pause
   ClrHome
End
length(Str1)->L
0->A
0->I
0->C
Lbl MA
C+1->C
If C>L
Stop
sub(Str1,C,1)->Str2
If Str2="R"
Goto R
If Str2="A"
Goto A
If Str2="D"
Goto D
If Str2="I"
Goto I
If Str2="S"
Goto S
If Str2="H"
Then
   Goto H
Else
   Disp "INVALID CHARACTER","FOUND AT LINE",C,"THE CHARACTER",Str2,"IS INVALID"
   Pause
End
Lbl R
0->I
Goto MA
Return
Lbl A
A+1->A
Goto MA
Return
Lbl D
I-1->I
Goto MA
Return
Lbl I
I+1->I
Goto MA
Return
Lbl S
I*A->I
0->A
Goto MA
Return
Lbl H
If I=0
Disp " "
If I=~10
Disp 0
If I<0 and I>~10
Disp ~I
If I>0 and I<31
Disp sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ.,?pi",I,1)
Goto MA
Return

All in under 500 bytes. 🙂

Edit by Merth: Consolidated double post.
New update! I have submitted the interpreter to the archives, and I am now waiting for approval 🙂
claculator wrote:
New update! I have submitted the interpreter to the archives, and I am now waiting for approval 🙂

and its approved
It's not currently showing up on my profile, so here is the link for quick access. https://www.cemetech.net/downloads/files/2782/x3660
This was very eye-opening, because for some reason I didn't realize you didn't need a Then or End for a single-line If statement. Anyway, neat program.
Yeah, I'm a very self-taught coder, so when I need information on a code block (I coded this and most other TI Basic on calc) I just use the CE's built in catalog help.
Some suggestions:
1. Include a test program! People are always too lazy to write their own, aren't they 😉
2. Ok, this one isn't joking: On the ti83+ and ti84+, the DoorsCS shell will end a tibasic program and clear the screen right at its end, even though there is text on the screen to be read. Although changing "If C>L:Stop" to
"If C>L
Then
Pause
Return
End"
fixes it.
3. The check for if Str1 is empty doesn't work. Maybe ask nicely in the chat? (I dunno a fix)
4. Uh, for reasons quite apparent, I suggest adding a newline character, and maybe an input and random function too.
(May be change the name to "Radishez"?)
Your project completion rate is definitely better that mine's though, so that's a bonus. 🙂
I'm currently working on a 1.1 update that includes revamped error detection, a fix to the Str1 emptiness detector, and support for spaces. I would like to add some more features, because I believe it is not turing complete yet and inputting would be nice. My question is, how could I translate a letter into a number. I know how to do it for numbers, but how could I efficiently translate letters A-Z into numbers 1-26.
claculator wrote:
I'm currently working on a 1.1 update that includes revamped error detection, a fix to the Str1 emptiness detector, and support for spaces. I would like to add some more features, because I believe it is not turing complete yet and inputting would be nice. My question is, how could I translate a letter into a number. I know how to do it for numbers, but how could I efficiently translate letters A-Z into numbers 1-26.


Use inString(:

Code:
inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",<letter to check>

will translate A to 1 through Z to 26 (and anything else to 0).
So inString returns the position of the letter when found? I did not know that. I thought that instring just returned 1 for positive and 0 for negative.
Jeff calc 84 wrote:

4. Uh, for reasons quite apparent, I suggest adding a newline character, and maybe an input and random function too.
(Maybe change the name to "Radishez"?)

I already had a newline character (0), but it automatically adds a newline after a character is printed. This will be fixed in update 1.1. Finally, what would the "ez" in Radishez stand for?
claculator wrote:
I have decided to create an esoteric programming language. It is called radish. The only instructions are the letters in the word radish. I have no idea how I thought of this.
Here is the instruction set

r = reset the value in memory to 0
a = add 1 to the counter
d = decrement the value in memory
i = increment the value in memory
s = multiply the value in memory by the value of the counter, and reset the counter
h = output the RCS (radish character set) character in memory

RCS Characters

0 = newline
-1 to -10 = 1 to 0, as in -1 = 1, -2=2... and -10 = 0
1-26 = A-Z
27-29 = . , ?
30 = π

I am probably going to try writing an interpreter in TI-BASIC on calc.
Here is a program that prints "radish"

Code:

aaaaaaiiish
rih
riiiih
raaaiiish
raaaaaaiiisih
raaaaiish

any suggestions

can you make a program that can be a program editor like z80 studio
I would like to create something like ez80 studio, but I am not sure how to use appvars, and there is not much documentation on how to use them online. If I could do it using a BASIC library that would be even better, but C would be fine. Can anyone help me?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement