main_templates5/bf.scala
changeset 399 b17a98b0c52f
parent 347 4de31fdc0d67
child 400 e48ea8300b2d
--- a/main_templates5/bf.scala	Fri Nov 05 17:20:53 2021 +0000
+++ b/main_templates5/bf.scala	Sat Nov 06 00:06:39 2021 +0000
@@ -1,12 +1,12 @@
-// Core Part about an Interpreter for 
-// the Brainf***++ language
+// Main Part 5 about an Interpreter for 
+// the Brainf*** language
 //==============================================
 
 
-object CW10a {
+object M5a {
 
 
-// representation of Bf memory 
+// representation of BF memory 
 
 type Mem = Map[Int, Int]
 
@@ -24,7 +24,7 @@
 
 
 // (2) Complete the functions for safely reading  
-// and writing brainf***++ memory. Safely read should
+// and writing brainf*** memory. Safely read should
 // Return the value stored in the Map for a given memory
 // pointer, provided it exists; otherwise it Returns 0. The
 // writing function generates a new Map with the
@@ -39,7 +39,7 @@
 
 
 // (3) Implement the two jumping instructions in the 
-// brainf***++ language. In jumpRight, given a program and 
+// brainf*** language. In jumpRight, given a program and 
 // a program counter move the program counter to the right 
 // until after the *matching* ]-command. Similarly, 
 // jumpLeft implements the move to the left to just after
@@ -60,15 +60,15 @@
 
 
 
-// (4) Complete the compute function that interprets (runs) a brainf***++
+// (4) Complete the compute function that interprets (runs) a brainf***
 // program: the arguments are a program (represented as a string), a program 
-// counter, a memory counter and a brainf***++ memory. It Returns the
-// memory at the stage when the execution of the brainf***++ program
+// counter, a memory counter and a brainf*** memory. It Returns the
+// memory at the stage when the execution of the brainf*** program
 // finishes. The interpretation finishes once the program counter
 // pc is pointing to something outside the program string.
 // If the pc points to a character inside the program, the pc, 
 // memory pointer and memory need to be updated according to 
-// rules of the brainf***++ language. Then, recursively, the compute 
+// rules of the brainf*** language. Then, recursively, the compute 
 // function continues with the command at the new program
 // counter. 
 //
@@ -82,8 +82,8 @@
 
 
 
-// some sample bf/bf++-programs collected from the Internet
-//==========================================================
+// some sample bf-programs collected from the Internet
+//=====================================================
 
 
 // some contrived (small) programs
@@ -103,15 +103,6 @@
 // prints out numbers 0 to 9
 //run("""+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]""")
 
-// bf++ program calculating the cube-function, 10 * 10 * 10 = 1000
-//run("""++++++++++#>+***#""")           // Map(0 -> 10, 1 -> 1000)
-
-
-// bf++ program copies 3 from 0-cell to to cells 1, 4, 5, 6 and 7
-// (note that because of how the program wprks cell 1 will contain 7) 
-//run("""+++>+@+@+@+@+@""")   // Map(0 -> 3, 1 -> 7, 4 -> 3, 5 -> 3, 6 -> 3, 7 -> 3)
-
-
 
 // some more "useful" programs
 //-----------------------------