Wudge

From Esolang
Jump to navigation Jump to search

Wudge is a very simple string editing based esolang by User:Elphan.

Commands

Wudge only has 6 commands

Syntax What it does
set a {b} set var a to value b
ask a b ask a as prompt and get user's input for var b
jump 10 jump to line 10
print a print value of line 10
replace a [b/c],[d/e] to f take var a's value, and replace patterns b with c and d to e and the resulting string is appended to variable f
if a found [b] do 10 if in var a, pattern b was found, do the next 10 lines. else skip

note: for

replace a [b/c],[d/e] to f

you can stack as many [a/b] arguments as you wish, or just make many replace commands

Example programs

Hello, world!

set a {Hello, world!}
print a

Truth-machine

set prompt {I need 1 or 0}
ask prompt input
if input found [1] do 2
print input
jump 4
if input found [0] do 1
print input

Infinite cat program

set prompt {}
ask prompt input
print input
jump 1

One time cat program

set prompt {}
ask prompt input
print input

Asterisks to Roman numerals

set msg {this program counts the amount of * you input in roman numerals up to MMMCMXCIX.}
print msg
set prompt { please input: }
ask prompt roman
set result {Result:}
replace roman [*/I],[IIIII/V],[IIII/IV],[VV/X],[VIV/IX],[XXXXX/L],[XXXX/XL], [LL/C],[LXL/XC],[CCCCC/D],[CCCC/CD],[DD/M],[DCD/CM] to roman
print result
print roman

Asterisks to Base 10 digit 2 op calculator (up to 10k)

set prompt {give an equation like **+* or **-* and this will answer (up to 10000 - 1): }
ask prompt arab
if arab found [+] do 1
replace arab [+/] to arab
if arab found [-] do 11
  replace arab [*-*/SmS] to arab
  replace arab [*-/Shm] to arab
  if arab found [-*] do 1
    jump 17
  replace arab [SmS/$-$] to arab
  replace arab [Shm/*-] to arab
  if arab found [$] do 2
    replace arab [$/] to arab
    jump 6
  replace arab [-/] to arab
    jump 5
set msg {Result:}
replace arab [**********/t],[tttttttttt/h],[hhhhhhhhhh/T],[*********/9],[********/8],[*******/7],[******/6],[*****/5],[****/4],[****/3],[**/2],[*/1],[ttttttttt/9],[tttttttt/8],[ttttttt/7],[tttttt/6],[ttttt/5],[tttt/4],[tttt/3],[tt/2],[t/1],[hhhhhhhhh/9],[hhhhhhhh/8],[hhhhhhh/7],[hhhhhh/6],[hhhhh/5],[hhhh/4],[hhhh/3],[hh/2],[h/1],[TTTTTTTTT/9],[TTTTTTTT/8],[TTTTTTT/7],[TTTTTT/6],[TTTTT/5],[TTTT/4],[TTTT/3],[TT/2],[T/1] to arab
print msg
print arab

Interpreters/Compilers

You can find the Python interpreter for Wudge here.