none
Small Basic Sample Code for Xamarin Workbooks RRS feed

Answers

  • Getting Started

    1. Install Xamarin Workbooks from here.
    2. Select [File] [Add Package], type "Small Basic", select "SmallBasic.Workbook 1.2.0" and push [ADD PACKAGE].
    3. Type following code.
    4. Push Ctrl+R.

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    Turtle.Move(100);

    Screen shot of a Xamarin Workbooks sample program with Small Basic Turtle


    Nonki Takahashi



    Thursday, September 7, 2017 1:35 PM
    Moderator

All replies

  • Getting Started

    1. Install Xamarin Workbooks from here.
    2. Select [File] [Add Package], type "Small Basic", select "SmallBasic.Workbook 1.2.0" and push [ADD PACKAGE].
    3. Type following code.
    4. Push Ctrl+R.

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    Turtle.Move(100);

    Screen shot of a Xamarin Workbooks sample program with Small Basic Turtle


    Nonki Takahashi



    Thursday, September 7, 2017 1:35 PM
    Moderator
  • Tips

    • Xamarin Workbooks is an environment to code C# program.
    • SmalBasic.Workbook 1.2.0 (Small Basic library) can be called from C# program in Xamarin Workbooks.
    • So, C# with Xamarin Workbooks could be a next step from Small Basic programming.

    Nonki Takahashi

    Thursday, September 7, 2017 2:30 PM
    Moderator
  • Mac

    • couldn't use TextWindow or GraphicsWindow yet

    Screen shot of Xamarin Workbooks on Mac


    Nonki Takahashi

    Thursday, September 7, 2017 10:59 PM
    Moderator
  • translated ur prism to xamarin:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    int gw = 598; int gh = 428; int e = 100;
     double r3 = Math.SquareRoot(3);
     Primitive LF = Text.GetCharacter(10);
    GraphicsWindow.Title = "Prism";
    
    
      for (int tht1 = 0; tht1<70; tht1=tht1+3){
          GraphicsWindow.Clear();
          Init();
          int  r = (int)(e * r3 / 3);
           int a = -150;
      double _a = Math.GetRadians(a);
      double n1 = 1;    //' refractive index of air
      double n2 = 1.5;  //' refractive index of glass
    
      double _tht1 = Math.GetRadians(tht1);
      double _tht2 = Math.ArcSin(n1 / n2 * Math.Sin(_tht1));
      double tht2 = Math.GetDegrees(_tht2);
      double _xo = r;
      double _yo = 0;
      int xo = gw / 2 + Math.Cos(_a) * _xo - Math.Sin(_a) * _yo;
      int yo = gh / 2 + Math.Sin(_a) * _xo + Math.Cos(_a) * _yo;
      int x = xo + 300 * Math.Cos(_a - _tht1);
      int y = yo + 300 * Math.Sin(_a - _tht1);
      GraphicsWindow.DrawLine(x, y, xo, yo);
      double l = e / (Math.Sin(_tht2) + 1 / r3 * Math.Cos(_tht2));
      int xo2 = xo + l * Math.Cos(_a + Math.Pi - _tht2);
      int yo2 = yo + l * Math.Sin(_a + Math.Pi - _tht2);
      GraphicsWindow.DrawLine(xo, yo, xo2, yo2);
       a=-150;
      DrawArc(xo, yo, 30, a, (a-tht1));
      _a = Math.GetRadians(a - tht1 / 2);
      r = 50;
      GraphicsWindow.FontSize = 12;
      x = xo + r * Math.Cos(_a) - 4;
      y = yo + r * Math.Sin(_a) - 6;
      GraphicsWindow.DrawText(x, y, "θ");
      GraphicsWindow.FontSize = 9;
      GraphicsWindow.DrawText(x + 8, y + 6, "1");
     
      DrawArc(xo,yo,30,a+180,(int)(a+180-tht2));
      _a = Math.GetRadians(a + 180 - tht2 / 2);
      r = 50;
      GraphicsWindow.FontSize = 12;
      x = xo + r * Math.Cos(_a) - 4;
      y = yo + r * Math.Sin(_a) - 6;
      GraphicsWindow.DrawText(x, y, "θ");
      GraphicsWindow.FontSize = 9;
      GraphicsWindow.DrawText(x + 8, y + 6, "2");
      double tht3 = 60 - tht2;
      double _tht3 = Math.GetRadians(tht3);
      double _tht4 = Math.ArcSin(n2 / n1 * Math.Sin(_tht3));
      double tht4 = Math.GetDegrees(_tht4);
      r = (int)(e * r3 / 3);
      a = 150;
      _a = Math.GetRadians(a);
    
      int x2 = xo2 + r * Math.Cos(_a);
      int y2 = yo2 + r * Math.Sin(_a);
      a = -30;
      _a = Math.GetRadians(a);
      int x1 = xo2 + r * Math.Cos(_a);
      int y1 = yo2 + r * Math.Sin(_a);
      GraphicsWindow.DrawLine(x1,y1,x2,y2);
    
      x = xo2 + 300 * Math.Cos(_a + _tht4);
      y = yo2 + 300 * Math.Sin(_a + _tht4);
      GraphicsWindow.DrawLine(x, y, xo2, yo2);
      Primitive buf = "tht1=" + (Math.Floor(tht1 * 100) / 100) + LF;
      buf = buf + "tht2=" + (Math.Floor(tht2 * 100) / 100) + LF;
      buf = buf + "tht3=" + (Math.Floor(tht3 * 100) / 100) + LF;
      buf = buf + "tht4=" + (Math.Floor(tht4 * 100) / 100) + LF;
      GraphicsWindow.FontSize = 12;
      GraphicsWindow.DrawText(10, 10, buf);
    Program.Delay(733);
      }
    
    public void Init(){
      
      GraphicsWindow.Width = 598;
      GraphicsWindow.Height = 428;
      GraphicsWindow.BackgroundColor = "darkblue";
      GraphicsWindow.BrushColor = "#aa00ffff";
     
      
      int x1 = gw / 2;
      int y1 = gh / 2 - (int)(e * r3 * 2 / 3);
      int x2 = gw / 2 - e;
      int y2 = gh / 2 + (int)(e * r3 / 3);
      int x3 = gw / 2 + e;
      int y3 = y2;
      GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3);
      GraphicsWindow.PenColor = "White";
      GraphicsWindow.BrushColor = "White";
      int a = -150;
      double _a = Math.GetRadians(a);
      
     int r = (int)(e * r3 * 2/3); 
        int px1 = gw / 2 + r * Math.Cos(_a);
          int py1 = gh / 2 + r * Math.Sin(_a);
            GraphicsWindow.DrawLine (px1, py1, gw/2, gh/2);
             
      a = -150;
      _a = Math.GetRadians(a);
      px1 = gw / 2 + r * Math.Cos(_a);
      py1 = gh / 2 + r * Math.Sin(_a);
      GraphicsWindow.DrawLine(px1, py1, gw/2, gh/2);
     
     a = -150;
      _a = Math.GetRadians(a);
      r = (int)(e * r3 / 3);
      int _x1 = r + 10 ;
      int _y1 = 0;
      int _x2 = r + 10 ;
      int _y2 = 10;
      x1 = gw / 2 + Math.Cos(_a) * _x1 - Math.Sin(_a) * _y1;
      y1 = gh / 2 + Math.Sin(_a) * _x1 + Math.Cos(_a) * _y1;
      x2 = gw / 2 + Math.Cos(_a) * _x2 - Math.Sin(_a) * _y2;
      y2 = gh / 2 + Math.Sin(_a) * _x2 + Math.Cos(_a) * _y2;
      GraphicsWindow.DrawLine(x1, y1, x2, y2);
    
      _x1 = r;
      _y1 = 10;
      _x2 = r + 10 ;
      _y2 = 10;
      x1 = gw / 2 + Math.Cos(_a) * _x1 - Math.Sin(_a) * _y1;
      y1 = gh / 2 + Math.Sin(_a) * _x1 + Math.Cos(_a) * _y1;
      x2 = gw / 2 + Math.Cos(_a) * _x2 - Math.Sin(_a) * _y2;
      y2 = gh / 2 + Math.Sin(_a) * _x2 + Math.Cos(_a) * _y2;
      GraphicsWindow.DrawLine(x1, y1, x2, y2);
    }
    
    private void DrawArc(int xo, int yo, int r, int a1, int a2){
    
      int aMin = Math.Min(a1, a2);
      int aMax = Math.Max(a1, a2);
      bool last = false;
      int xLast=xo;
      int yLast=yo;
      for (int a = aMin; a<=aMax; a=a+5){
        double _a = Math.GetRadians(a);
        int x = xo + r * Math.Cos(_a);
        int y = yo + r * Math.Sin(_a);
        if (aMin < a ){
          GraphicsWindow.DrawLine(x, y, xLast, yLast);
        }
        if (!last && (aMax < a + 5) ){
          a = aMax - 5;
          last = true;
        }
        xLast = x;
        yLast = y;
      }
    }
    

    Friday, September 8, 2017 7:15 AM
  • This is a sample program to test Math.Abs() operation.

    • TextWindow.ForegroundColor can't be changed.
    • Causes same exception with Small Basic program (GTZ663) in test case 4, 5, 23 and 24.
    // Math.Abs() Test
    // Copyright © 2017 Nonki Takahashi.  The MIT License.
    // Last update 2017-09-08
    // Small Basic Program ID GTZ663
    
    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    
    public Primitive LF = Text.GetCharacter(10);
    public Primitive testcase, index, nTest, _case, abs, nPass;
    
    Init();
    Test();
    
    public void Init() {
        testcase[1] = "number=-1.7976931348623157E+308;abs=1.7976931348623157E+308;";
        testcase[2] = "number=-8E28;abs=8E28;";
        testcase[3] = "number=-79228162514264337593543950336;abs=79228162514264337593543950336;";
        //OverflowException: Value was either too large or too small for a Decimal.
        //at decimal..ctor (double value)
        //at Primitive Microsoft.SmallBasic.Library.Math.DoubleToDecimal (double number)
        //at Primitive Microsoft.SmallBasic.Library.Math.Abs (Primitive number)
        //at void .Test ()
        //at void <<Initialize>>d__0.MoveNext ()
        //at void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
        //at void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Task task)
        //at void Xamarin.Interactive.Compilation.CompilationExecutionContext<TScriptResult>.<RunAsync>d__12.MoveNext ()
        //at void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
        //at void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Task task)
        //at void Xamarin.Interactive.Repl.ReplExecutionContext.<RunAsync>d__9.MoveNext ()Unhandled Exception: 
        //testcase[4] = "number=-79228162514264337593543950335;abs=79228162514264337593543950335;";
        //testcase[5] = "number=-79228162514264333195497438208;abs=79228162514264333195497438208;";
        testcase[6] = "number=-79228162514264333195497438207;abs=79228162514264333195497438207;";
        testcase[7] = "number=-79228162514264333100000000000;abs=79228162514264333100000000000;";
        testcase[8] = "number=-79228162514264300000000000001;abs=79228162514264300000000000001;";
        testcase[9] = "number=-79228162514264300000000000000;abs=79228162514264300000000000000;";
        testcase[10] = "number=-7E28;abs=7E28;";
        testcase[11] = "number=-1.2;abs=1.2;";
        testcase[12] = "number=-1E-28;abs=1E-28;";
        testcase[13] = "number=-1E-29;abs=1E-29;";
        testcase[14] = "number=0;abs=0;";
        testcase[15] = "number=1E-29;abs=1E-29;";
        testcase[16] = "number=1E-28;abs=1E-28;";
        testcase[17] = "number=1.2;abs=1.2;";
        testcase[18] = "number=7E28;abs=7E28;";
        testcase[19] = "number=79228162514264300000000000000;abs=79228162514264300000000000000;";
        testcase[20] = "number=79228162514264300000000000001;abs=79228162514264300000000000001;";
        testcase[21] = "number=79228162514264333100000000000;abs=79228162514264333100000000000;";
        testcase[22] = "number=79228162514264333195497438207;abs=79228162514264333195497438207;";
        //OverflowException: Value was either too large or too small for a Decimal.
        //at decimal..ctor (double value)
        //at Primitive Microsoft.SmallBasic.Library.Math.DoubleToDecimal (double number)
        //at Primitive Microsoft.SmallBasic.Library.Math.Abs (Primitive number)
        //at void .Test ()
        //at void <<Initialize>>d__0.MoveNext ()
        //at void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
        //at void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Task task)
        //at void Xamarin.Interactive.Compilation.CompilationExecutionContext<TScriptResult>.<RunAsync>d__12.MoveNext ()
        //at void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
        //at void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Task task)
        //at void Xamarin.Interactive.Repl.ReplExecutionContext.<RunAsync>d__9.MoveNext ()Unhandled Exception: 
        //testcase[23] = "number=79228162514264333195497438208;abs=79228162514264333195497438208;";
        //testcase[24] = "number=79228162514264337593543950335;abs=79228162514264337593543950335;";
        testcase[25] = "number=79228162514264337593543950336;abs=79228162514264337593543950336;";
        testcase[26] = "number=8E28;abs=8E28;";
        testcase[27] = "number=1.7976931348623157E+308;abs=1.7976931348623157E+308;";
        index = Array.GetAllIndices(testcase);
        nTest = Array.GetItemCount(testcase);
    }
    
    public void Test() {
      TextWindow.WriteLine("Math.Abs() Test");
      TextWindow.WriteLine("exp:expected, res:result" + LF);
      for (int i = 1; i < nTest; i++) {
        if (index[i] < 10) {
          TextWindow.Write(" ");
        }
        TextWindow.Write(index[i]);
        _case = testcase[index[i]];
        abs = Math.Abs(_case["number"]);
        if (abs == _case["abs"]) {
          TextWindow.ForegroundColor = "Green";
          TextWindow.Write(" PASS ");
          nPass = nPass + 1;
        } else {
          TextWindow.ForegroundColor = "Red";
          TextWindow.Write(" FAIL ");
        }
        TextWindow.ForegroundColor = "Gray";
        TextWindow.Write("|" + _case["number"] + "| ");
        TextWindow.Write("exp=" + _case["abs"] + " ");
        TextWindow.Write("res=" + abs);
        TextWindow.WriteLine("");
      }
      TextWindow.WriteLine(LF + "Pass: " + nPass + "/" + nTest);
    }
    


    Nonki Takahashi

    Friday, September 8, 2017 1:33 PM
    Moderator
  • Following program is converted from Small Basic program.  Key points for conversion are:

    • Add a package SmallBasic.Workbook 1.2.0 first.
    • Add "using Microsoft.SmallBasic.Library;"
    • List up all variables like "public Primitive var1, var2, ... ;"
    • Add ";" after all sentences.
    • Replace "'" to "//" for comments.
    • Replace Small Basic keywords such like For, While, If and Goto to C# keywords for, while, if, goto and {}.
    // Design Your Original Car
    // Copyright © 2016 Nonki Takahashi.  The MIT License.
    // Small Basic Program ID KFF238
    
    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    
    public Primitive gw, gh, x, y;
    
    GraphicsWindow.Title = "Design Your Original Car";
    Init();
    // ground
    GraphicsWindow.BrushColor = "Gray";
    GraphicsWindow.FillRectangle(0, 400, gw, gh - 400);
    // light
    GraphicsWindow.BrushColor = "#99FFFFFF";
    GraphicsWindow.FillEllipse(100, 250, 50, 50);
    // top
    GraphicsWindow.FillEllipse(250, 150, 200, 200);
    // tail lump
    GraphicsWindow.BrushColor = "#99FF0000";
    GraphicsWindow.FillEllipse(500, 250, 50, 50);
    // body
    GraphicsWindow.BrushColor = "DarkCyan";
    GraphicsWindow.FillEllipse(100, 250, 450, 100);
    // wheels
    GraphicsWindow.BrushColor = "#333333";
    GraphicsWindow.FillEllipse(150, 300, 100, 100);
    GraphicsWindow.FillEllipse(375, 300, 100, 100);
    GraphicsWindow.BrushColor = "Silver";
    GraphicsWindow.FillEllipse(170, 320, 60, 60);
    GraphicsWindow.FillEllipse(395, 320, 60, 60);
    // bumpers
    GraphicsWindow.FillRectangle(100, 300, 50, 10);
    GraphicsWindow.FillRectangle(500, 300, 50, 10);
    
    public void Init() {
      gw = 598;
      gh = 428;
      GraphicsWindow.Width = gw;
      GraphicsWindow.Height = gh;
      GraphicsWindow.BackgroundColor = "SkyBlue";
      GraphicsWindow.BrushColor = "Gray";
      DrawGrid();
      GraphicsWindow.PenWidth = 0;
    }
    
    public void DrawGrid() {
        GraphicsWindow.PenColor = "#CCCCCC";
        for (y = 0; y <= gh; y += 50) {
            GraphicsWindow.DrawLine(0, y, gw, y);
        }
        for (x = 0; x <= gw; x += 50) {
            GraphicsWindow.DrawLine(x, 0, x, gh);
        }
        GraphicsWindow.PenColor = "#999999";
        for (y = 0; y <= gh; y += 100) {
            GraphicsWindow.DrawLine(0, y, gw, y);
            GraphicsWindow.DrawText(2, y + 2, y);
        }
        for (x = 0; x <= gw; x += 100) {
            GraphicsWindow.DrawLine(x, 0, x, gh);
            GraphicsWindow.DrawText(x + 2, 2, x);
        }
    }

    Screen shot of a Xamarin Workbooks program Design Your Original Car


    Nonki Takahashi

    Friday, September 8, 2017 2:26 PM
    Moderator
  • By the way, what is View Inspector?

    Screen shot of a Xamarin Workbook showing View Inspector


    Nonki Takahashi

    Friday, September 8, 2017 2:45 PM
    Moderator
  • I modified the program above and added documents.  Most important point of Xamarin Workbooks is to able to have document with code.

    Xamarin Workbook: Learn C# for Small Basic Users | TechNet Gallery

    Screen shot of Xamarin Workbooks contains tutorial to learn C# for Small Basic users


    Nonki Takahashi

    Wednesday, September 13, 2017 3:15 AM
    Moderator
  • I found a document about Xamarin Inspector.

    https://developer.xamarin.com/guides/cross-platform/inspector/


    Nonki Takahashi


    Wednesday, September 13, 2017 6:45 AM
    Moderator
  • Programming with Small Basic Objects

    I started to write workbooks about Small Basic objects.  Some workbooks are available even with Mac.

    https://gallery.technet.microsoft.com/Xamarin-Workbooks-a4ee4e03

    Screen shot of Xamarin Workbooks with 1_Array.workbook


    Nonki Takahashi

    Wednesday, September 13, 2017 10:34 AM
    Moderator
  • xamarin snail draw:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    
    GraphicsWindow.BackgroundColor ="teal";
    GraphicsWindow.Title="Snail";
    Turtle.Speed =9;
    
    Turtle.PenUp ();
    GraphicsWindow.BrushColor="gold";
    GraphicsWindow.PenWidth=0;
    GraphicsWindow.Width=220;
    GraphicsWindow.Height =150;
    int f300=120;
    Primitive tt;
      int r=50;
      double a=10;
      Turtle.Angle=-90;
      Turtle.X=200;
      Turtle.Y=120;
      GraphicsWindow.BrushColor="gold";
       for (int x=0;  x<= 30; x++){
        Turtle.Move(5);
        Primitive s=Shapes.AddEllipse(r, r);
        Shapes.Move(s, Turtle.X-r/2, Turtle.Y-r/2);
        }
      Turtle.Angle=0;
      Turtle.X=100;
      Turtle.Y=100;
     for (int x=0;  x<= 45; x++){
        r=55-x/2;
        int vv=x+80;
        Primitive s=Shapes.AddEllipse(r, r);
        GraphicsWindow.BrushColor= GraphicsWindow.GetColorFromRGB(vv,vv/3,vv/3);
        Shapes.Move(s, Turtle.X-r/2, Turtle.Y-r/2);
        Turtle.Move (10);
        Turtle.Turn(a);
        a=a*1.03;
      }
    Turtle .Hide ();

    Wednesday, September 13, 2017 6:54 PM
  • xamarin spirales:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    Primitive an="1=90;2=60;3=45;4=22.5;5=15";
    Turtle.Speed=10;
    GraphicsWindow.Width=800;
    GraphicsWindow.Height=800;
    GraphicsWindow.BackgroundColor="teal";
    GraphicsWindow.PenColor="lime";
    GraphicsWindow.PenWidth=1;
    while (true){
    for (int n=1;n<6;n++){
        Turtle.X=400;
        Turtle.Y=400;
    double a=40*Math.Power(.5,n-1);
    for (int t=0;t<130;t++){
        Turtle.Turn(an[n]+1.5); Turtle.Move(a);
        a=a*1.025;
    }
    Program.Delay(3333);
    GraphicsWindow.Clear();
    }}

    Thursday, September 21, 2017 4:57 PM
  • This is a sample of Timer event.  Small Basic sample code is:

    Timer.Interval = 1000 / 6
    Timer.Tick = OnTick
    Sub OnTick
      Turtle.Move(1)
      Turtle.Turn(1)
    EndSub

    Xamarin Workbooks C# sample code is:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    Timer.Interval = 1000 / 6;
    Timer.Tick += OnTick;
    public void OnTick() {
      Turtle.Move(1);
      Turtle.Turn(1);
    }


    Nonki Takahashi


    Friday, September 22, 2017 9:38 AM
    Moderator
  • koch's flake:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    public const int dpp=3; //depth of recursion
    
    string ss="w @1:l 60:w @1:r 120:w @1:l 60:w @1";
    string[] sm=ss.Split(':');
    
    public int di=0;
    Turtle.PenDown();
    Turtle.Speed=10;
    GraphicsWindow.BackgroundColor="Teal";
    GraphicsWindow.PenWidth=1;
    GraphicsWindow.PenColor="white";
    for(int o=0; o<4; o++){
    Turtle.Angle+=90;
    subb(40);
    }
    
    public void subb(double ll){ 
    for (int i=0; i<sm.Count(); i++){
    string smm=sm[i];
    smm=smm.Replace("@1",ll.ToString());
    
    string[] sl=smm.Split(' ');
    double dd=1;
    double.TryParse(sl[1], out dd);
    GraphicsWindow.Title=(Primitive)dd;
    if (sl[0]=="f")
      Turtle.Move (dd);  
    
    if (sl[0]=="r")
      Turtle.Turn (dd);  
    if (sl[0]=="l")
      Turtle.Turn (-dd);
    
      if (sl[0]=="w"){
       if (di<dpp){
           di++;
    subb(ll/2);
    di--;
       }
       else{
    Turtle.Move (dd);  
       }
      }  
    }
    }

    Saturday, September 23, 2017 7:25 AM
  • I uploaded Programming with Small Basic Objects to GitHub to save the revision history. 

    Nonki Takahashi

    Monday, October 2, 2017 10:17 AM
    Moderator
  • xbasic demo: ZKG247

    xbasic will be macro language update for sb, with possibility to convert output to sb and c# and xamarin workbook

    now is interesant option as converting sb to xamarin:

    to convert sb file to xamarin type xx-sb at cmdline and press button "<<< xc" (exec) 

    todo:

    • var declaration
    • for statements (solved now!)
    • if / elseif / switch
    • public and local vars
    • arrays




    • Edited by Tryhest Monday, October 9, 2017 11:33 AM
    Sunday, October 8, 2017 4:05 AM
  • draws round rectangles w shadows and flickr random pics: NFJ409

    usage: click lmb and drag mouse, then click rmb to draw image, or lmb again to cancel draw

    Thursday, October 12, 2017 6:01 PM
  • some update: JDZ875-0

    • conditional goto (goes n times back)
    • arrays( ref. by ^n, not by var names)
    • floor function !
    • if statement (ttt else)
    • substrings (only $$ var)
    • var reset index "]"
    • flickr images Q command
    • more to come soon...))

    syntax is very simple: operator/cmd (1 char only) space(" ") and list of one or more params (space separator)

    if u want to evaluate 2+3/4*5-6 u must write as follows:

    = a 3

    / a 4

    * a 5

    + a 2

    - a 6

    or if u ommit a:

    = 3

    / 4

    * 5

    + 2

    - 6





    • Edited by Tryhest Friday, October 13, 2017 5:02 PM
    Friday, October 13, 2017 7:13 AM
  • added plot function and turtle:  JDZ875-2

    when using evaluate fnc. "e" be aware to write correct uppercase chars, otherwise it won't work 


    • Edited by Tryhest Saturday, October 14, 2017 9:13 PM
    Friday, October 13, 2017 6:13 PM
  • turtle xamarin node knitting:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    Turtle.Speed=10;
    for (int mf=0; mf<13; mf++){
    Primitive vl = 5; 
    int ct1 = 0; do {
    Turtle.Turn(vl); Turtle.Move(4);
    vl -= .3;
    ct1++; } while(ct1<=51);
    }

    Tuesday, October 17, 2017 9:29 PM
  • xamarin hipersigns:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    
    GraphicsWindow.BackgroundColor="teal";
    GraphicsWindow.PenWidth =1;
    GraphicsWindow.Height= GraphicsWindow.Width ;
    for (int x=0; x<=200; x+=25){
      GraphicsWindow.PenColor="lime";
      GraphicsWindow.DrawLine (300+x,100, 500, 100+x);
      GraphicsWindow.DrawLine (300-x,100, 100, 100+x);
      GraphicsWindow.DrawLine (300+x,500, 500, 500-x);
      GraphicsWindow.DrawLine (300-x,500, 100, 500-x);
      GraphicsWindow.PenColor="darkblue";
      GraphicsWindow.DrawLine (500-x,300, 300, 300-x);
      GraphicsWindow.DrawLine (100+x,300, 300, 300-x);
      GraphicsWindow.PenColor="black";
      GraphicsWindow.DrawLine (500-x,300, 300, 300+x);
      GraphicsWindow.DrawLine (100+x,300, 300, 300+x);
    }
    GraphicsWindow.Title ="HiperSIGNS";

    Friday, February 16, 2018 8:24 AM