Skip to content

Instantly share code, notes, and snippets.

@mcnemesis
Last active February 23, 2025 19:36
Show Gist options
  • Save mcnemesis/cac14d98ae94f91403e38d8982529569 to your computer and use it in GitHub Desktop.
Save mcnemesis/cac14d98ae94f91403e38d8982529569 to your computer and use it in GitHub Desktop.
TEAPAT, a basic but non-trivial personal assistant AI chatbot written in the TEA language
#!/usr/bin/tttt -fc
#-------------------------------|
# TEAPAT: TEA Personal AssistanT
#-------------------------------|
# This little program is a full
# though basic, artificial
# personal assistant created
# using the TEA language
################################|
# set entity name
v:vPANAME:{PA}
f:^$:lSET:lNOSET
l:lSET
i:{Who do u wish to talk to? }|i: # user's entity name
g:|f!:^$:lSETI:lRULES|l:lSETI|v:vPANAME|j:lRULES
l:lNOSET | y*: | v:vPANAME # evoke invoker's entity
l:lRULES # show instructions
i!:{At any time, reply with 'end' to quit}|i:
v:vPROMPT:{: Talk to Me: }
g*:{ }:vPANAME:vPROMPT | v:vPAPROMPT
l:lPROMPT # prompt, get answer, process
y:vPAPROMPT| i: |z:| q:^end$
n:10000000|s:|v:N|n:1|f:0:ANM:NM # generate answer
l:ANM|p!:27|s:_:13:5|d:_.*$|s:|v:R|g*:{}:R:N|j:F|
l:NM|y:N|l:F|a:|x!:{ | }|i: | j:lPROMPT # and loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment