BlueFun

From Esolang
Jump to navigation Jump to search
BlueFun
Designed by User:Lanksy
Appeared in 2023
Computational class Turing complete
Reference implementation [1]
File extension(s) formerly .BLUEFUN

BlueFun is an easy-to-use esoteric programming language. While beginner-level programs like FizzBuzz or Cat Programs may have longer code compared to other languages, BlueFun offers the advantage of code that is easier to read & understand (for shorter programs).

Origin

BlueFun is developed by the renowned creator of Bundle, featuring comparable commands and syntax. Over the time, Bundle amassed a vibrant community of users who developed numerous dialects and versions, especially after its discontinuation. Recognizing the enduring popularity and significance of its predecessor, the creator made a deliberate choice to revive the software, resulting in the birth of BlueFun.

Commands

Commands in BlueFun resemble shell commands, where the command types are specified first, followed immediately by the arguments, with a clear separation using spaces. In addition, most of the arguments can be prefixed with var: to indicate the use of a variable (e.g., var:foo). In cases where the variable does not exist, the argument will be treated as the literal string var:foo.

Here are the commands of Bundle.

  • write: Adds text to the output.
  • break: Adds a newline to the output.
  • wait <seconds>: Pauses execution for the specified number of seconds.
  • clear: Clears the output.
  • def <variable> = <value>: Sets a variable with a value.
  • ask <prompt>: Prompts the user for input and assigns it to the variable with the name res.
  • year: Sets the variable res to the current year.
  • month: Sets the variable res to the current month.
  • date: Sets the variable res to the current date.
  • hour: Sets the variable res to the current hour.
  • minute: Sets the variable res to the current minute.
  • second: Sets the variable res to the current second.
  • random <min> <max>: Sets the variable res to a random number between the specified minimum and maximum values.
  • add [a] [b]: Sets the variable res to the sum of a and b.
  • sub [a] [b]: Sets the variable res to the difference of a and b.
  • mul [a] [b]: Sets the variable res to the product of a and b.
  • div [a] [b]: Sets the variable res to the division of a by b.
  • + [variable]: Increments the value of the variable by 1. [notes 1]
  • - [variable]: Decrements the value of the variable by 1. [notes 1]
  • if <condition>: Executes the following line if the condition is true. (a = b, a > b, a < b, a != b)
  • defInCase [variable] = [value]: Sets a variable only if it doesn't exist - useful for loops.
  • loop: This function can only be added at the start of the program, and it tells the interpreter to loop the entire code.
  • stop: Stops the execution of the program - very useful when accompanied by “if” statements in loops.
  • createArr [name]: Create a blank array with a provided name.
  • setArrValue [name] [position] [value]: Set the value of an array's position.[notes 2]
  • getArrValue [name] [position]: Set the res variable to the value of an array at a position.[notes 2]
  • getCharAt [string] [position]: Set the res variable to the character of a string at a position.[notes 2]
  • joinStr [string] [string]: Set the res variable to two strings joined together.
  • getStrLength [string]: Set the res variable to the length of a string.

Comments can also be left on newlines starting with #.

Example Programs

Here are 3 simple programs written in BlueFun.

What's your name?

ask Hello! What is your name?
write What a nice name, 
write var:res
write !
break
write Today is a beautiful day.

Guess the number!

ask Guess the number between 1 and 10!
def guess = var:res

random 1 10

def output = Oh no, you're wrong!
if var:guess = var:res
def output = Wow, you guessed it!

write var:output
break
write The number was 
write var:res
write !

Count to 100!

loop
defInCase count = 1

clear
write var:count

if var:count = 100
stop

+ count

Computational Class

Although BlueFun is an unconventional esoteric programming language known for its questionable computing techniques, it possesses the remarkable property of being Turing complete. This means that it has the ability to perform any computation that a universal Turing machine can.

References & Notes

  1. 1.0 1.1 The commands + [var] and - [var] may receive the name of the variable without the var: prefix.
  2. 2.0 2.1 2.2 The position value starts at 1 instead of 0.