You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed instructions to more formally follow Brainf**k Extended Type 1, including:
@ exits the program or when in a function, ends the function and returns to main program. This replaces !.
$ stores the value of memory into a storage byte.
! retrieves the value from storage and copies to current memory.
Removed & (which used to define the start of a function, now obsolete due to @ effectively marking a function start and end).
Removed % (which used to define the end of a function, now obsolete due to @ marking a function start and end).
Optimizations.
Added optional logging with Loggly.
Copy file name to clipboardExpand all lines: AIProgrammer.Fitness/Concrete/BottlesOfBeerFitness.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ public class BottlesOfBeerFitness : FitnessBase
27
27
/// Previously generated BrainPlus functions for outputting the terms: bottles,of,beer,on,the,wall,bottles of beer,on the wall. The last two functions call sub-functions themselves. Generated using StrictStringFitness with StringFunction.
28
28
/// To use, set _appendCode = BottlesOfBeerFitness.BottlesOfBeerFunctions in main program.
Copy file name to clipboardExpand all lines: AIProgrammer.Interpreter/Interpreter.cs
+49-49Lines changed: 49 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
namespaceAIProgrammer
8
8
{
9
9
/// <summary>
10
-
/// This the brainfuck interpreter
10
+
/// This is the brainfuck interpreter.
11
11
///
12
12
/// > Increment the pointer.
13
13
/// < Decrement the pointer.
@@ -19,9 +19,9 @@ namespace AIProgrammer
19
19
/// ] Jump backward to the matching [ unless the byte at the pointer is zero.
20
20
///
21
21
/// Extended commands, included in BrainPlus.
22
-
/// ! Exits the program.
23
-
/// &Defines a new function a,b,c .. z.
24
-
/// %Return to last position in main program and restore state. Current memory value of function is set in current program memory value.
22
+
/// @ Exits the program or if inside a function, return to last position in main program and restore state.
23
+
/// $Overwrites the byte in storage with the byte at the pointer.
24
+
/// !Overwrites the byte at the pointer with the byte in storage.
25
25
/// a,b Call function a - z.
26
26
/// 0-F Sets the value of the current memory pointer to a multiple of 16.
27
27
/// </summary>
@@ -114,15 +114,20 @@ public class FunctionCallObj
114
114
115
115
/// <summary>
116
116
/// Pointer to a function's parent memory. When an input (,) command is executed from within a function, the function's current memory cell gets a copy of the value of the parent memory at this pointer. This allows passing multiple values as input to a function.
117
-
//For example: ++>++++>+<<a.!&,>,-[-<+>]<+%
118
-
/// Parent memory contains: 2, 4, 1. Function will contain: 2, 4 and return a value of 6. Resulting parent memory contains: 6, 4, 1.
117
+
/// For example: ++>++++>+<<a!.@,>,-[-<+>]<+$@
118
+
/// Parent memory contains: 2, 4, 1. Function will contain: 2, 4 and store a value of 6 in storage. Resulting parent memory remains: 2, 4, 1. Upon next command !, parent memory will contain: 6, 4, 1. The value 6 is then displayed as output.
119
119
/// </summary>
120
120
privateintm_FunctionInputPointer;
121
121
122
122
/// <summary>
123
-
/// Number of cells available to functions for memory. When a function is executed, an array of cells are allocated in upper-memory addresses (eg., 1000-1999, 2000-2999, etc.) for usage.
123
+
/// Number of cells available to functions. When a function is executed, an array of cells are allocated in upper-addresses (eg., 1000-1999, 2000-2999, etc.) for usage.
124
124
/// </summary>
125
-
privateconstint_memoryAvailableForFunctions=255;
125
+
privateconstint_functionSize=256;
126
+
127
+
/// <summary>
128
+
/// Storage memory value. Usually used to hold return values from function calls.
0 commit comments