Circle of Life
Jump to navigation
Jump to search
Basic functions
- Circle of Life (CoL) is an unimplemented language created by User:Shamrocky which involves using operators that have a 2-action lifespan before they "die" (No longer usable). Each operator may take two of several actions.
Operation | Function | Usage |
---|---|---|
MakeVar | Creates a variable | Op MakeVar "ExVar" |
SetVar | Sets Variable Value | Op SetVar ExVar [Str/Int] |
IncVar | Increases Variable by 1 | Op IncVar ExVar [Must be an Integer] |
SubVar | Decreases Variable by 1 | Op SubVar ExVar [Must be an Integer] |
Split | Creates 2 Descendant Operators | Op1 Split "Op2Name", "Op3Name" |
Die | Kills Operator Early | Op Die |
Write | Prints a Variable to the Console | Op Write ExVar |
If | Standard If-Then Block | If [Condition] {[Op [Action]]} |
Loop | Loop block, loops code | Loop {[Code]} |
Erase | Erases an Operator From System Memory | LiveOp Erase DeadOp |
Add | Adds two variables together, assigns result to another variable | Op Add Var1 Var2 ResVar |
Sub | Subtracts two variables, assigns result to another variable | Opp Sub Var1 Var2 ResVar |
Sunder | Kills and erases all Operators and Variables | Op Sunder |
Each Circle of Life program starts with a base operator named "Adam" which the user may use to build the rest of the program.
Intricacies and nuance
- To terminate a program, all operators must be dead.
- Operators will not "Age" unless given an action, meaning that an operator must receive 2 actions or the Die action to terminate
- Looping does not reset the ages of operators, there must be a function to make new ones.
- Operators may not have the same name as any operator alive or dead and must have unique names or a live operator must erase a dead operator
- Using the Loop and If/Then actions do not age operators as they do not require operators to perform, though actions within the loop still age operators
- You can prompt the user with syntax which is formatted as [input] or [input|"Text"]
Example programs
Series of example programs
Hello world
Adam MakeVar "HelloWrld" Adam Split "Test1", "Test2" Test1 SetVar HelloWorld "Hello World!" Test1 Write HelloWorld Test2 Die
2 function calculator
Loop { Adam MakeVar "Operation" Adam Split "Ask", "Functions" Ask SetVar Operation [input|"Operation? 1 for addition, 2 for subtraction"] Ask Die Functions Split "Add", "Subtract" If Operation = 1 { Add Split "GetNumsA", "AddFunc" GetNums Split "Num1A", "Num2A" Num1A MakeVar "AddVar1" Num1A SetVar AddVar1 [Input|First Number?] Num2A MakeVar "AddVar2" Num2A SetVar AddVar2 [Input|Second Number?] AddFunc Split "AddFinal", "PrinterA" AddFinal MakeVar "LastA" AddFinal Add AddVar1 AddVar2 LastA PrinterA Write LastA PrinterA Sunder } If Operation = 2 { Sub Split "GetNumsS", "SubFunc" GetNums Split "Num1S", "Num2S" Num1S MakeVar "SubVar1" Num1S SetVar SubVar1 [Input|First Number?] Num2S MakeVar "SubVar2" Num2S SetVar SubVar2 [Input|Second Number?] SubFunc Split "SubFinal", "PrinterS" SubFinal MakeVar "LastS" SubFinal Sub SubVar1 SubVar2 LastS PrinterS Write LastS PrinterS Sunder } }
Errors
As with any programming language, CoL can return errors when there as an issue with a developer's code. Errors are produced with the text "ERR!" followed by a numerical code to identify the error. The following list would be some of the most common error codes.
- ERR!100: Attempted Action with no Operator
- ERR!200: Attempted Action with dead Operator
- ERR!300: Operator "Example" Not Recognized (Typo)
- ERR!400: Action "Example" Not Recognized (Typo)
- ERR!500: Tried to erase a live Operator
- ERR!600: Tried to perform a math function on a string