Download or clone the CSharpLogo repository from https://github.com/syedhussim/CSharpLogo.git.
git clone https://github.com/syedhussim/CSharpLogo.git
The program accepts two command line arguments. The first argument is the full file path to the source code. The second argument is the path to the HTML output file.
dotnet run /path/to/source/code /path/to/output.html
|home||Return to the centre of the canvas.|
|penup||Ink on the canvas is turned off.|
|pendown||Ink on the canvas is turned on.|
|setpencolor||Sets the pen colour.|
|forward||Moves the cursor forward.|
|repeat||Control flow function. Repeats code withing code block.|
|setcanvas||Sets the canvas width, height and background colour.|
|randpencolor||Sets a random pen color.|
|func||Creates a user defined function.|
To draw a square use the FORWARD and LEFT commands as shown below.
FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100
The REPEAT command is used to repeat a block of code. The code sample below shows how to draw a square by repeating the FORWARD and LEFT commands.
REPEAT 4 [ FORWARD 100 LEFT 90 ]