locked
small basic graphic and animations and more (11) RRS feed

All replies

  • speed of light demo:

    GraphicsWindow.BackgroundColor="darkblue"
    GraphicsWindow.BrushColor="blue"
    s=2
    GraphicsWindow.PenWidth=0
    GraphicsWindow.Width=1200
    GraphicsWindow.FillEllipse(10 100 13*s 13*s)
    GraphicsWindow.BrushColor="yellow"
    GraphicsWindow.FillEllipse(10+s*30*13 100+s*5 4*s 4*s)
    GraphicsWindow.BrushColor="orange"
    e=Shapes.AddEllipse(3*s 3*s)
    Shapes.Move(e 10+13*s 100+6*s)
    GraphicsWindow.Title="Earth-Moon Speed of Light Demo"
    While 1=1
      Shapes.Animate(e 10+s*30*13-4*s 100+6*s 1255)
      Program.Delay(1255)
      Shapes.Animate(e 10+s*13 100+6*s 1255)
      Program.Delay(1255)
    EndWhile

    Sunday, January 20, 2019 7:21 PM
  • Nice demo,

    we can extend it from 1.255 light seconds to many light years!

    https://www.youtube.com/watch?v=Iy7NzjCmUf0

    https://www.youtube.com/watch?v=l03_BnPRIKc

    System requirement: The PC has enough energy and Windows is supported for so long.

    Sunday, January 20, 2019 9:57 PM
  • speed of light demo:

    GraphicsWindow.BackgroundColor="darkblue"
    GraphicsWindow.BrushColor="blue"
    s=2
    GraphicsWindow.PenWidth=0
    GraphicsWindow.Width=1200
    GraphicsWindow.FillEllipse(10 100 13*s 13*s)
    GraphicsWindow.BrushColor="yellow"
    GraphicsWindow.FillEllipse(10+s*30*13 100+s*5 4*s 4*s)
    GraphicsWindow.BrushColor="orange"
    e=Shapes.AddEllipse(3*s 3*s)
    Shapes.Move(e 10+13*s 100+6*s)
    GraphicsWindow.Title="Earth-Moon Speed of Light Demo"
    While 1=1
      Shapes.Animate(e 10+s*30*13-4*s 100+6*s 1255)
      Program.Delay(1255)
      Shapes.Animate(e 10+s*13 100+6*s 1255)
      Program.Delay(1255)
    EndWhile


    sb-online adapted: FQL662
    Monday, January 21, 2019 6:30 AM
  • triangles overlap checking:

    GVX631-0

    Saturday, January 26, 2019 4:56 AM
  • LNF080

    text adventure:

    Sunday, January 27, 2019 8:27 AM
  • chat log analytics: TMF953-0

    Thursday, January 31, 2019 5:10 AM
  • XPW795

    puzzlegame

    Saturday, February 9, 2019 3:58 AM
  • shows c++ examples of commands: MLL049

    anyone in new window, selectable&copyable text

    Saturday, February 9, 2019 5:52 AM
  • poem writter:

    nn=Text.GetCharacter(10)
    dn=LDText.Split("first second third four# fif# six# seven# eigh# nine# ten# eleven# twelf#" " ")
    dn=LDText.Replace(dn "#" "th")
    dd="Twelve drummers drumming|Eleven pipers piping|Ten lords a-leaping|Nine ladies dancing|Eight maids a-milking|Seven swans a-swimming|Six geese a-laying|Five golden rings|Four calling birds|Three french hens|Two turtle doves|A partridge in a pear tree."
    dy=LDText.Split(dd "|")
    TextWindow.BackgroundColor="darkblue"
    TextWindow.Clear()
    TextWindow.Title="12 Days of Xmas" 
    
    for q=1 to 12
      ii=ldtext.Replace(" On the % day of Christmas,| My true love gave to me:" "|" nn)
      ii=LDText.Replace(ii "%" dn[q])
      TextWindow.WriteLine(ii)
      for m= 13-q to 12
        TextWindow.WriteLine(" "+dy[m])
      EndFor
      TextWindow.WriteLine("")
    EndFor

    Monday, February 11, 2019 8:22 AM
  • transition from sb and vb.net to sharpdevelop:

    • sharpdevelop is a .net programming environment
    • it includes c#, c++,  f# and vb languages
    • it is opensource alternative to visual studio
    • u can write sb xtension in sd c# or vb mode

    vb bmp xor example:

    Public Partial Class MainForm
        Const xsize = 256
        Dim BMP As New Drawing.Bitmap(xsize, xsize)
        Dim GFX As Graphics = Graphics.FromImage(BMP)
     dim xpicturebox as New picturebox()
        Private Sub Mu_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
            'draw
            xpicturebox.width=300
            xpicturebox.height=300
            xpicturebox.visible=true
            xpicturebox.backcolor=Color.FromName("Blue")
            xpicturebox.left=5
            xpicturebox.top=5
            xpicturebox.borderstyle=1
            Me.Controls.Add(xpicturebox)
            Dim MyGraph As Graphics = Me.CreateGraphics
            Dim nColor As Color
            Dim i, j, cp As Integer
            xPictureBox.Image = BMP
            For i = 0 To xsize - 1
                For j = 0 To xsize - 1
                    cp = i Xor j
                    nColor = Color.FromArgb(cp, 0, cp)
                    BMP.SetPixel(i, j, nColor)
                Next j
            Next i
        End Sub 'Paint
    
    	Public Sub New()
    		Me.InitializeComponent()
    
    	End Sub
    End Class





    • Edited by Tryhest Wednesday, February 13, 2019 7:44 AM
    Wednesday, February 13, 2019 6:41 AM
  • brownian tree

    Imports System.Drawing.Imaging
    Public Partial Class MainForm
      ReadOnly iCanvasColor As Integer = Color.Black.ToArgb
      ReadOnly iSeedColor As Integer = Color.White.ToArgb
      Dim iCanvasWidth As Integer = 0
      Dim iCanvasHeight As Integer = 0
      Dim iPixels() As Integer = Nothing
     
      Private Sub BrownianTree()
        Dim oCanvas As Bitmap = Nothing
        Dim oRandom As New Random(Now.Millisecond)
        Dim oXY As Point = Nothing
        Dim iParticleCount As Integer = 0
        iCanvasWidth = ClientSize.Width
        iCanvasHeight = ClientSize.Height
         oCanvas = New Bitmap(iCanvasWidth, iCanvasHeight, Imaging.PixelFormat.Format24bppRgb)
         Graphics.FromImage(oCanvas).Clear(Color.FromArgb(iCanvasColor))
         iPixels = GetData(oCanvas)
        iParticleCount = CInt(iPixels.Length * 0.1) ' We'll use about 10% of the total number of pixels in the canvas for the particle count.
         iPixels(oRandom.Next(iPixels.Length)) = iSeedColor    ' Set the seed to a random location on the canvas.
         
        For i As Integer = 0 To iParticleCount ' Run through the particles.
          Do     ' Find an open pixel.
            oXY = New Point(oRandom.Next(oCanvas.Width), oRandom.Next(oCanvas.Height))
          Loop While iPixels(oXY.Y * oCanvas.Width + oXY.X) = iSeedColor
          
          While Not CheckAdjacency(oXY)  ' Jitter until the pixel bumps another.
            oXY.X += oRandom.Next(-1, 2)
            oXY.Y += oRandom.Next(-1, 2)
     
            ' Make sure we don't jitter ourselves out of bounds.
            If oXY.X < 0 Then oXY.X = 0 Else If oXY.X >= oCanvas.Width Then oXY.X = oCanvas.Width - 1
            If oXY.Y < 0 Then oXY.Y = 0 Else If oXY.Y >= oCanvas.Height Then oXY.Y = oCanvas.Height - 1
          End While
     
          iPixels(oXY.Y * oCanvas.Width + oXY.X) = iSeedColor
           SetData(oCanvas, iPixels)
           BackgroundImage = oCanvas
           me.Invalidate()
           Application.DoEvents()
        Next
         oCanvas.Save("e:\BrownianTree.bmp")
        me.BackgroundImage = oCanvas
      End Sub
      
      Private Function CheckAdjacency(ByVal XY As Point) As Boolean
       ' Check adjacent pixels for an illuminated pixel.
        Dim n As Integer = 0
     
        For y As Integer = -1 To 1       ' Make sure not to drop off the top or bottom of the image.
          If (XY.Y + y < 0) OrElse (XY.Y + y >= iCanvasHeight) Then Continue For
     
          For x As Integer = -1 To 1         ' Make sure not to drop off the left or right of the image.
            If (XY.X + x < 0) OrElse (XY.X + x >= iCanvasWidth) Then Continue For
            If y <> 0 AndAlso x <> 0 Then  ' Don't run the test on the calling pixel.
              n = (XY.Y + y) * iCanvasWidth + (XY.X + x)
              If iPixels(n) = iSeedColor Then Return True
            End If
          Next
        Next
        Return False
     End Function
     
      Private Function GetData(ByVal Map As Bitmap) As Integer()
        Dim oBMPData As BitmapData = Nothing
        Dim oData() As Integer = Nothing
     
        oBMPData = Map.LockBits(New Rectangle(0, 0, Map.Width, Map.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)
         Array.Resize(oData, Map.Width * Map.Height)
         Runtime.InteropServices.Marshal.Copy(oBMPData.Scan0, oData, 0, oData.Length)
         Map.UnlockBits(oBMPData)
         Return oData
      End Function
     
      Private Sub SetData(ByVal Map As Bitmap, ByVal Data As Integer())
         Dim oBMPData As BitmapData = Nothing
         oBMPData = Map.LockBits(New Rectangle(0, 0, Map.Width, Map.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)
         Runtime.InteropServices.Marshal.Copy(Data, 0, oBMPData.Scan0, Data.Length)
         Map.UnlockBits(oBMPData)
       End Sub
     
    	Public Sub New()
    		Me.InitializeComponent()
    	End Sub
    	
    	  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DoubleBuffered = True
        BackgroundImageLayout = ImageLayout.Center
        me.Show()
        BrownianTree()
      End Sub
    End Class

    to try it start sd and select new solution then select vb 

    type a solution name!


    replace all the default code with upper written one

    then press play to start and enjoy slowly drawing...

    • Edited by Tryhest Wednesday, February 13, 2019 7:19 AM
    Wednesday, February 13, 2019 7:08 AM
  • if u select c# project then u have also a nice built-in form designer:

    Wednesday, February 13, 2019 7:26 AM
  • also u can build a drawing app in seconds!

    just select wpf app and add an inkcanvas control,

    press play and enjoy drawing!

    Wednesday, February 13, 2019 7:37 AM
  • this creates a nice 3d sliderviewer:

    <Window x:Class="WPF3DGraphics1.Window1"
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:d = "http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006" 
       xmlns:local = "clr-namespace:WPF3DGraphics1" 
        Title = "MainWindow" Height = "350" Width = "525"> 
    	
       <Grid>
          <Viewport3D Name="viewport3D1">
    		
             <Viewport3D.Camera> 
                <PerspectiveCamera x:Name = "camMain" Position = "6 5 4" LookDirection = "-6 -5 -4"> 
                </PerspectiveCamera> 
             </Viewport3D.Camera>
    		
             <ModelVisual3D> 
                <ModelVisual3D.Content> 
                   <DirectionalLight x:Name = "dirLightMain" Direction = "-1,-1,-1"> 
                   </DirectionalLight> 
                </ModelVisual3D.Content> 
             </ModelVisual3D>
    		
             <ModelVisual3D x:Name = "MyModel"> 
                <ModelVisual3D.Content> 
                   <GeometryModel3D>
    				
                      <GeometryModel3D.Geometry>
                         <MeshGeometry3D x:Name = "meshMain"
                            Positions = "0 0 0  1 0 0  0 1 0  1 1 0  0 0 1  1 0 1  0 1 1  0 1 1"  
                            TriangleIndices = "2 3 1  3 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0
                            2 0 4  2 7 3  2 6 7  0 1 5  0 5 4"> 
                         </MeshGeometry3D> 
                      </GeometryModel3D.Geometry> 
    					
                      <GeometryModel3D.Material> 
                         <DiffuseMaterial x:Name = "matDiffuseMain">
                            <DiffuseMaterial.Brush> 
                               <SolidColorBrush Color = "Bisque"/> 
                            </DiffuseMaterial.Brush> 
                         </DiffuseMaterial> 
                      </GeometryModel3D.Material> 
    					
                   </GeometryModel3D>
                </ModelVisual3D.Content>
    			 
                <ModelVisual3D.Transform>                         
                   <RotateTransform3D> 
                      <RotateTransform3D.Rotation> 
                         <AxisAngleRotation3D x:Name = "rotate" Axis = "1 2 1"/> 
                      </RotateTransform3D.Rotation> 
                   </RotateTransform3D>
                </ModelVisual3D.Transform> 
    			 
             </ModelVisual3D> 
          </Viewport3D>
    		
          <Slider Height = "23" HorizontalAlignment = "Left"  
             Margin = "145,271,0,0" Name = "slider1" 
             VerticalAlignment = "Top" Width = "269"  
             Maximum = "360" 
             Value = "{Binding ElementName = rotate, Path=Angle}" /> 
    			
       </Grid> 
    </Window>

    start a new c# wpf solution and name it WPF3DGraphics1

    then paste all code to window1.xaml

    Wednesday, February 13, 2019 8:02 AM
  • iban check: CPL667

    Saturday, February 16, 2019 4:58 AM
  • honeycombs WPF

    make new c# wpf named hnycc1
    xaml part:

    <?xml version="1.0" encoding="utf-8"?>
    <Window x:Class="hnycc1.Window1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Honeycomb" Height="400" Width="300" Loaded="Window_Loaded" ResizeMode="NoResize">
        <Grid x:Name="Main" Margin="5,5,5,0">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="69.6"/>
            </Grid.RowDefinitions>
            <TextBlock x:Name="Letters" HorizontalAlignment="Center" TextWrapping="Wrap" Grid.Row="1" VerticalAlignment="Center" FontSize="20"/>
            <Canvas x:Name="HoneycombCanvas" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Grid>
    </Window>

    c# part

    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Shapes;
    using System.Windows.Media;
    using System.Windows.Controls;
    using System.Linq;
    using System.Windows;
    using System.Windows.Input;
    
    namespace hnycc1
    {
    
    	public partial class Window1 : Window
    	{
    		public Window1()
    		{
    		  if (RowCount * ColCount > 26)
    #pragma warning disable 162
                {
                    throw new ArgumentException("Too many cells");
                }
    #pragma warning restore 162
                _permutedChars = GetPermutedChars(RowCount * ColCount);
     
    			InitializeComponent();
    		}
    
            private const int RowCount = 4;
            private const int ColCount = 5;
            private const int LabelSize = 20;
            private readonly char[] _permutedChars;
     
            private static char[] GetPermutedChars(int characterCount)
            {
                const string allChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
                var rnd = new Random();
                var chars = new char[allChars.Length];
     
                for (int i = 0; i < allChars.Length; i++)
                {
                    chars[i] = allChars[i];
                }
     
                for (int i = 0; i < characterCount; i++)
                {
                    int swapIndex = rnd.Next() % (allChars.Length - i);
                    char tmp = chars[swapIndex + i];
                    chars[swapIndex + i] = chars[i];
                    chars[i] = tmp;
                }
                return chars;
            }
     
            private void SetHexProperties(UIElementCollection hexes, double cellSize)
            {
                int charIndex = 0;
                List<Polygon> hexList = hexes.Cast<Polygon>().ToList();
     
                foreach (Polygon element in hexList)
                {
                    SetHexProperties(element, _permutedChars[charIndex++], cellSize);
                }
            }
     
            private void SetHexProperties(Polygon hex, char charToSet, double cellSize)
            {
                var tag = (Tuple<int, int, double, double>) hex.Tag;
                double cellX = tag.Item3;
                double cellY = tag.Item4;
    
                var centeringGrid = new Grid();
                centeringGrid.Width = centeringGrid.Height = 2 * cellSize;
                centeringGrid.SetValue(Canvas.LeftProperty, cellX - cellSize);
                centeringGrid.SetValue(Canvas.TopProperty, cellY - cellSize);
                centeringGrid.IsHitTestVisible = false;
                HoneycombCanvas.Children.Add(centeringGrid);
     
                var label = new TextBlock
                    {
                        Text = new string(charToSet, 1),
                        FontFamily = new FontFamily("Segoe"),
                        FontSize = LabelSize
                    };
                label.HorizontalAlignment = HorizontalAlignment.Center;
                label.VerticalAlignment = VerticalAlignment.Center;
                label.IsHitTestVisible = false;
                centeringGrid.Children.Add(label);
     
                // Reset the tag to keep track of the character in the hex
                hex.Tag = charToSet;
                hex.Fill = new SolidColorBrush(Colors.Yellow);
                hex.Stroke = new SolidColorBrush(Colors.Black);
                hex.StrokeThickness = cellSize / 10;
     
                // Mouse down event handler for the hex
                hex.MouseDown += hex_MouseDown;
            }
     
            private void hex_MouseDown(object sender, MouseButtonEventArgs e)
            {
                var hex = sender as Shape;
                if (hex == null)
                {
                    throw new InvalidCastException("Non-shape in Honeycomb");
                }
     
                var ch = (char) hex.Tag;
                Letters.Text = Letters.Text + ch;
                hex.Fill = new SolidColorBrush(Colors.Magenta);
     
                // Remove the mouse down event handler so we won't hit on this hex again
                hex.MouseDown -= hex_MouseDown;
            }
     
            private static void GetCombSize(double actualHeight, double actualWidth, int columns, int rows,
                                            out double cellSize, out double combHeight, out double combWidth)
            {
                double columnFactor = (3 * columns + 1) / 2.0;
                double rowFactor = (Math.Sqrt(3) * (2 * rows + 1)) / 2.0;
                double cellFromWidth = actualWidth / columnFactor;
                double cellFromHeight = actualHeight / rowFactor;
                cellSize = Math.Min(cellFromWidth, cellFromHeight);
                combWidth = cellSize * columnFactor;
                combHeight = cellSize * rowFactor;
            }
     
            private static void AddCells(Canvas canvas, double cellSize, int columns, int rows)
            {
                double rowHeight = cellSize * Math.Sqrt(3) / 2;
     
                for (int row = 0; row < rows; row++)
                {
                    AddRow(rowHeight, canvas, cellSize, columns, row);
                    rowHeight += cellSize * Math.Sqrt(3);
                }
            }
     
            private static void AddRow(double rowHeight, Canvas canvas, double cellSize, int columnCount, int row)
            {
                double cellX = cellSize;
                double cellHeight = cellSize * Math.Sqrt(3);
     
                for (int col = 0; col < columnCount; col++)
                {
                    double cellY = rowHeight + ((col & 1) == 1 ? cellHeight / 2 : 0);
                    Polygon hex = GetCenteredHex(cellSize, cellX, cellY, cellHeight);
                    hex.Tag = Tuple.Create(col, row, cellX, cellY);
                    canvas.Children.Add(hex);
                    cellX += 3 * cellSize / 2;
                }
            }
     
            private static Polygon GetCenteredHex(double cellSize, double cellX, double cellY, double cellHeight)
            {
                var hex = new Polygon();
                hex.Points.Add(new Point(cellX - cellSize, cellY));
                hex.Points.Add(new Point(cellX - cellSize / 2, cellY + cellHeight / 2));
                hex.Points.Add(new Point(cellX + cellSize / 2, cellY + cellHeight / 2));
                hex.Points.Add(new Point(cellX + cellSize, cellY));
                hex.Points.Add(new Point(cellX + cellSize / 2, cellY - cellHeight / 2));
                hex.Points.Add(new Point(cellX - cellSize / 2, cellY - cellHeight / 2));
                return hex;
            }
     
            public void Window_Loaded(object sender, RoutedEventArgs e)
            {
                double combHeight, combWidth, cellSize;
                GetCombSize(this.ActualHeight, this.ActualWidth, ColCount, RowCount, out cellSize, out combHeight,
                            out combWidth);
    
                HoneycombCanvas.Width = combWidth;
                HoneycombCanvas.Height = combHeight;
                AddCells(HoneycombCanvas, cellSize, ColCount, RowCount);
                SetHexProperties(HoneycombCanvas.Children, cellSize);
            }
        }
    }



    • Edited by Tryhest Saturday, February 16, 2019 11:42 PM
    Saturday, February 16, 2019 11:36 PM
  • Langton's ant:

    fieldsize =100
    x =fieldsize /2
    y =fieldsize /2
    d =0
    s3=5
    cll[0]="white"
    cll[1]="darkblue"
    for f=1 to 2000
    If field[x][y]=0 Then
      field[x][y]=1
      d =d-1
    Else
      field[x][y]=0
      d =d+1
    EndIf
    
    GraphicsWindow.BrushColor=cll[field[x][y]]
    GraphicsWindow.FillRectangle (x *s3,y *s3, s3, s3)
    d =Math.Remainder(d+4, 4)
    
    If d= 0 Then
      y =y+1
    ElseIf d= 1 Then
      x =x+1
    ElseIf d= 2 Then
      y =y-1
    ElseIf d= 3 Then
      x =x-1
    EndIf
    
    endfor

    suiable for sb online, but takes a while to draw

    Tuesday, February 19, 2019 6:34 AM
  • sb editor v0.2: NCJ956-0

    • iconset form superbasic 2
    • can open multiple files
    • can import desktop sb code

    iconset:

    result:

    Thursday, February 21, 2019 8:34 AM
  • update to select font: HDG846

    press cut to assign font and color to selected text

    Thursday, February 21, 2019 5:42 PM
  • added transparency, rightclickmenu, many updates: ZHB707

    Friday, February 22, 2019 5:30 AM
  • game 2048 for c# sd

    using System;
    
    namespace gm2048
    {
    	
    	
        internal class Tile
        {
            public Tile()
            {
                Value = 0;
                IsBlocked = false;
            }
     
            public int Value { get; set; }
            public bool IsBlocked { get; set; }
        }
     
        internal enum MoveDirection
        {
            Up,
            Down,
            Left,
            Right
        }
     
           internal class G2048
        {
            public G2048()
            {
                _isDone = false;
                _isWon = false;
                _isMoved = true;
                _score = 0;
                InitializeBoard();
            }
     
            private void InitializeBoard()
            {
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        _board[x, y] = new Tile();
                    }
                }
            }
     
            private bool _isDone;
            private bool _isWon;
            private bool _isMoved;
            private int _score;
            private readonly Tile[,] _board = new Tile[4, 4];
            private readonly Random _rand = new Random();
     
            public void Loop()
            {
                AddTile();
                while (true)
                {
                    if (_isMoved)
                    {
                        AddTile();
                    }
     
                    DrawBoard();
                    if (_isDone)
                    {
                        break;
                    }
     
                    WaitKey();
                }
     
                string endMessage = _isWon ? "You've made it!" : "Game Over!";
                Console.WriteLine(endMessage);
            }
     
            private void DrawBoard()
            {
                Console.Clear();
                Console.WriteLine("Score: " + _score + "\n");
                for (int y = 0; y < 4; y++)
                {
                    Console.WriteLine("+------+------+------+------+");
                    Console.Write("| ");
                    for (int x = 0; x < 4; x++)
                    {
                        if (_board[x, y].Value == 0)
                        {
                            const string empty = " ";
                            Console.Write(empty.PadRight(4));
                        }
                        else
                        {
                            Console.Write(_board[x, y].Value.ToString().PadRight(4));
                        }
     
                        Console.Write(" | ");
                    }
     
                    Console.WriteLine();
                }
     
                Console.WriteLine("+------+------+------+------+\n\n");
            }
     
            private void WaitKey()
            {
                _isMoved = false;
                Console.WriteLine("(W) Up (S) Down (A) Left (D) Right");
                char input;
                char.TryParse(Console.ReadKey().Key.ToString(), out input);
     
                switch (input)
                {
                    case 'W':
                        Move(MoveDirection.Up);
                        break;
                    case 'A':
                        Move(MoveDirection.Left);
                        break;
                    case 'S':
                        Move(MoveDirection.Down);
                        break;
                    case 'D':
                        Move(MoveDirection.Right);
                        break;
                }
     
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        _board[x, y].IsBlocked = false;
                    }
                }
            }
     
            private void AddTile()
            {
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        if (_board[x, y].Value != 0) continue;
                        int a, b;
                        do
                        {
                            a = _rand.Next(0, 4);
                            b = _rand.Next(0, 4);
                        } while (_board[a, b].Value != 0);
     
                        double r = _rand.NextDouble();
                        _board[a, b].Value = r > 0.89f ? 4 : 2;
     
                        if (CanMove())
                        {
                            return;
                        }
                    }
                }
     
                _isDone = true;
            }
     
            private bool CanMove()
            {
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        if (_board[x, y].Value == 0)
                        {
                            return true;
                        }
                    }
                }
     
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        if (TestAdd(x + 1, y, _board[x, y].Value)
                            || TestAdd(x - 1, y, _board[x, y].Value)
                            || TestAdd(x, y + 1, _board[x, y].Value)
                            || TestAdd(x, y - 1, _board[x, y].Value))
                        {
                            return true;
                        }
                    }
                }
     
                return false;
            }
     
            private bool TestAdd(int x, int y, int value)
            {
                if (x < 0 || x > 3 || y < 0 || y > 3)
                {
                    return false;
                }
     
                return _board[x, y].Value == value;
            }
     
            private void MoveVertically(int x, int y, int d)
            {
                if (_board[x, y + d].Value != 0
                    && _board[x, y + d].Value == _board[x, y].Value
                    && !_board[x, y].IsBlocked
                    && !_board[x, y + d].IsBlocked)
                {
                    _board[x, y].Value = 0;
                    _board[x, y + d].Value *= 2;
                    _score += _board[x, y + d].Value;
                    _board[x, y + d].IsBlocked = true;
                    _isMoved = true;
                }
                else if (_board[x, y + d].Value == 0
                         && _board[x, y].Value != 0)
                {
                    _board[x, y + d].Value = _board[x, y].Value;
                    _board[x, y].Value = 0;
                    _isMoved = true;
                }
     
                if (d > 0)
                {
                    if (y + d < 3)
                    {
                        MoveVertically(x, y + d, 1);
                    }
                }
                else
                {
                    if (y + d > 0)
                    {
                        MoveVertically(x, y + d, -1);
                    }
                }
            }
     
            private void MoveHorizontally(int x, int y, int d)
            {
                if (_board[x + d, y].Value != 0
                    && _board[x + d, y].Value == _board[x, y].Value
                    && !_board[x + d, y].IsBlocked
                    && !_board[x, y].IsBlocked)
                {
                    _board[x, y].Value = 0;
                    _board[x + d, y].Value *= 2;
                    _score += _board[x + d, y].Value;
                    _board[x + d, y].IsBlocked = true;
                    _isMoved = true;
                }
                else if (_board[x + d, y].Value == 0
                         && _board[x, y].Value != 0)
                {
                    _board[x + d, y].Value = _board[x, y].Value;
                    _board[x, y].Value = 0;
                    _isMoved = true;
                }
     
                if (d > 0)
                {
                    if (x + d < 3)
                    {
                        MoveHorizontally(x + d, y, 1);
                    }
                }
                else
                {
                    if (x + d > 0)
                    {
                        MoveHorizontally(x + d, y, -1);
                    }
                }
            }
     
            private void Move(MoveDirection direction)
            {
                switch (direction)
                {
                    case MoveDirection.Up:
                        for (int x = 0; x < 4; x++)
                        {
                            int y = 1;
                            while (y < 4)
                            {
                                if (_board[x, y].Value != 0)
                                {
                                    MoveVertically(x, y, -1);
                                }
     
                                y++;
                            }
                        }
     
                        break;
                    case MoveDirection.Down:
                        for (int x = 0; x < 4; x++)
                        {
                            int y = 2;
                            while (y >= 0)
                            {
                                if (_board[x, y].Value != 0)
                                {
                                    MoveVertically(x, y, 1);
                                }
     
                                y--;
                            }
                        }
     
                        break;
                    case MoveDirection.Left:
                        for (int y = 0; y < 4; y++)
                        {
                            int x = 1;
                            while (x < 4)
                            {
                                if (_board[x, y].Value != 0)
                                {
                                    MoveHorizontally(x, y, -1);
                                }
     
                                x++;
                            }
                        }
     
                        break;
                    case MoveDirection.Right:
                        for (int y = 0; y < 4; y++)
                        {
                            int x = 2;
                            while (x >= 0)
                            {
                                if (_board[x, y].Value != 0)
                                {
                                    MoveHorizontally(x, y, 1);
                                }
     
                                x--;
                            }
                        }
     
                        break;
                }
            }
        }
     
        
        
    	class Program
    	{
    		public static void Main(string[] args)
    		{
    			Console.WriteLine("Hello World!");
    			RunGame();
    			Console.Write("Press any key to continue . . . ");
    			Console.ReadKey(true);
    		}
    		private static void RunGame()
            {
                G2048 game = new G2048();
                game.Loop();
     
                CheckRestart();
            }
     
            private static void CheckRestart()
            {
                Console.WriteLine("(N) New game (P) Exit");
                while (true)
                {
                    char input;
                    char.TryParse(Console.ReadKey().Key.ToString(), out input);
                    switch (input)
                    {
                        case 'N':
                            RunGame();
                            break;
                        case 'P':
                            return;
                        default:
                            ClearLastLine();
                            break;
                    }
                }
            }
     
            private static void ClearLastLine()
            {
                Console.SetCursorPosition(0, Console.CursorTop);
                Console.Write(new string(' ', Console.BufferWidth));
                Console.SetCursorPosition(0, Console.CursorTop - 1);
            }
    	}
    }

    start new console c# app and name it gm2048. then replace all code with uplisted.

    Sunday, February 24, 2019 7:05 AM
  • Tryhest,

    Your IBAN check program CPL667 failed to validate my Dutch IBAN (landcode NL). After testing other Dutch IBANs I found they all failed. This is caused by the length of our IBAN (18 chars). After expansion of the non-numeric chars the length becomes 24 digits. In the loop "If start < length" the last (24th digit) is not added to variable r.

    If I change the condition to "If start <= length all goes well.


    Jan [ WhTurner ] The Netherlands

    Tuesday, February 26, 2019 1:26 PM
    Answerer
  • thanks. must be due to different sb and c# matrix index handling (1..n vs 0..n-1)
    Sunday, March 3, 2019 6:46 AM
  • c# sd turtle demo

    using Nakov.TurtleGraphics;
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    namespace turrnak
    {
    	public partial class MainForm : Form
    	{
    		public MainForm()
    		{
    			InitializeComponent();
    		}
    		void Button1Click(object sender, EventArgs e)
    		{
    			Turtle.Delay = 100;
    			Turtle.PenColor = Color.Red;
    			for (int i = 0; i < 24; i++) {
    				Turtle.Forward(i * 10 + 5);
    				Turtle.Rotate(120);
    			}
    		}
    	}
    }
    

    Sunday, March 3, 2019 6:48 AM
  • to try the turtle is a bit complex task:

    1. get nuget for winx86 on https://www.nuget.org/downloads 
    2. go to powershell or cmdprompt
    3. switch to downloads dir
    4. type .\nuget list nakov to list all of nakov's apps
    5. type .\nuget install Nakov.TurtleGraphics
    6. close ps or cmdprompt and go to sd ide
    7. start new c# project of windows app and name it turrnak
    8. go to references panel and rightclick add reference
    9. go to .net assemb. browser and click browse and reference to Nakov.TurtleGraphics.dll from dowloads folder
    10. go to design panel and add a button
    11. replace all the code in source pannel with upper code
    12. click play
    Sunday, March 3, 2019 7:16 AM
  • rnd biasing and gnome sort demo: KRM033

    the random function is not random at all. in this demo we can increase the randomness by 3 modifications:

    • involving timer
    • involving 3-levels of randomness (rnd(rnd(rnd(x)))
    • variating timer intervals

    the more wide the gap gets, more randomness is obtained


    • Edited by Tryhest Tuesday, March 5, 2019 10:36 AM
    Tuesday, March 5, 2019 6:30 AM
  • lottery analitics:

    2,1,1,1,2,1,1,2,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,1,2,2,3,1,1,1,1,1,1,1,1,2,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,2,1,1,1,1,3,1,1,1,2,1,1,1,1,1,2,3,1,1,1,1,2,3,1,2,1,1,2,1,1,2,1,1,1,2,1,1,1,2,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,2,3,2,2,1,1,1,1,1,1,2,1,1,2,1,3,1,2,2,1,1,1,1,1,2,1,1,2,1,1,3,3,3,1,1,1,1,1,4,2,2,1,2,2,1,1,1,1,2,2,2,2,3,1,1,1,1,2,3,1,1,2,1,2,1,2,1,1,1,1,1,1,1,4,1,2,2,1,1,1,4,2,1,1,3,1,2,3,1,2,1,1,1,1,1,1,1,1,1,2,2,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,3,1,1,6,2,3,1,1,1,1,1,1,1,1,1,2,1,3,1,2,1,1,2,1,1,3,1,3,3,1,1,2,3,2,1,1,1,1,1,1,1,1,2,2,1,2,1,1,2,2,1,1,1,1,2,1,1,1,1,1,2,2,1,3,2,1,1,1,2,1,2,3,4,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,2,3,2,1
    3,3,2,3,3,2,3,4,3,3,3,2,2,2,2,2,2,2,3,2,3,2,2,2,3,3,2,2,3,2,2,4,4,6,2,2,5,2,2,3,2,2,3,3,3,2,3,3,5,2,2,2,2,2,2,3,3,2,3,2,3,3,2,4,2,2,3,3,3,2,2,3,2,5,4,2,2,2,2,3,5,3,4,4,2,3,4,2,3,2,2,2,5,2,3,2,3,2,2,4,2,5,5,2,2,2,2,2,2,2,2,2,3,2,2,4,2,2,4,2,2,3,6,4,3,3,2,5,2,2,2,2,3,2,5,3,3,4,4,3,3,3,3,2,2,2,5,2,2,3,2,5,4,5,4,2,2,2,2,3,5,3,3,2,4,3,2,3,2,2,4,3,3,3,4,3,2,2,2,3,4,2,2,3,2,3,2,4,2,2,3,2,2,2,4,5,2,5,3,2,3,2,5,3,2,2,4,2,3,4,3,3,2,2,2,3,3,2,2,2,2,3,3,3,4,2,2,2,2,2,2,2,2,3,2,2,2,2,2,4,3,2,7,4,5,2,2,2,2,2,2,2,4,3,3,3,4,3,3,2,2,3,3,2,4,3,4,4,2,2,5,4,3,4,2,2,3,2,2,2,2,4,4,3,3,2,2,4,3,2,2,2,2,3,2,5,3,2,2,3,3,2,4,3,2,2,3,3,2,3,4,6,2,2,4,3,2,4,2,2,2,2,2,2,2,2,4,3,3,2,2,4,4,3,2
    4,6,3,4,4,3,4,5,4,4,5,5,3,3,4,3,3,3,4,4,4,3,3,3,5,4,4,3,5,3,3,5,5,7,3,4,7,3,4,4,3,3,4,4,4,3,5,4,6,3,4,4,3,4,3,5,5,3,4,3,4,5,3,6,3,3,6,4,4,6,3,4,3,6,5,5,3,4,3,4,6,4,5,5,4,4,5,3,4,4,5,3,6,4,4,3,4,3,4,5,3,6,6,3,3,3,4,3,3,3,3,3,4,3,4,5,3,5,5,3,3,4,7,5,4,4,4,6,4,3,5,4,4,3,6,4,4,5,5,5,5,4,5,4,3,3,6,3,3,4,4,7,6,7,5,4,4,3,4,4,7,4,5,3,6,4,3,4,3,3,6,5,4,4,5,5,3,3,3,4,7,3,4,4,3,4,3,5,4,3,4,3,3,5,5,6,3,6,5,3,4,3,6,4,3,3,6,3,5,5,4,4,4,3,3,4,5,3,3,4,3,4,5,4,5,3,3,4,4,3,3,4,3,4,4,3,3,4,3,5,4,5,9,5,6,3,3,3,4,3,3,4,5,4,4,4,5,4,4,3,3,4,6,3,5,5,5,6,3,5,6,7,4,5,6,5,4,3,3,3,3,5,5,4,4,4,4,5,4,5,6,3,3,4,5,6,4,3,3,5,4,3,5,4,5,3,4,5,3,4,5,7,3,3,5,4,3,5,3,3,3,4,3,3,4,3,5,4,4,3,3,5,5,4,5
    5,7,4,7,6,4,5,7,5,5,6,7,5,4,5,4,4,4,6,5,7,4,4,4,6,5,6,4,6,4,5,6,6,8,6,6,8,4,5,5,4,5,6,5,5,4,6,5,7,4,5,6,4,7,4,6,6,4,6,6,5,6,4,8,4,4,7,6,5,8,4,5,4,7,8,6,4,6,4,5,9,6,6,6,6,6,6,4,5,5,7,4,7,5,5,4,5,5,6,7,4,7,7,4,4,4,5,4,4,4,4,4,5,4,6,7,4,6,7,5,6,5,8,6,5,5,5,7,5,4,7,7,7,4,7,5,5,7,6,6,6,5,6,5,4,4,9,7,4,5,5,8,7,8,6,5,6,5,7,5,8,5,6,5,7,5,4,5,4,4,7,7,5,6,9,6,4,4,5,6,8,5,6,5,5,6,4,7,5,4,5,5,4,7,9,7,4,8,6,8,5,5,7,5,4,4,7,4,8,6,5,6,5,4,4,5,6,4,5,6,7,6,6,6,6,4,4,6,5,4,5,5,4,5,5,7,4,6,4,6,5,6,11,6,8,4,5,4,5,4,4,5,6,5,6,6,6,5,6,5,6,6,7,6,6,6,6,8,4,6,7,8,5,6,7,6,5,4,4,4,4,6,6,8,5,5,5,6,5,7,7,4,4,6,6,7,6,4,4,6,6,5,6,6,6,4,5,6,5,5,6,8,5,4,8,5,4,6,5,6,4,6,4,4,5,4,7,5,5,5,4,6,6,5,6
    7,8,5,8,7,6,7,8,6,7,7,8,7,5,7,7,6,5,7,6,8,5,6,5,7,7,7,5,11,5,6,9,7,9,7,7,9,6,8,6,5,6,7,6,6,5,7,6,8,5,7,8,5,8,9,8,7,6,9,7,7,8,6,9,5,7,9,8,7,9,5,7,6,8,9,7,5,7,5,6,10,7,7,8,7,7,7,9,7,6,8,5,8,7,6,5,7,6,7,8,6,8,8,8,5,6,6,5,5,8,5,5,6,5,8,8,5,7,8,7,7,6,9,8,6,6,6,8,7,5,9,8,8,6,9,6,6,8,8,7,7,6,7,6,5,7,10,8,5,6,6,9,9,10,7,6,7,6,8,9,9,6,7,6,8,6,6,6,5,6,8,9,7,8,11,7,5,7,7,7,9,6,7,8,7,7,5,8,6,5,8,6,5,8,12,9,5,11,7,10,6,6,8,6,5,5,8,5,9,7,6,7,6,5,6,6,7,6,7,7,10,7,7,8,7,5,5,8,7,5,6,6,5,6,9,8,5,7,5,8,6,7,12,7,9,5,6,5,6,7,7,7,7,6,7,9,7,6,9,6,7,8,8,7,7,7,7,10,5,7,9,9,6,8,8,8,7,5,5,6,5,7,7,9,6,7,6,8,6,8,9,6,5,9,7,8,7,5,5,7,7,7,8,7,8,5,6,7,7,6,7,9,7,5,9,6,5,7,6,7,5,8,5,5,6,5,8,6,8,7,6,7,7,6,7
    8,10,6,9,8,9,8,9,7,8,12,10,9,7,8,8,7,9,8,7,9,7,7,6,8,8,9,6,13,8,10,10,8,12,8,8,12,7,9,7,7,7,8,7,9,6,8,7,9,6,8,9,6,9,10,9,8,7,10,8,8,11,7,10,6,8,10,9,10,10,6,8,7,10,10,8,6,9,6,8,11,8,8,9,9,8,8,10,8,7,9,7,9,8,7,7,8,7,8,9,7,10,9,9,8,7,8,6,6,9,7,6,7,6,10,9,6,8,9,8,8,7,10,9,7,8,7,9,8,6,10,11,9,7,10,8,9,9,9,8,8,8,8,7,6,9,11,9,6,7,7,10,10,11,8,7,8,7,9,11,10,8,8,7,10,7,7,8,6,7,10,11,8,9,12,8,6,8,8,8,10,8,8,10,8,10,6,9,8,6,9,7,6,9,13,11,6,14,8,11,7,7,9,7,6,6,9,6,10,8,7,9,7,6,8,7,8,7,8,9,11,8,8,11,9,11,6,10,8,6,7,7,6,7,12,12,6,9,6,9,8,8,13,8,10,6,7,6,7,8,9,9,8,7,8,10,8,7,10,7,8,9,9,8,8,8,8,11,6,10,11,10,7,9,9,9,8,6,6,7,6,9,9,10,9,8,7,9,9,9,11,7,6,10,8,9,8,6,6,8,8,8,9,9,9,8,7,8,8,7,8,10,9,7,11,9,6,8,8,9,6,9,6,6,7,6,9,7,9,8,8,8,8,7,8
    10,11,7,12,9,10,10,10,9,9,14,11,10,8,9,9,8,10,9,8,10,9,8,7,9,9,10,7,14,9,12,11,9,13,10,10,14,10,10,9,9,8,11,9,10,7,9,8,11,7,9,10,8,10,11,10,12,8,11,9,9,13,8,11,9,10,11,10,11,11,7,9,9,11,12,10,8,10,7,9,12,9,9,10,10,9,9,11,9,8,10,8,10,10,9,8,9,8,10,10,8,11,10,10,11,10,10,8,7,11,8,8,8,7,12,10,7,9,10,9,9,10,11,10,10,9,8,10,9,7,12,12,10,8,11,9,10,10,11,9,9,9,9,8,7,10,13,10,7,8,8,11,11,12,10,10,9,10,10,12,11,9,13,8,11,8,8,9,7,8,11,14,10,10,14,9,7,9,9,9,11,10,9,12,11,11,7,10,9,7,10,9,7,10,14,12,7,15,9,12,8,8,10,8,9,9,10,7,11,9,9,10,8,9,9,8,9,8,9,11,12,9,9,12,10,12,7,11,9,7,8,10,8,10,14,13,7,10,7,10,10,10,14,10,11,7,8,7,10,9,10,11,10,8,10,12,9,9,13,11,10,10,10,9,10,10,9,12,8,11,12,11,10,11,10,10,9,7,7,8,7,10,10,11,10,9,8,10,11,10,12,8,7,11,11,12,9,7,7,9,9,9,10,10,10,9,9,9,9,8,9,15,10,8,12,10,7,12,9,11,7,10,7,7,9,9,10,8,10,9,9,10,9,8,9
    12,13,9,13,12,11,12,11,10,10,15,12,11,9,10,10,10,11,10,10,11,12,10,9,10,10,12,8,15,10,13,12,11,14,11,13,15,12,12,10,10,10,12,10,11,8,10,9,14,11,13,11,9,11,12,11,13,10,12,10,11,14,10,12,10,11,12,11,13,12,8,10,10,12,16,12,9,12,8,10,13,12,11,11,11,11,10,12,10,10,11,9,11,14,10,9,10,10,11,11,11,12,12,11,12,12,11,11,8,13,9,10,10,10,14,11,8,10,11,12,10,11,12,11,12,10,9,11,11,9,13,14,11,9,12,11,11,12,12,10,11,10,10,9,8,11,14,11,8,9,10,12,12,14,12,12,10,11,11,13,12,10,14,9,12,9,10,10,8,9,12,16,11,11,15,10,10,10,10,10,12,11,12,13,13,12,9,11,10,8,12,10,9,11,18,13,8,17,11,13,9,9,12,9,10,10,11,9,12,10,11,11,10,10,10,10,10,9,10,12,13,10,10,13,11,13,9,12,10,8,9,11,9,12,15,14,8,11,8,11,11,11,15,12,15,8,10,8,12,10,11,12,11,11,11,13,10,11,14,12,11,11,12,11,11,11,10,13,9,13,13,12,11,12,13,11,12,10,10,9,8,11,11,13,12,11,9,13,12,12,14,9,8,12,12,13,10,8,8,10,12,13,11,11,12,10,10,11,12,9,10,16,13,11,13,11,9,13,11,13,10,11,8,8,10,10,11,9,15,10,11,11,10,9,10
    15,14,11,15,13,12,13,12,11,11,16,13,12,10,11,11,11,12,11,12,12,14,11,11,11,11,14,9,16,11,14,13,12,15,12,14,16,13,14,11,11,11,14,12,12,10,11,10,15,12,14,13,10,12,13,12,14,11,14,12,13,16,12,13,11,12,13,12,14,13,10,12,11,13,17,13,11,14,11,11,14,13,12,12,12,12,12,13,11,11,13,10,12,15,12,12,13,11,12,12,12,13,14,12,13,13,13,13,9,14,10,11,12,11,15,13,9,11,12,14,11,13,13,12,13,11,10,12,12,11,14,15,12,11,13,12,14,13,14,12,13,12,11,10,10,12,15,12,12,10,11,13,13,15,13,13,12,12,12,14,15,11,15,11,15,10,11,11,11,10,13,17,12,13,16,12,11,13,11,12,13,12,13,14,14,13,11,12,11,9,13,11,10,12,20,15,10,18,12,15,12,11,14,10,11,11,16,10,13,11,12,12,13,13,11,12,11,10,11,13,14,11,11,15,13,14,11,14,11,10,10,12,10,13,16,15,9,12,9,12,13,12,16,13,16,9,11,10,13,11,12,13,13,12,13,15,11,12,15,13,12,12,13,16,12,12,11,14,10,14,14,14,12,13,14,13,13,11,11,11,9,13,12,15,13,12,10,17,13,13,15,10,9,13,13,16,11,9,10,11,13,14,12,12,14,12,12,15,13,10,11,17,15,14,14,12,10,14,12,14,11,12,9,9,11,12,12,10,16,11,12,14,11,10,15
    16,15,12,16,15,14,14,14,12,14,17,14,13,13,13,13,12,13,12,13,15,15,13,12,13,12,15,10,17,12,15,14,13,16,14,15,17,14,15,12,13,12,15,13,14,14,12,11,16,13,15,14,11,13,14,13,15,12,15,13,14,17,13,15,12,13,16,13,15,14,12,13,12,14,18,14,12,16,12,13,15,14,13,13,13,13,13,14,13,12,14,12,13,16,13,13,16,13,13,14,13,15,15,13,16,14,16,15,10,16,11,13,13,12,17,16,11,13,14,15,13,14,14,13,14,12,11,13,13,14,15,16,13,12,15,13,15,14,16,13,14,13,12,11,12,14,16,13,13,11,14,14,14,17,15,14,14,13,14,16,17,12,16,14,16,11,12,14,12,11,17,18,13,15,17,15,13,15,12,13,14,13,14,15,15,14,12,13,12,10,14,12,12,13,21,16,12,19,13,16,15,12,16,11,12,12,17,13,14,12,13,13,15,15,13,13,12,11,12,15,15,12,13,16,14,15,13,15,13,11,11,13,12,15,19,16,11,13,11,13,14,13,18,14,17,10,12,11,14,13,13,14,14,14,15,17,12,13,16,14,13,13,14,18,13,13,12,15,11,15,15,15,13,15,15,14,14,15,13,12,10,14,14,16,15,13,11,18,15,14,17,11,10,14,14,17,12,12,11,12,14,15,14,14,15,13,13,16,14,11,12,19,16,15,16,13,11,17,13,16,14,13,10,10,12,13,13,11,17,13,14,15,13,12,16
    18,16,14,17,16,15,15,15,13,16,19,15,14,14,14,14,13,15,13,15,17,17,14,13,14,13,17,11,18,13,17,15,15,17,15,16,18,15,17,14,15,15,16,14,15,16,13,12,18,14,16,16,15,14,15,14,16,13,16,14,16,18,14,16,13,15,17,14,16,15,14,14,13,15,19,15,13,17,13,15,16,15,14,14,14,14,15,15,14,13,15,13,14,17,15,14,17,14,14,15,14,16,16,14,17,15,17,16,13,17,12,14,14,14,18,18,12,14,15,16,14,15,15,14,15,13,12,14,16,15,16,17,14,13,16,14,16,15,17,14,15,14,13,12,13,15,17,14,14,12,15,17,15,18,18,16,15,14,15,18,18,13,17,15,17,12,14,16,13,12,19,19,14,16,18,16,14,16,13,14,15,14,15,16,17,15,13,14,13,11,15,14,13,14,23,18,13,20,14,18,17,13,17,13,13,13,18,14,15,13,14,14,17,16,14,15,14,13,13,17,16,15,15,17,16,18,14,16,14,12,12,14,13,17,20,17,12,14,12,17,15,14,20,15,18,11,13,12,16,14,14,15,15,16,16,18,13,14,17,16,14,15,15,19,14,14,13,16,14,16,16,16,14,16,16,16,15,16,14,14,11,16,15,17,17,14,12,20,16,15,18,12,11,15,17,18,14,13,12,13,15,16,15,15,16,14,14,17,15,12,14,21,17,17,17,15,12,18,15,17,15,15,11,11,13,14,14,14,19,16,16,17,14,14,17
    20,17,15,18,18,16,16,17,14,18,20,17,15,16,15,15,14,16,14,17,18,19,15,14,15,14,18,12,19,14,18,16,16,19,17,17,19,16,18,15,16,17,17,15,16,17,14,13,19,15,18,17,16,15,16,15,17,14,17,15,18,20,16,17,14,16,18,15,17,16,15,16,15,18,21,17,14,18,14,16,18,16,15,15,16,15,16,16,15,15,16,14,15,18,16,15,18,15,15,16,15,18,17,16,19,16,18,17,14,18,13,15,15,15,19,19,13,15,16,17,15,16,16,15,17,15,13,15,18,16,17,18,16,14,18,16,18,16,18,15,17,15,17,13,14,16,18,15,15,13,16,18,16,19,19,17,16,15,16,19,19,14,19,16,19,13,17,17,14,13,20,20,15,17,20,17,15,17,14,15,17,16,16,19,18,17,16,15,14,12,16,16,14,16,24,19,14,21,15,19,19,14,18,14,15,14,19,15,17,15,16,15,18,18,15,16,15,15,14,19,17,16,16,18,17,19,15,18,17,13,13,15,14,19,21,18,14,15,13,18,16,15,21,16,20,14,14,13,17,15,16,16,16,17,17,20,15,15,19,17,16,18,17,20,15,15,14,17,15,18,17,17,16,17,17,17,16,17,17,15,12,19,17,18,18,15,14,21,17,16,20,13,12,18,18,19,16,16,13,14,16,17,18,16,17,15,15,18,16,13,15,22,18,18,18,17,13,19,16,18,16,18,13,12,14,15,15,15,20,17,17,19,15,15,18
    21,21,16,19,19,17,18,18,15,20,21,18,16,17,19,16,15,17,15,20,20,20,16,17,17,16,19,14,20,17,19,17,19,21,20,19,21,19,19,17,17,18,19,17,17,18,15,14,20,16,19,18,17,17,17,16,18,15,18,16,19,21,17,18,15,17,19,16,18,18,16,18,16,19,22,18,17,19,15,17,19,17,16,16,17,16,20,17,16,17,17,15,16,19,17,17,19,17,16,19,16,19,18,17,20,17,19,18,15,20,14,16,16,16,21,20,15,16,17,18,16,18,17,17,18,18,15,17,19,17,18,19,20,15,19,18,19,17,19,16,18,16,20,14,15,17,19,17,16,14,17,19,19,20,20,18,19,17,18,20,20,16,20,17,21,14,19,18,15,14,21,22,17,18,22,18,17,18,15,17,19,18,17,22,20,18,18,16,15,14,19,18,16,18,25,20,16,22,16,20,22,15,19,15,17,17,20,16,19,16,17,19,19,19,16,17,17,17,16,20,18,17,17,19,18,21,16,20,18,15,16,16,15,20,22,21,16,16,14,20,17,16,22,20,22,16,15,15,18,17,17,17,18,18,18,21,16,16,20,18,17,19,18,21,17,17,15,19,16,19,18,19,17,18,18,18,17,18,18,16,14,20,18,19,19,16,15,22,19,18,21,14,13,20,19,20,17,17,14,16,17,18,19,18,18,16,18,20,17,14,16,23,19,19,19,18,15,20,18,19,18,19,14,14,16,16,16,17,21,19,18,20,16,16,20
    23,22,17,22,20,19,19,19,17,21,22,19,18,18,20,17,16,19,16,21,21,24,18,20,19,17,22,15,21,18,20,18,21,22,21,20,22,20,20,18,18,19,20,18,18,19,18,15,22,17,21,19,18,19,18,17,19,17,19,18,20,22,18,19,17,18,20,17,19,19,17,20,19,20,23,19,20,20,16,18,21,18,17,17,20,17,21,18,17,18,18,16,17,20,19,19,20,18,19,20,17,20,19,18,21,18,21,19,16,21,15,17,17,18,22,21,18,18,20,19,17,19,18,19,20,19,16,18,20,18,21,20,21,18,20,20,20,19,21,19,19,17,21,16,16,18,20,19,17,15,18,20,20,21,21,19,20,18,19,21,22,17,21,18,22,15,20,21,16,16,23,23,18,20,23,19,18,19,16,18,21,19,18,23,21,21,19,17,16,15,21,19,17,19,26,21,19,23,17,21,23,16,20,16,18,18,22,17,21,17,19,20,20,20,17,18,19,18,18,21,19,21,19,20,19,23,17,22,19,19,17,17,16,21,23,22,17,17,15,21,18,17,23,21,23,18,18,17,19,18,19,20,20,19,19,22,18,19,21,19,18,20,19,22,18,18,16,21,18,20,19,21,18,20,19,19,18,19,19,18,15,22,19,20,20,17,16,23,20,19,23,15,14,21,20,21,19,20,15,17,18,21,20,19,19,17,19,21,18,15,17,24,22,20,21,19,16,21,19,20,19,20,15,16,17,17,18,20,22,20,19,21,17,17,23
    24,23,20,25,23,20,20,20,19,22,23,20,20,19,21,18,17,21,21,22,22,25,20,23,20,18,23,16,22,19,21,19,22,23,22,21,23,21,22,20,19,21,21,19,20,22,21,16,23,19,22,20,19,20,19,18,21,18,20,20,21,23,19,20,18,19,22,18,20,20,19,21,20,22,25,20,21,23,19,19,23,19,18,18,21,18,22,19,18,19,19,18,22,21,20,20,21,19,20,22,19,21,20,21,22,20,22,20,17,22,18,18,18,19,24,23,19,20,21,22,19,20,19,20,21,22,17,20,21,19,22,22,22,20,21,21,21,20,22,20,20,19,23,17,17,19,21,21,19,18,19,22,23,22,23,20,22,19,20,22,24,18,22,19,23,17,22,23,17,17,24,24,19,21,24,20,19,20,18,20,23,20,19,24,23,22,20,18,19,16,22,20,18,20,27,22,20,24,18,22,24,18,21,18,20,20,23,19,22,19,21,22,21,21,18,19,20,19,19,24,21,22,20,21,20,24,20,23,20,20,18,18,18,22,24,23,18,19,17,22,19,18,24,22,24,22,19,18,20,19,20,21,21,20,21,24,19,20,22,20,19,21,20,23,20,19,17,22,19,21,20,22,19,22,21,20,19,20,21,19,17,24,20,21,21,18,17,24,21,20,24,17,15,23,21,22,20,21,16,18,19,22,24,21,20,18,20,22,19,16,18,25,23,21,22,21,17,22,21,23,20,21,16,17,19,18,19,21,23,21,21,22,20,20,24
    25,24,21,26,24,21,22,21,20,24,26,21,21,21,22,20,18,22,23,23,25,26,21,24,21,21,25,17,23,23,22,20,23,26,23,22,24,22,24,22,20,22,22,20,21,23,23,18,24,20,24,21,20,21,20,20,23,19,21,21,22,24,20,21,19,21,23,19,23,21,20,22,21,23,26,21,23,24,20,22,24,22,19,20,23,21,24,21,20,23,22,19,24,22,22,21,22,20,21,24,20,22,21,22,23,21,23,21,18,23,21,21,19,20,25,24,20,21,23,25,20,22,20,21,23,23,18,23,22,21,23,23,23,21,23,23,22,23,23,21,21,20,25,19,19,21,22,22,20,19,20,23,24,23,24,21,23,21,21,23,25,19,23,20,24,18,24,24,19,18,25,25,20,24,25,21,22,22,19,21,24,21,20,25,24,23,22,19,20,17,23,21,19,21,28,23,21,25,20,24,25,20,22,19,21,21,26,20,24,21,22,23,22,22,20,20,24,20,20,26,22,23,21,22,21,25,21,24,21,21,19,19,19,23,25,24,20,20,19,23,20,21,25,23,25,24,20,22,22,20,22,22,23,21,22,25,20,21,23,21,20,22,21,24,21,21,19,23,20,22,21,23,21,23,22,21,20,22,23,20,18,25,21,22,23,22,18,25,23,22,25,18,17,24,22,23,21,22,18,19,21,23,25,23,21,20,21,23,24,18,21,26,24,22,23,23,18,23,22,25,21,23,18,19,20,19,20,22,25,22,22,23,21,21,26
    26,26,22,27,25,22,24,22,21,26,27,22,22,22,24,21,19,25,24,24,26,27,22,26,22,24,27,18,25,24,24,21,26,27,24,25,25,23,25,23,21,23,23,21,22,24,24,19,25,22,26,22,21,23,21,21,24,20,22,22,23,25,21,22,20,24,25,20,24,22,21,24,22,26,27,22,24,26,21,26,25,23,20,23,24,22,25,22,22,25,23,20,25,23,24,22,24,21,22,25,21,23,22,24,24,22,24,22,19,24,23,22,20,21,26,25,21,23,24,26,23,24,21,24,24,24,19,24,23,23,25,24,24,25,24,24,23,24,24,24,23,21,26,22,20,23,23,23,21,20,21,24,25,26,26,23,24,22,22,24,26,24,24,22,25,19,25,26,20,19,27,26,22,25,26,22,24,25,20,23,26,23,21,26,25,24,23,22,22,18,24,22,21,22,29,24,22,26,22,25,27,23,24,21,23,23,27,22,25,23,23,24,23,23,21,21,25,22,22,27,23,24,23,23,23,26,22,25,22,23,20,20,20,24,26,25,24,21,21,24,21,22,26,24,26,25,21,24,23,22,23,24,25,22,23,26,21,22,24,22,24,23,22,25,23,22,20,24,21,23,22,24,22,24,23,23,21,23,24,22,19,27,22,23,24,23,19,26,24,23,26,19,18,25,23,24,23,24,20,20,23,26,26,25,23,21,22,24,25,19,22,27,25,23,24,24,20,24,23,26,23,25,19,20,21,20,21,23,28,23,23,24,22,23,27
    27,27,24,28,27,26,27,23,24,27,30,23,23,23,25,23,20,26,25,26,28,28,23,27,23,25,29,20,27,25,25,22,27,29,25,26,27,24,26,24,22,24,24,22,23,26,25,20,26,23,27,23,22,24,22,22,25,23,25,23,24,26,22,23,21,25,26,21,25,23,22,26,24,27,29,23,25,27,22,27,26,24,24,24,25,23,26,23,23,26,25,21,27,24,25,23,26,22,24,26,23,24,23,27,25,23,25,23,20,25,25,23,21,24,27,28,25,24,25,28,24,25,22,25,25,25,21,26,25,26,26,25,25,26,25,25,25,25,25,25,24,22,27,23,21,25,25,25,23,21,22,25,26,29,27,24,25,23,23,25,27,25,25,23,27,20,26,28,21,25,28,27,23,29,28,23,26,26,23,24,29,25,23,28,26,25,24,24,25,19,26,23,22,23,30,26,23,28,23,26,28,24,25,22,24,24,28,26,26,24,25,26,24,24,23,25,26,23,23,28,25,25,24,25,24,27,23,26,24,24,21,23,21,25,27,27,25,23,22,25,22,23,27,25,27,26,22,26,24,23,24,25,26,23,24,27,22,23,27,23,25,25,24,27,24,23,21,25,22,24,23,25,23,25,24,24,22,24,25,23,20,28,23,24,25,25,20,27,25,24,28,20,20,26,25,25,24,26,21,21,24,28,28,26,24,23,23,25,26,20,23,28,26,25,25,25,22,25,24,28,24,26,20,21,22,22,22,25,29,25,24,25,23,24,28
    28,29,25,29,28,27,28,26,26,28,31,25,24,25,26,24,21,27,27,27,29,30,24,28,24,26,30,22,28,26,26,24,29,30,26,27,28,25,27,25,23,25,26,23,24,27,26,21,29,24,28,25,23,25,25,23,26,24,26,24,26,27,23,24,23,26,27,22,27,25,23,27,25,28,31,26,26,28,23,29,31,25,25,26,26,25,27,25,24,27,26,22,29,25,27,25,27,23,25,28,25,26,25,28,26,24,26,25,21,28,26,25,22,25,28,29,26,25,26,29,25,28,25,26,26,27,22,27,26,27,27,26,26,27,28,27,26,27,26,26,25,23,28,24,23,26,27,27,25,24,24,26,27,30,28,25,26,24,24,26,28,26,26,24,28,24,28,29,22,26,30,29,25,30,29,25,27,27,24,25,30,26,24,29,27,26,26,26,26,20,27,24,25,24,31,28,24,29,25,28,29,26,26,23,25,25,29,29,27,26,26,27,27,25,24,26,28,24,24,29,26,27,25,26,26,28,24,27,25,25,22,24,23,26,29,28,26,24,23,26,23,24,28,26,28,27,25,27,27,24,25,26,27,26,25,28,23,24,28,24,26,26,26,28,25,24,23,26,24,26,25,26,24,26,25,25,24,25,26,24,21,29,24,25,26,27,21,30,26,26,29,21,23,27,26,26,25,27,22,22,25,29,29,27,25,24,24,26,27,21,24,29,27,26,26,27,23,26,25,29,27,27,21,23,23,23,23,27,30,27,25,26,24,25,29
    30,30,26,30,29,28,30,28,28,30,32,26,25,26,27,26,22,29,28,28,30,32,25,29,25,28,31,23,29,27,27,25,31,31,28,28,29,26,28,26,24,26,27,24,25,28,27,23,30,25,29,26,24,26,26,24,27,28,27,25,29,28,24,25,24,27,28,24,28,27,25,28,28,29,32,27,27,29,24,30,32,26,27,29,27,26,29,26,26,28,27,23,30,26,32,27,28,26,26,30,28,27,27,29,30,28,27,26,23,29,28,26,23,26,29,30,27,26,27,30,27,29,27,28,28,28,23,28,27,28,28,28,27,28,29,28,27,28,29,27,27,24,29,26,26,27,28,28,26,26,26,27,28,31,29,27,28,25,25,27,30,27,27,25,29,25,30,31,23,27,32,32,26,32,30,26,28,28,25,26,31,27,27,30,28,27,27,27,27,21,29,25,26,25,33,29,25,30,26,29,30,31,27,24,27,26,30,30,28,27,27,28,28,26,26,27,29,25,25,30,27,28,27,27,27,32,25,28,26,26,24,25,24,27,30,29,28,25,24,27,26,25,30,28,29,28,26,28,28,27,26,27,30,28,30,29,25,25,29,25,27,28,27,29,27,26,26,27,25,27,27,27,25,27,27,26,25,27,27,25,24,30,25,28,27,28,22,31,28,27,31,25,25,28,29,29,27,28,24,25,26,30,31,28,26,27,26,27,30,22,25,31,28,29,27,28,24,27,27,31,28,28,22,25,24,24,25,28,31,28,26,27,26,26,30
    34,31,28,32,30,29,31,29,31,31,33,27,28,27,28,27,23,32,29,32,31,33,26,31,26,30,32,24,30,29,29,28,32,32,29,29,30,27,29,28,25,28,29,25,26,29,31,27,31,26,31,27,25,27,27,26,28,29,29,27,30,30,25,27,26,29,29,25,29,29,27,29,29,30,33,28,28,31,25,31,33,28,28,30,28,27,30,27,27,29,29,24,31,27,33,28,30,27,27,31,29,29,28,30,31,29,29,28,24,30,29,28,24,27,30,31,28,27,29,31,28,30,28,29,29,29,24,29,28,29,29,29,29,30,30,29,28,32,30,28,28,26,32,27,27,28,29,29,28,27,27,28,29,32,30,28,29,28,26,28,31,29,28,29,30,27,31,32,25,28,33,33,27,33,31,27,31,29,26,27,32,28,28,31,29,28,28,29,28,22,30,26,28,26,34,30,26,32,27,30,32,33,29,26,29,29,31,31,29,29,28,29,29,27,29,29,31,27,27,31,28,29,28,29,28,33,28,29,27,27,25,26,25,28,31,30,30,28,25,28,27,26,31,29,30,29,27,29,29,29,27,28,31,29,31,30,27,26,30,28,30,29,28,30,28,27,28,28,26,28,28,28,26,28,28,27,26,28,28,26,25,33,26,31,28,29,26,32,30,28,32,26,27,30,30,30,28,29,25,26,28,31,32,30,27,29,28,28,31,23,26,32,29,31,29,29,26,29,29,32,30,29,24,29,27,26,26,29,32,30,27,28,27,28,31
    35,34,29,33,31,30,32,30,32,32,34,28,29,28,29,29,26,33,30,33,32,34,27,32,29,32,33,25,31,30,30,29,33,33,30,30,31,28,30,29,26,29,30,26,27,30,32,28,32,27,32,29,26,32,29,27,29,30,31,28,31,31,27,29,27,30,30,26,30,30,28,32,30,31,34,29,30,32,26,32,34,29,29,31,29,28,31,28,30,30,30,25,32,28,34,30,31,28,30,32,30,30,29,33,32,30,30,29,25,32,30,29,25,29,31,33,29,28,31,32,29,31,29,30,30,31,27,31,29,30,31,30,30,31,31,30,30,33,31,29,29,27,34,28,28,29,30,30,30,28,28,29,30,33,31,30,31,29,28,29,32,32,29,30,31,28,32,34,26,30,34,34,28,34,33,29,32,30,27,30,33,30,29,33,30,29,30,30,29,25,31,28,29,27,35,31,28,33,28,31,33,34,30,29,31,32,32,32,30,30,29,30,30,28,30,30,32,28,28,32,29,30,29,30,30,34,29,30,28,28,26,27,26,29,32,31,31,30,28,29,28,27,32,30,31,30,28,30,30,30,30,30,32,30,32,31,28,27,31,29,31,30,29,31,29,28,29,29,27,31,29,29,28,31,31,30,28,30,29,27,28,34,27,32,30,30,27,33,31,31,33,27,28,31,31,31,29,31,27,28,30,32,33,32,30,30,29,29,32,24,28,34,30,32,30,31,27,31,30,33,31,31,27,30,28,27,28,30,33,31,28,31,29,29,32
    36,35,30,34,32,31,33,31,33,33,35,30,30,29,30,31,27,35,31,34,33,35,30,33,32,33,34,26,32,31,31,30,36,34,31,31,32,30,32,32,27,30,33,27,28,34,33,30,33,28,33,30,29,33,30,29,31,32,32,29,34,32,30,30,29,31,31,28,31,31,29,33,31,32,35,30,31,33,27,33,35,30,31,32,30,29,32,29,32,32,31,27,33,30,35,33,32,30,31,33,31,32,32,35,34,31,32,30,26,33,32,30,29,30,34,34,30,30,34,33,32,33,30,31,31,32,32,33,31,33,32,32,32,32,33,32,32,34,32,31,30,28,35,31,30,32,31,33,31,31,29,30,31,34,32,32,34,31,29,30,33,33,30,31,32,29,33,35,28,32,35,35,31,35,34,30,33,32,30,32,34,31,30,34,31,30,32,31,31,27,32,30,30,28,36,32,29,34,29,32,34,36,31,30,32,33,33,33,32,32,30,31,32,30,31,31,33,29,29,33,30,31,30,33,33,35,30,32,29,30,28,28,27,31,33,32,32,31,29,30,31,28,34,31,32,31,29,33,31,31,31,31,33,31,33,32,29,31,32,31,32,31,30,32,30,29,31,30,28,32,31,30,29,32,33,33,29,31,30,29,29,35,28,35,31,33,28,34,32,32,36,28,29,32,34,32,30,32,28,30,32,34,35,33,31,31,30,30,33,26,30,35,31,33,32,32,29,32,31,34,33,32,28,32,30,28,30,31,34,32,29,32,31,30,33
    37,36,31,35,33,32,34,32,35,34,36,33,32,31,33,32,29,36,32,35,34,37,31,34,34,35,35,29,33,32,32,31,37,35,32,33,34,33,33,34,29,31,34,29,30,35,34,31,34,29,35,31,30,35,31,32,32,33,33,30,35,33,32,32,30,33,32,32,32,32,30,34,33,33,36,34,32,34,28,34,36,31,33,33,31,30,34,31,34,33,34,28,34,33,36,34,33,31,32,34,32,33,33,36,35,32,33,31,27,34,33,31,31,31,35,35,33,31,35,34,33,34,31,32,32,33,33,35,32,34,34,33,33,33,35,34,34,35,33,32,31,31,36,32,31,33,32,34,32,32,30,32,32,35,35,33,35,32,32,33,34,34,31,33,33,31,34,36,29,33,36,36,34,36,35,31,34,34,32,33,35,32,33,35,33,31,33,32,34,29,35,32,31,29,37,34,30,35,31,33,35,37,32,32,33,34,34,34,33,33,32,32,33,33,32,32,34,30,30,35,32,34,31,34,35,36,31,33,30,32,29,30,29,32,34,33,33,32,32,31,32,32,35,33,33,32,30,34,32,32,34,33,34,32,34,33,31,33,33,32,33,33,31,33,31,30,33,31,31,33,32,31,30,33,34,34,30,32,32,31,32,37,29,36,32,34,29,35,33,35,37,31,30,33,35,33,32,33,29,33,34,35,36,34,32,35,32,31,34,27,31,36,32,34,33,33,30,34,32,35,34,33,29,33,32,29,31,32,35,33,30,33,32,32,34
    38,37,32,36,34,36,35,33,36,36,37,34,33,32,34,33,31,37,33,36,35,38,32,35,35,36,36,30,34,33,34,32,38,37,33,34,35,34,34,35,30,32,35,30,31,36,36,34,35,31,36,32,31,36,32,33,33,34,34,31,36,36,33,33,35,34,33,34,33,33,31,35,34,34,37,35,33,35,29,35,37,32,34,34,32,34,35,32,35,34,35,29,35,34,37,36,34,32,33,35,33,35,34,37,36,34,34,32,28,35,34,32,32,33,36,36,35,33,36,35,34,35,32,33,33,34,34,36,33,35,35,34,34,34,36,35,35,36,34,34,36,32,37,33,32,34,34,35,33,33,33,33,33,36,36,34,36,33,34,34,35,35,32,34,34,32,35,37,31,34,37,37,35,37,37,32,36,35,33,34,36,33,35,36,35,32,34,34,35,30,36,33,32,30,38,35,31,37,32,34,36,38,33,34,34,35,36,35,34,34,34,34,34,34,33,33,36,31,31,36,33,35,32,35,36,37,33,34,31,33,30,31,30,34,35,35,34,33,33,32,33,33,37,34,34,34,32,36,35,33,35,34,35,33,35,34,32,34,35,33,34,34,35,34,33,31,34,32,32,35,35,32,31,34,35,35,31,33,34,32,33,38,32,37,33,35,31,36,34,36,38,34,32,34,36,35,33,34,31,34,35,36,37,35,33,37,33,34,35,29,33,37,35,35,34,35,31,35,33,36,35,34,34,34,33,30,32,34,36,35,31,34,33,33,35
    39,38,34,37,36,37,36,34,37,37,38,35,35,34,35,34,33,38,34,37,36,39,33,36,36,37,38,34,35,34,35,33,39,38,34,35,36,37,35,37,32,33,36,31,32,37,37,35,37,32,38,34,32,37,33,34,34,36,35,32,37,38,36,35,36,35,34,35,35,35,33,37,35,35,38,36,34,36,33,36,39,34,35,35,33,35,37,34,36,36,37,31,36,35,39,37,36,33,34,36,34,36,35,38,37,35,36,33,31,36,37,33,34,34,37,37,36,34,38,36,35,36,33,34,34,35,36,37,34,36,36,35,35,35,37,36,36,37,35,36,37,33,38,35,35,35,35,36,34,34,34,36,34,37,37,35,39,34,38,35,36,36,33,35,35,33,36,38,33,37,38,38,36,38,38,33,37,37,34,36,37,34,36,38,37,33,35,35,37,31,37,35,33,32,39,36,32,38,33,35,37,39,34,36,35,36,37,36,35,35,35,36,35,35,35,34,37,32,32,37,34,36,33,36,38,38,34,35,32,34,34,32,31,35,38,36,35,34,37,34,34,35,38,36,35,35,34,37,37,36,36,35,36,35,36,35,33,35,37,34,35,35,36,35,34,34,35,33,33,36,36,33,32,35,38,36,32,34,35,33,34,39,34,38,34,36,34,38,37,37,39,37,33,35,37,36,37,35,36,36,36,37,38,36,34,38,34,35,37,31,34,39,36,37,35,38,34,37,34,37,36,35,37,35,35,31,33,35,37,36,35,36,34,35,36
    40,39,35,38,37,38,38,35,38,39,39,36,37,35,37,35,37,39,36,38,37,40,34,37,37,38,39,35,37,35,36,34,40,39,35,36,37,39,36,38,33,34,37,32,34,38,39,36,38,34,39,37,34,38,35,35,36,37,36,33,38,39,37,36,37,38,35,38,36,37,34,38,36,36,39,37,35,37,35,37,40,35,36,36,34,36,38,36,37,37,38,32,38,37,40,38,38,39,35,37,35,37,37,39,38,36,37,34,33,37,38,35,37,35,38,39,37,35,39,37,36,37,34,35,35,37,37,38,35,37,37,37,37,36,38,37,37,38,36,38,38,34,39,36,36,37,36,38,36,35,35,37,35,38,38,37,40,35,39,36,37,37,34,38,37,34,37,39,34,38,39,40,37,39,39,35,38,38,36,37,38,36,37,39,38,37,36,38,38,32,39,36,34,33,40,37,33,39,34,36,38,40,35,38,36,37,38,37,36,36,36,38,36,37,36,35,38,35,34,38,36,39,35,37,39,39,37,36,34,35,35,33,33,37,39,37,36,35,38,36,35,36,40,37,37,36,35,39,38,37,37,37,37,36,37,37,34,36,40,35,36,37,37,36,38,36,36,34,34,39,38,36,35,36,39,39,35,35,37,35,35,40,35,39,35,38,35,40,38,38,40,39,34,36,38,38,38,36,37,37,37,38,40,37,35,39,35,37,38,34,35,40,37,38,36,39,35,38,36,38,37,39,38,36,36,32,34,37,38,37,38,37,35,37,37
    41,40,36,39,40,39,39,39,39,40,40,37,38,37,38,38,39,41,38,39,39,41,35,38,39,39,40,37,38,36,37,35,41,40,36,37,38,40,37,39,34,39,38,34,36,39,40,37,39,35,40,38,35,40,36,36,37,38,37,34,40,40,38,38,38,39,37,39,37,38,36,39,37,37,40,38,36,38,36,38,41,36,37,37,35,37,39,37,38,39,39,33,39,38,41,39,39,40,37,38,37,39,39,40,39,37,38,35,34,38,39,37,39,36,39,40,38,36,40,38,38,40,35,38,38,38,38,39,36,38,38,38,38,38,39,38,38,39,39,39,39,35,40,37,37,38,37,40,37,36,37,38,39,39,39,38,41,36,40,37,39,39,36,39,38,35,38,40,35,39,40,41,38,40,40,37,39,40,37,38,40,38,38,40,39,38,37,40,39,36,40,38,35,37,41,38,34,40,35,37,39,41,36,40,37,38,39,38,39,38,37,39,37,38,37,36,40,37,35,39,37,40,36,38,40,40,38,37,35,36,36,36,34,38,40,38,37,36,39,37,36,37,41,39,38,37,37,40,39,38,40,40,39,38,38,38,36,38,41,37,37,38,38,37,39,39,39,35,35,40,39,37,36,37,40,40,36,36,39,37,36,41,36,40,36,39,36,41,39,40,41,40,35,39,39,39,39,38,40,39,38,39,41,38,36,40,37,40,39,35,36,41,38,39,37,40,36,39,37,39,38,40,40,39,37,33,36,38,39,38,41,39,36,39,38
    42,42,38,40,41,40,40,40,40,41,41,38,39,38,39,39,41,42,39,41,40,42,38,39,41,40,41,38,39,38,39,36,42,41,38,38,40,41,39,40,36,40,39,35,39,41,41,39,40,37,41,39,36,41,37,38,38,40,38,36,41,41,41,39,39,40,38,40,39,39,37,40,38,38,41,41,38,39,37,39,42,37,39,39,38,38,40,38,39,40,40,37,40,40,42,40,40,41,38,39,41,42,40,42,40,40,40,36,35,39,40,38,40,37,40,41,40,37,41,39,39,41,36,39,40,40,39,40,38,41,39,39,40,39,40,40,39,41,40,40,40,37,41,40,38,39,38,41,38,37,38,39,40,40,40,41,42,37,41,40,40,40,37,40,39,36,40,42,38,42,41,42,40,41,41,38,40,41,39,39,42,39,39,41,40,39,38,42,40,37,41,42,36,41,42,39,36,41,36,38,40,42,37,41,38,40,40,39,40,39,38,41,38,39,38,37,41,38,36,40,38,41,37,39,41,41,40,39,36,37,37,37,36,40,41,41,39,37,40,38,37,38,42,41,39,38,38,41,40,39,41,42,41,40,39,39,41,39,42,38,38,39,39,38,40,40,41,37,36,41,40,41,38,39,41,41,37,37,40,38,37,42,37,41,38,40,37,42,40,41,42,41,36,41,40,40,40,40,41,40,39,41,42,40,38,41,39,41,40,39,37,42,39,40,38,41,39,40,38,41,39,41,41,40,39,36,37,39,40,39,42,42,37,41,40
    43,43,40,41,42,41,41,41,41,42,42,40,40,40,40,42,42,43,40,42,41,43,40,41,42,42,42,41,40,39,40,38,43,42,39,39,41,42,40,42,37,41,40,37,41,42,42,40,41,38,42,41,37,42,39,40,41,41,41,37,42,42,42,40,40,41,41,42,41,40,39,41,39,39,42,42,39,41,39,41,43,39,40,40,39,39,42,40,42,41,41,41,41,41,43,41,41,42,42,40,42,43,41,43,41,41,41,38,39,40,42,39,41,38,41,42,41,40,42,40,40,42,40,40,41,41,40,41,39,42,40,41,41,40,41,41,40,42,41,41,41,40,42,42,39,40,39,43,40,40,39,40,43,41,41,42,43,38,42,41,41,41,41,42,40,37,42,43,40,43,42,43,41,42,42,39,41,42,40,40,43,40,40,42,41,40,39,43,41,41,42,43,37,42,43,40,37,42,39,39,41,43,38,42,39,41,41,40,41,41,39,42,39,40,41,39,42,39,37,41,39,43,38,40,42,42,41,40,38,38,38,40,39,41,42,42,40,38,41,39,38,39,43,43,42,39,39,42,41,41,42,43,42,41,41,40,42,40,43,40,39,40,40,39,41,41,42,38,38,43,41,42,39,40,42,42,38,38,41,39,38,43,39,42,39,41,39,43,42,42,43,42,37,42,41,41,42,41,42,42,40,42,43,41,40,43,40,42,42,40,38,43,40,41,41,42,42,41,39,42,40,42,42,41,41,37,38,40,41,40,43,43,38,42,41
    44,44,41,43,43,42,44,43,42,43,43,41,43,41,41,43,43,44,41,43,42,44,41,42,43,43,43,42,42,40,41,42,44,43,40,40,44,43,41,43,38,42,42,38,42,43,43,41,42,40,43,42,39,44,40,41,42,42,42,38,43,43,43,44,42,42,42,43,42,41,40,42,41,40,43,43,40,42,40,42,44,40,42,41,41,40,43,42,43,43,42,42,42,42,44,43,43,43,43,41,43,44,42,44,43,42,42,39,40,41,43,40,42,40,42,43,42,41,43,41,41,43,42,42,42,42,42,42,41,43,41,42,42,44,42,42,42,43,42,42,43,41,43,43,40,41,40,44,41,41,40,41,44,42,42,44,44,40,43,43,43,42,42,43,41,38,43,44,42,44,43,44,42,43,43,41,42,44,41,41,44,42,41,43,42,41,43,44,42,42,43,44,39,43,44,41,42,43,42,41,43,44,40,43,41,42,43,41,43,42,41,43,42,41,44,40,43,41,39,42,40,44,40,41,43,43,42,42,40,39,42,41,40,44,44,43,41,39,42,40,39,43,44,44,43,43,40,43,42,42,44,44,43,42,42,42,43,44,44,43,41,41,43,40,42,43,43,41,39,44,42,43,40,41,43,43,40,39,42,41,39,44,40,44,41,43,42,44,44,43,44,43,38,43,42,42,43,42,43,43,41,43,44,43,41,44,41,44,43,44,41,44,41,43,42,44,44,43,40,43,41,43,44,43,42,38,40,41,42,41,44,44,41,43,43
    45,45,42,44,45,44,45,44,44,44,44,42,44,43,42,44,44,45,42,45,43,45,43,43,44,44,44,43,43,42,44,44,45,44,41,42,45,45,42,45,40,44,43,39,44,44,44,42,43,43,44,44,40,45,41,43,43,44,43,40,44,44,44,45,43,43,43,44,44,43,41,44,42,41,44,44,41,43,41,43,45,41,43,43,43,42,44,43,44,44,43,44,44,43,45,44,44,45,44,42,44,45,45,45,44,43,43,40,42,42,45,41,44,41,43,44,43,43,44,44,42,44,45,43,43,43,43,43,43,45,42,43,44,45,44,43,44,44,43,43,44,42,44,44,41,42,42,45,42,43,41,42,45,43,45,45,45,41,44,44,44,43,43,44,44,40,44,45,45,45,45,45,43,44,45,42,43,45,43,42,45,45,42,44,44,42,44,45,43,43,44,45,41,45,45,44,43,44,43,44,44,45,42,44,44,43,44,43,44,44,43,44,43,42,45,41,44,42,42,43,43,45,44,42,44,44,43,43,41,41,44,42,42,45,45,44,45,40,43,42,40,44,45,45,44,44,42,44,43,43,45,45,44,43,43,43,44,45,45,44,43,43,44,41,43,45,44,42,41,45,44,44,43,42,45,45,42,41,44,42,40,45,41,45,45,44,44,45,45,44,45,44,39,44,43,43,45,43,45,44,42,44,45,44,43,45,43,45,44,45,44,45,43,44,44,45,45,45,41,45,42,44,45,45,45,39,42,42,45,43,45,45,43,44,44
    46,46,45,45,46,45,46,45,45,45,45,44,46,44,43,45,45,46,44,46,45,46,44,44,45,45,45,44,44,46,45,45,46,45,44,45,46,46,43,46,41,45,44,42,45,45,45,43,45,46,46,45,44,46,42,44,45,45,44,41,45,45,46,46,45,44,45,46,45,44,42,45,44,43,45,45,43,44,44,45,46,42,44,45,44,45,45,45,45,46,46,46,45,44,46,45,45,46,45,44,45,46,46,46,45,46,45,42,43,43,46,43,46,43,44,45,44,46,45,45,46,45,46,44,44,46,44,44,44,46,44,45,46,46,45,45,45,45,45,45,45,44,45,45,42,44,43,46,44,45,43,43,46,45,46,46,46,44,46,45,45,44,45,45,45,41,46,46,46,46,46,46,45,45,46,44,45,46,44,43,46,46,43,45,46,43,46,46,44,44,45,46,42,46,46,45,46,46,44,45,46,46,43,45,46,44,45,44,45,45,44,46,44,43,46,43,45,43,43,44,46,46,45,43,45,45,45,44,42,43,45,43,43,46,46,45,46,41,44,43,42,45,46,46,46,45,44,45,45,45,46,46,45,44,44,44,45,46,46,45,45,44,46,44,44,46,45,44,45,46,45,45,44,44,46,46,44,43,46,43,41,46,43,46,46,45,45,46,46,46,46,45,40,45,44,44,46,44,46,45,44,45,46,45,44,46,44,46,45,46,45,46,46,45,45,46,46,46,44,46,43,45,46,46,46,40,44,43,46,44,46,46,44,45,45
    47,47,46,47,47,47,47,47,47,46,47,45,47,45,44,46,46,47,45,47,46,47,47,45,46,46,47,46,46,47,46,47,47,47,45,46,47,47,44,47,43,46,45,44,46,47,46,45,46,47,47,46,46,47,43,45,46,47,45,44,46,46,47,47,46,45,46,47,47,46,43,47,45,45,46,46,45,47,45,46,47,44,46,47,45,47,46,46,47,47,47,47,46,47,47,46,46,47,47,47,47,47,47,47,47,47,46,43,45,46,47,44,47,44,45,47,45,47,46,46,47,47,47,45,45,47,46,45,45,47,45,47,47,47,46,46,47,47,46,46,47,47,46,46,45,45,46,47,45,46,46,46,47,46,47,47,47,45,47,46,46,45,46,46,46,43,47,47,47,47,47,47,46,46,47,45,46,47,45,44,47,47,45,46,47,46,47,47,45,46,47,47,45,47,47,47,47,47,46,47,47,47,44,46,47,45,47,46,46,47,47,47,46,46,47,46,46,45,44,45,47,47,46,46,46,47,47,45,45,45,46,46,44,47,47,46,47,42,45,45,44,47,47,47,47,47,46,46,47,46,47,47,46,46,45,46,46,47,47,46,46,45,47,46,47,47,46,46,47,47,46,46,45,45,47,47,45,44,47,44,42,47,44,47,47,46,47,47,47,47,47,47,47,46,47,45,47,47,47,47,46,47,47,46,45,47,46,47,46,47,46,47,47,46,46,47,47,47,45,47,45,46,47,47,47,42,45,44,47,45,47,47,45,47,46
    48,48,48,48,48,48,48,48,48,48,48,48,48,47,46,47,47,48,46,48,47,48,48,46,47,47,48,47,48,48,47,48,48,48,48,47,48,48,45,48,47,47,48,45,48,48,47,47,47,48,48,48,48,48,48,47,47,48,46,48,47,48,48,48,48,48,47,48,48,47,46,48,47,47,47,47,47,48,46,47,48,47,47,48,46,48,47,47,48,48,48,48,48,48,48,47,47,48,48,48,48,48,48,48,48,48,48,46,48,48,48,46,48,46,47,48,46,48,47,47,48,48,48,47,46,48,48,47,46,48,47,48,48,48,48,48,48,48,48,48,48,48,48,47,46,48,48,48,48,48,47,48,48,48,48,48,48,46,48,47,47,47,47,47,47,45,48,48,48,48,48,48,48,48,48,46,48,48,47,46,48,48,46,48,48,48,48,48,46,47,48,48,48,48,48,48,48,48,48,48,48,48,47,48,48,47,48,47,47,48,48,48,48,47,48,48,47,48,45,47,48,48,48,48,48,48,48,48,47,47,47,47,45,48,48,48,48,43,47,48,48,48,48,48,48,48,48,47,48,48,48,48,47,48,46,47,47,48,48,48,47,46,48,47,48,48,48,47,48,48,47,48,48,48,48,48,48,45,48,47,48,48,46,48,48,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,47,48,48,48,46,48,48,48,47,48,48,48,48,47,47,48,48,48,48,48,47,47,48,48,48,45,48,45,48,47,48,48,48,48,47
    

    save upper file to b35.csv

    Tuesday, March 5, 2019 10:57 AM
  • analizer:

    cc=LDFile.ReadCSV("e:\b35.csv")
    GraphicsWindow.Width=1900
    GraphicsWindow.Height=900
    GraphicsWindow.Left=1
    GraphicsWindow.Top=1
    GraphicsWindow.BackgroundColor="darkblue"
    For y= 1 To 300
      For x=1 To 35
        GraphicsWindow.BrushColor=ldcolours.HSLtoRGB(7* cc[x][y] 1 .5)
        if text.IsSubText( "#1#12#24#36#48#" "#"+cc[x][y]+"#") Then
          GraphicsWindow.BrushColor="black"
          EndIf
        GraphicsWindow.FillRectangle(y*5 x*9+10 5 9)
      EndFor
    EndFor

    Tuesday, March 5, 2019 10:59 AM
  • xamarin wpf version of miangul's cat:

    #r "SmallBasicLibrary"
    using Microsoft.SmallBasic.Library;
    GraphicsWindow.BackgroundColor="tan";
    GraphicsWindow.BrushColor="Orange";
    GraphicsWindow.Width=600;
    GraphicsWindow.Height=600;
    
    Primitive shape="";
      int shx= 120;
      int shy= 40;
    TextWindow.WriteLine(shape);
    
      shape[01]="rect;55;203;100;150;0;Orange;Black;3;";
      shape[02]="rect;120;198;100;150;-30;Orange;Black;2;";
      shape[03]="rect;90;210;60;120;0;Orange;Black;0;";
      shape[04]="rect;6;320;230;43;0;Orange;Black;0;";
      shape[05]="tri;30;0;60;-50;-16;DarkGray;Black;0;90;0;-8;26;";
      shape[06]="tri;40;-4;60;-40;-16;Orange;Black;0;80;-4;-9;24;";
      shape[07]="tri;50;-8;60;-30;-16;Yellow;Black;0;70;-8;-9;24;";
      shape[08]="tri;30;0;60;-50;22;DarkGray;Black;0;90;0;85;22;";
      shape[09]="tri;40;-4;60;-40;22;Orange;Black;0;80;-4;87;16;";
      shape[10]="tri;50;-8;60;-30;22;Yellow;Black;0;70;-8;87;16;";
      shape[11]="ell;-35;14;250;200;0;Orange;Black;2;";
      shape[12]="ell;-5;85;190;130;0;Yellow;Black;0;";
      shape[13]="ell;-10;70;20;60;-55;Yellow;Black;0;";
      shape[14]="ell;0;55;20;60;-55;Orange;Black;0;";
      shape[15]="ell;77;35;60;85;0;Yellow;Black;0;";
      shape[16]="ell;144;60;25;60;33;Yellow;Black;0;";
      shape[17]="ell;110;84;23;50;95;Yellow;Black;0;";
      shape[18]="rect;100;210;70;10;-15;Black;Black;2;";
      shape[19]="rect;70;215;40;10;10;Black;Black;2;";
      shape[20]="ell;100;210;30;20;0;White;Black;2;";
      shape[21]="ell;0;25;75;85;0;White;Black;2;";
      shape[22]="ell;35;40;35;35;0;Black;Black;0";
      shape[23]="ell;40;55;10;10;0;White;Black;0;";
      shape[24]="ell;90;25;80;80;0;White;Black;2;";
      shape[25]="ell;120;35;35;35;0;Black;Black;0;";
      shape[26]="ell;125;50;10;10;0;White;Black;0;";
      shape[27]="tri;45;0;60;20;0;Black;Black;0;75;0;18;75;";
      shape[28]="ell;80;77;14;90;-14;Black;Black;0;";
      shape[29]="ell;92;88;14;90;-18;Yellow;Black;0;";
      shape[30]="ell;60;135;15;15;0;Black;Black;0;";
      shape[31]="ell;30;122;4;60;75;Black;Black;0;";
      shape[32]="ell;30;121;4;66;75;Yellow;Black;0;";
      shape[33]="ell;63;127;5;5;0;Black;Black;0;";
      shape[34]="ell;33;103;2;60;83;Black;Black;0;";
      shape[35]="ell;60;115;10;10;0;Black;Black;0;";
      shape[36]="rect;33;95;2;50;90;Black;Black;0;";
      shape[37]="ell;105;135;15;15;0;Black;Black;0;";
      shape[38]="ell;148;113;4;60;90;Black;Black;0;";
      shape[39]="ell;148;112;4;66;90;Yellow;Black;0;";
      shape[40]="ell;103;127;5;5;0;Black;Black;0;";
      shape[41]="ell;133;100;2;60;90;Black;Black;0;";
      shape[42]="ell;95;115;10;10;0;Black;Black;0;";
      shape[43]="rect;145;80;2;80;90;Black;Black;0;";
      shape[44]="ell;45.5;160;50;10;0;Black;Black;0;";
      shape[45]="ell;48;155;45;10;0;Yellow;Black;0;";
      shape[46]="ell;100;160;50;10;0;Black;Black;0;";
      shape[47]="ell;102;155;45;10;0;Yellow;Black;0;";
      shape[48]="ell;240;323;100;40;-10;Orange;Black;3;";
      shape[49]="ell;320;290;100;40;-30;Orange;Black;3;";
      shape[50]="ell;-37;320;88;48;0;Orange;Black;0;";
      shape[51]="ell;-39;322;30;46;0;Yellow;Black;0;";
      shape[52]="ell;-32;322;30;46;0;Orange;Black;0;";
      shape[53]="ell;-43;320;10;10;0;Yellow;Black;0;";
      shape[54]="ell;-48;330;10;10;0;Orange;Black;0;";
      shape[55]="ell;-49;340;10;10;0;Yellow;Black;0;";
      shape[56]="ell;-47;350;10;10;0;Orange;Black;0;";
      shape[57]="ell;-43;360;10;10;0;Yellow;Black;0;";
      shape[58]="ell;210;280;60;80;30;Orange;Black;1;";
      shape[59]="rect;220;340;30;20;0;Yellow;Black;2;";
      shape[60]="ell;6;285;60;80;10;Orange;Black;0;";
      shape[61]="rect;55;228;3;135;0;Black;Black;0;";
      shape[62]="rect;93;228;3;135;13;Black;Black;0;";
      shape[63]="rect;127;223;3;137;13;Black;Black;0;";
      shape[64]="ell;160;235;3;130;13;Black;Black;0;";
      shape[65]="rect;205;293;15;55;10;Orange;Black;0;";
      shape[66]="ell;210;350;3;14;10;Green;Black;2;";
      shape[67]="ell;233;346;3;10;0;Black;Black;0;";
      shape[68]="ell;229;350;10;2;0;Black;Black;2;";
      shape[69]="rect;59;337;20;25;8;Yellow;Black;0;";
      shape[70]="rect;120;335;30;25;12;Yellow;Black;0;";
    
    
      
      int _shX=shx;
      int _shY=shy;
        Primitive _shape;
    
      for (int i=1; i<=70; i++){
    
       String sqs=shape[i];
        int p=Text.GetIndexOf(sqs, ";");
        int ii=0;
        while (p>0){
           
          ii=ii+1;
          _shape[ii]=Text.GetSubText(sqs, 1, p-1);
          sqs=Text.GetSubTextToEnd(sqs, p+1);
          p=Text.GetIndexOf(sqs, ";");
        }
        GraphicsWindow.PenWidth = _shape[9];
        GraphicsWindow.BrushColor = _shape[7];
        GraphicsWindow.PenColor = _shape[8];
    
    Primitive cs;
    int tt=3;
    if (_shape[1]=="ell") tt=1;
    if (_shape[1]=="rect") tt=2;
    
       switch (tt){
    
        case 1:
          cs = Shapes.AddEllipse(_shape[4] , _shape[5] );
          Shapes.Move(cs, _shape[2]*1.0 +_shX, _shape[3]*1.0 +_shY);
          Shapes.Rotate(cs, _shape[6]);
        break;
    
        
        case 2:
          cs = Shapes.AddRectangle(_shape[4] , _shape[5] );
        
         Shapes.Move(cs, _shape[2] +_shX, _shape[3] +_shY);
          Shapes.Rotate(cs, _shape[6]);
          break;
    
        case 3:
    cs = Shapes.AddTriangle(_shape[2] , _shape[3] ,_shape[4] , _shape[5] , _shape[10] , _shape[11] );
          Shapes.Move(cs, _shape[12]*1.0 +_shX, _shape[13]*1.0 +_shY);
          Shapes.Rotate(cs, _shape[6]);
    break;
       }
       } 
    
    
    
    
    

    Thursday, March 7, 2019 7:47 AM
  • xamarin sb logo:

    #r "SmallBasicLibrary"
    
    using Microsoft.SmallBasic.Library;
    GraphicsWindow.BackgroundColor="tan";
    GraphicsWindow.BrushColor="Orange";
    GraphicsWindow.Width=600;
    GraphicsWindow.Height=600;
    
    Primitive shape="";
      int shx= 120;
      int shy= 40;
    TextWindow.WriteLine(shape);
    
      shape[01] = "0;#F4501F;tri;7;0;0;1;14;1;289;174;0;";
      shape[02] = "0;#7CB70A;tri;7;0;0;1;14;1;295;174;0;";
      shape[03] = "0;#F4501F;rect;3;1;296;174;0;";
      shape[04] = "0;#7CB70A;rect;3;1;299;174;0;";
      shape[05] = "0;#F4501F;tri;7;0;0;3;14;3;282;175;0;";
      shape[06] = "0;#7CB70A;tri;7;0;0;3;14;3;302;175;0;";
      shape[07] = "0;#F4501F;rect;10;3;289;175;0;";
      shape[08] = "0;#7CB70A;rect;10;3;299;175;0;";
      shape[09] = "0;#F4501F;tri;6;0;0;3;12;3;276;178;0;";
      shape[10] = "0;#7CB70A;tri;6;0;0;3;12;3;310;178;0;";
      shape[11] = "0;#F4501F;rect;17;3;282;178;0;";
      shape[12] = "0;#7CB70A;rect;17;3;299;178;0;";
      shape[13] = "0;#F4501F;tri;5;0;0;5;10;5;271;181;0;";
      shape[14] = "0;#7CB70A;tri;5;0;0;5;10;5;317;181;0;";
      shape[15] = "0;#F4501F;rect;23;5;276;181;0;";
      shape[16] = "0;#7CB70A;rect;23;5;299;181;0;";
      shape[17] = "0;#F4501F;tri;5;0;0;5;10;5;266;186;0;";
      shape[18] = "0;#7CB70A;tri;5;0;0;5;10;5;322;186;0;";
      shape[19] = "0;#F4501F;rect;28;5;271;186;0;";
      shape[20] = "0;#7CB70A;rect;28;5;299;186;0;";
      shape[21] = "0;#F4501F;tri;3;0;0;6;6;6;263;191;0;";
      shape[22] = "0;#7CB70A;tri;3;0;0;6;6;6;329;191;0;";
      shape[23] = "0;#F4501F;rect;33;6;266;191;0;";
      shape[24] = "0;#7CB70A;rect;33;6;299;191;0;";
      shape[25] = "0;#F4501F;tri;3;0;0;7;6;7;260;197;0;";
      shape[26] = "0;#7CB70A;tri;3;0;0;7;6;7;332;197;0;";
      shape[27] = "0;#F4501F;rect;36;7;263;197;0;";
      shape[28] = "0;#7CB70A;rect;36;7;299;197;0;";
      shape[29] = "0;#F4501F;tri;1;0;0;7;2;7;259;204;0;";
      shape[30] = "0;#7CB70A;tri;1;0;0;7;2;7;337;204;0;";
      shape[31] = "0;#F4501F;rect;39;7;260;204;0;";
      shape[32] = "0;#7CB70A;rect;39;7;299;204;0;";
      shape[33] = "0;#F4501F;rect;40;3;259;211;0;";
      shape[34] = "0;#7CB70A;rect;40;3;299;211;0;";
      shape[35] = "0;#03A3ED;rect;40;3;259;214;180;";
      shape[36] = "0;#FCB901;rect;40;3;299;214;180;";
      shape[37] = "0;#03A3ED;tri;1;0;0;7;2;7;259;217;180;";
      shape[38] = "0;#FCB901;tri;1;0;0;7;2;7;337;217;180;";
      shape[39] = "0;#03A3ED;rect;39;7;260;217;180;";
      shape[40] = "0;#FCB901;rect;39;7;299;217;180;";
      shape[41] = "0;#03A3ED;tri;3;0;0;7;6;7;260;224;180;";
      shape[42] = "0;#FCB901;tri;3;0;0;7;6;7;332;224;180;";
      shape[43] = "0;#03A3ED;rect;36;7;263;224;180;";
      shape[44] = "0;#FCB901;rect;36;7;299;224;180;";
      shape[45] = "0;#03A3ED;tri;3;0;0;6;6;6;263;231;180;";
      shape[46] = "0;#FCB901;tri;3;0;0;6;6;6;329;231;180;";
      shape[47] = "0;#03A3ED;rect;33;6;266;231;180;";
      shape[48] = "0;#FCB901;rect;33;6;299;231;180;";
      shape[49] = "0;#03A3ED;tri;5;0;0;5;10;5;266;237;180;";
      shape[50] = "0;#FCB901;tri;5;0;0;5;10;5;322;237;180;";
      shape[51] = "0;#03A3ED;rect;28;5;271;237;180;";
      shape[52] = "0;#FCB901;rect;28;5;299;237;180;";
      shape[53] = "0;#03A3ED;tri;5;0;0;5;10;5;271;242;180;";
      shape[54] = "0;#FCB901;tri;5;0;0;5;10;5;317;242;180;";
      shape[55] = "0;#03A3ED;rect;23;5;276;242;180;";
      shape[56] = "0;#FCB901;rect;23;5;299;242;180;";
      shape[57] = "0;#03A3ED;tri;6;0;0;3;12;3;276;247;180;";
      shape[58] = "0;#FCB901;tri;6;0;0;3;12;3;310;247;180;";
      shape[59] = "0;#03A3ED;rect;17;3;282;247;180;";
      shape[60] = "0;#FCB901;rect;17;3;299;247;180;";
      shape[61] = "0;#03A3ED;tri;7;0;0;3;14;3;282;250;180;";
      shape[62] = "0;#FCB901;tri;7;0;0;3;14;3;302;250;180;";
      shape[63] = "0;#03A3ED;rect;10;3;289;250;180;";
      shape[64] = "0;#FCB901;rect;10;3;299;250;180;";
      shape[65] = "0;#03A3ED;tri;7;0;0;1;14;1;289;253;180;";
      shape[66] = "0;#FCB901;tri;7;0;0;1;14;1;295;253;180;";
      shape[67] = "0;#03A3ED;rect;3;1;296;253;180;";
      shape[68] = "0;#FCB901;rect;3;1;299;253;180;";
      shape[69] = "0;White;tri;18;0;0;8;36;8;281;188;0;";
      shape[70] = "0;White;tri;8;0;0;18;16;18;273;196;0;";
      shape[71] = "0;White;tri;8;0;0;18;16;18;309;196;0;";
      shape[72] = "0;White;rect;36;18;281;196;0;";
      shape[73] = "0;White;tri;8;0;0;18;16;18;273;214;180;";
      shape[74] = "0;White;tri;8;0;0;18;16;18;309;214;180;";
      shape[75] = "0;White;rect;36;18;281;214;180;";
      shape[76] = "0;White;tri;18;0;0;8;36;8;281;232;180;";
      shape[77] = "0;DimGray;tri;16;0;0;6;32;6;283;192;0;";
      shape[78] = "0;DimGray;tri;6;0;0;16;12;16;277;198;0;";
      shape[79] = "0;DimGray;tri;6;0;0;16;12;16;309;198;0;";
      shape[80] = "0;DimGray;rect;32;16;283;198;0;";
      shape[81] = "0;DimGray;tri;6;0;0;16;12;16;277;214;180;";
      shape[82] = "0;DimGray;tri;6;0;0;16;12;16;309;214;180;";
      shape[83] = "0;DimGray;rect;32;16;283;214;180;";
      shape[84] = "0;DimGray;tri;16;0;0;6;32;6;283;230;180;";
      shape[85] = "0;White;tri;12;0;0;5;24;5;287;197;0;";
      shape[86] = "0;White;tri;5;0;0;12;10;12;282;202;0;";
      shape[87] = "0;White;tri;5;0;0;12;10;12;306;202;0;";
      shape[88] = "0;White;rect;24;12;287;202;0;";
      shape[89] = "0;White;tri;5;0;0;12;10;12;282;214;180;";
      shape[90] = "0;White;tri;5;0;0;12;10;12;306;214;180;";
      shape[91] = "0;White;rect;24;12;287;214;180;";
      shape[92] = "0;White;tri;12;0;0;5;24;5;287;226;180;";
    
      shape[93] = "3.2;0;line;259;214;275;214;0;0;0;White";
      shape[94] = "3.2;0;line;270.71;185.71;282.02;197.02;0;0;0;White;";
      shape[95] = "3.2;0;line;299;174;299;190;0;0;0;White;";
      shape[96] = "3.2;0;line;327.28;185.71;315.97;197.02;0;0;0;White;";
      shape[97] = "3.2;0;line;339;213.99;323;213.99;0;0;0;White;";
      shape[98] = "3.2;0;line;327.28;242.28;315.97;230.97;0;0;0;White;";
      shape[99] = "3.2;0;line;299;254;299;238;0;0;0;White;";
      shape[100] = "3.2;0;line;270.71;242.28;282.02;230.97;0;0;0;White;";
      shape[101] = "3.2;0;line;259;214;275;214;0;0;0;White;";
      shape[102] = "5.6;0;line;282.2;214;315.8;214;0;0;0;DimGray;";
      shape[103] = "14.4;0;line;299;197.2;299;230.8;0;0;0;DimGray;";
      shape[104] = "3.2;0;line;299;188.4;299;239.6;0;0;0;White;";
      shape[105] = "3.2;0;line;290.2;209.6;299;209.6;0;0;0;White;";
      shape[106] = "3.2;0;line;276.6;218.4;285.4;218.4;0;0;0;White;";
      
      int _shX=shx;
      int _shY=shy;
        Primitive _shape;
    
      for (int i=1; i<=106; i++){
    
       String sqs=shape[i];
        int p=Text.GetIndexOf(sqs, ";");
        int ii=0;
        while (p>0){
           
          ii=ii+1;
          _shape[ii]=Text.GetSubText(sqs, 1, p-1);
          sqs=Text.GetSubTextToEnd(sqs, p+1);
          p=Text.GetIndexOf(sqs, ";");
        }
        GraphicsWindow.PenWidth = _shape[1];
        GraphicsWindow.BrushColor = _shape[2];
        GraphicsWindow.PenColor = _shape[2];
    
    Primitive cs;
    int tt=3;
    if (_shape[3]=="line") tt=1;
    if (_shape[3]=="rect") tt=2;
    
       switch (tt){
    
        case 1:
             GraphicsWindow.PenColor = _shape[11];
             cs=Shapes.AddLine(_shape[4] , _shape[5],_shape[6] , _shape[7]);
             Shapes.Move(cs, _shape[8] +_shX, _shape[9] +_shY);
             Shapes.Rotate(cs, _shape[10]);
        break;
    
        
        case 2:
          cs = Shapes.AddRectangle(_shape[4] , _shape[5] );
        
         Shapes.Move(cs, _shape[6] +_shX, _shape[7] +_shY);
          Shapes.Rotate(cs, _shape[8]);
          break;
    
        case 3:
    cs = Shapes.AddTriangle(_shape[4] , _shape[5] ,_shape[6] , _shape[7] , _shape[8] , _shape[9] );
          Shapes.Move(cs, _shape[10]*1.0 +_shX, _shape[11]*1.0 +_shY);
          Shapes.Rotate(cs, _shape[12]);
    break;
       }
       } 

    Friday, March 8, 2019 2:20 AM
  • sb online v2 logo

    GraphicsWindow.BackgroundColor="tan"
    GraphicsWindow.BrushColor="Orange"
    
    Sinit()
    add_shapes()
    
    Sub add_shapes
      ss=1
      _shX=shx
      _shY=shy
    i=0  
      For ji=1 To 106
        i=i+1
        _shape=0
        sqs=shape[i]
        p=Text.GetIndexOf(sqs, ";")
        ii=0
        While p>0
          ii=ii+1
          _shape[ii]=Text.GetSubText(sqs, 1, p-1)
          sqs=Text.GetSubTextToEnd(sqs, p+1)
          p=Text.GetIndexOf(sqs, ";")
        EndWhile
       if _shape[1]=0 Then
           GraphicsWindow.PenWidth=0.01
           else
        GraphicsWindow.PenWidth = _shape[1]
        endif
        GraphicsWindow.BrushColor = _shape[2]
        GraphicsWindow.PenColor = _shape[2]
    
        If _shape[3]="line" Then
             GraphicsWindow.PenColor = _shape[11]
          cs = Shapes.AddLine(_shape[4] , _shape[5], _shape[6] , _shape[7] )
          Shapes.Move(cs, _shape[8]*1.0 +_shX, _shape[9]*1.0 +_shY)
          Shapes.Rotate(cs, _shape[10])
          
        ElseIf _shape[3]="rect" Then
          cs = Shapes.AddRectangle(_shape[4] , _shape[5] )
            px=_shape[6]*1.0 +_shX
         Shapes.Move(cs, px, _shape[7]*1.0 +_shY)
          Shapes.Rotate(cs, _shape[8])
          
        ElseIf _shape[3]="tri" Then
          cs = Shapes.AddTriangle(_shape[4] , _shape[5] ,_shape[6] , _shape[7] , _shape[8] , _shape[9] )
          Shapes.Move(cs, _shape[10]*1.0 +_shX, _shape[11]*1.0 +_shY)
          Shapes.Rotate(cs, _shape[12])
        EndIf
        
      EndFor
    EndSub
    
    Sub Sinit
      shape[01] = "0;#F4501F;tri;7;0;0;1;14;1;289;174;0;"
      shape[02] = "0;#7CB70A;tri;7;0;0;1;14;1;295;174;0;"
      shape[03] = "0;#F4501F;rect;3;1;296;174;0;"
      shape[04] = "0;#7CB70A;rect;3;1;299;174;0;"
      shape[05] = "0;#F4501F;tri;7;0;0;3;14;3;282;175;0;"
      shape[06] = "0;#7CB70A;tri;7;0;0;3;14;3;302;175;0;"
      shape[07] = "0;#F4501F;rect;10;3;289;175;0;"
      shape[08] = "0;#7CB70A;rect;10;3;299;175;0;"
      shape[09] = "0;#F4501F;tri;6;0;0;3;12;3;276;178;0;"
      shape[10] = "0;#7CB70A;tri;6;0;0;3;12;3;310;178;0;"
      shape[11] = "0;#F4501F;rect;17;3;282;178;0;"
      shape[12] = "0;#7CB70A;rect;17;3;299;178;0;"
      shape[13] = "0;#F4501F;tri;5;0;0;5;10;5;271;181;0;"
      shape[14] = "0;#7CB70A;tri;5;0;0;5;10;5;317;181;0;"
      shape[15] = "0;#F4501F;rect;23;5;276;181;0;"
      shape[16] = "0;#7CB70A;rect;23;5;299;181;0;"
      shape[17] = "0;#F4501F;tri;5;0;0;5;10;5;266;186;0;"
      shape[18] = "0;#7CB70A;tri;5;0;0;5;10;5;322;186;0;"
      shape[19] = "0;#F4501F;rect;28;5;271;186;0;"
      shape[20] = "0;#7CB70A;rect;28;5;299;186;0;"
      shape[21] = "0;#F4501F;tri;3;0;0;6;6;6;263;191;0;"
      shape[22] = "0;#7CB70A;tri;3;0;0;6;6;6;329;191;0;"
      shape[23] = "0;#F4501F;rect;33;6;266;191;0;"
      shape[24] = "0;#7CB70A;rect;33;6;299;191;0;"
      shape[25] = "0;#F4501F;tri;3;0;0;7;6;7;260;197;0;"
      shape[26] = "0;#7CB70A;tri;3;0;0;7;6;7;332;197;0;"
      shape[27] = "0;#F4501F;rect;36;7;263;197;0;"
      shape[28] = "0;#7CB70A;rect;36;7;299;197;0;"
      shape[29] = "0;#F4501F;tri;1;0;0;7;2;7;259;204;0;"
      shape[30] = "0;#7CB70A;tri;1;0;0;7;2;7;337;204;0;"
      shape[31] = "0;#F4501F;rect;39;7;260;204;0;"
      shape[32] = "0;#7CB70A;rect;39;7;299;204;0;"
      shape[33] = "0;#F4501F;rect;40;3;259;211;0;"
      shape[34] = "0;#7CB70A;rect;40;3;299;211;0;"
      shape[35] = "0;#03A3ED;rect;40;3;259;214;180;"
      shape[36] = "0;#FCB901;rect;40;3;299;214;180;"
      shape[37] = "0;#03A3ED;tri;1;0;0;7;2;7;259;217;180;"
      shape[38] = "0;#FCB901;tri;1;0;0;7;2;7;337;217;180;"
      shape[39] = "0;#03A3ED;rect;39;7;260;217;180;"
      shape[40] = "0;#FCB901;rect;39;7;299;217;180;"
      shape[41] = "0;#03A3ED;tri;3;0;0;7;6;7;260;224;180;"
      shape[42] = "0;#FCB901;tri;3;0;0;7;6;7;332;224;180;"
      shape[43] = "0;#03A3ED;rect;36;7;263;224;180;"
      shape[44] = "0;#FCB901;rect;36;7;299;224;180;"
      shape[45] = "0;#03A3ED;tri;3;0;0;6;6;6;263;231;180;"
      shape[46] = "0;#FCB901;tri;3;0;0;6;6;6;329;231;180;"
      shape[47] = "0;#03A3ED;rect;33;6;266;231;180;"
      shape[48] = "0;#FCB901;rect;33;6;299;231;180;"
      shape[49] = "0;#03A3ED;tri;5;0;0;5;10;5;266;237;180;"
      shape[50] = "0;#FCB901;tri;5;0;0;5;10;5;322;237;180;"
      shape[51] = "0;#03A3ED;rect;28;5;271;237;180;"
      shape[52] = "0;#FCB901;rect;28;5;299;237;180;"
      shape[53] = "0;#03A3ED;tri;5;0;0;5;10;5;271;242;180;"
      shape[54] = "0;#FCB901;tri;5;0;0;5;10;5;317;242;180;"
      shape[55] = "0;#03A3ED;rect;23;5;276;242;180;"
      shape[56] = "0;#FCB901;rect;23;5;299;242;180;"
      shape[57] = "0;#03A3ED;tri;6;0;0;3;12;3;276;247;180;"
      shape[58] = "0;#FCB901;tri;6;0;0;3;12;3;310;247;180;"
      shape[59] = "0;#03A3ED;rect;17;3;282;247;180;"
      shape[60] = "0;#FCB901;rect;17;3;299;247;180;"
      shape[61] = "0;#03A3ED;tri;7;0;0;3;14;3;282;250;180;"
      shape[62] = "0;#FCB901;tri;7;0;0;3;14;3;302;250;180;"
      shape[63] = "0;#03A3ED;rect;10;3;289;250;180;"
      shape[64] = "0;#FCB901;rect;10;3;299;250;180;"
      shape[65] = "0;#03A3ED;tri;7;0;0;1;14;1;289;253;180;"
      shape[66] = "0;#FCB901;tri;7;0;0;1;14;1;295;253;180;"
      shape[67] = "0;#03A3ED;rect;3;1;296;253;180;"
      shape[68] = "0;#FCB901;rect;3;1;299;253;180;"
      shape[69] = "0;White;tri;18;0;0;8;36;8;281;188;0;"
      shape[70] = "0;White;tri;8;0;0;18;16;18;273;196;0;"
      shape[71] = "0;White;tri;8;0;0;18;16;18;309;196;0;"
      shape[72] = "0;White;rect;36;18;281;196;0;"
      shape[73] = "0;White;tri;8;0;0;18;16;18;273;214;180;"
      shape[74] = "0;White;tri;8;0;0;18;16;18;309;214;180;"
      shape[75] = "0;White;rect;36;18;281;214;180;"
      shape[76] = "0;White;tri;18;0;0;8;36;8;281;232;180;"
      shape[77] = "0;DimGray;tri;16;0;0;6;32;6;283;192;0;"
      shape[78] = "0;DimGray;tri;6;0;0;16;12;16;277;198;0;"
      shape[79] = "0;DimGray;tri;6;0;0;16;12;16;309;198;0;"
      shape[80] = "0;DimGray;rect;32;16;283;198;0;"
      shape[81] = "0;DimGray;tri;6;0;0;16;12;16;277;214;180;"
      shape[82] = "0;DimGray;tri;6;0;0;16;12;16;309;214;180;"
      shape[83] = "0;DimGray;rect;32;16;283;214;180;"
      shape[84] = "0;DimGray;tri;16;0;0;6;32;6;283;230;180;"
      shape[85] = "0;White;tri;12;0;0;5;24;5;287;197;0;"
      shape[86] = "0;White;tri;5;0;0;12;10;12;282;202;0;"
      shape[87] = "0;White;tri;5;0;0;12;10;12;306;202;0;"
      shape[88] = "0;White;rect;24;12;287;202;0;"
      shape[89] = "0;White;tri;5;0;0;12;10;12;282;214;180;"
      shape[90] = "0;White;tri;5;0;0;12;10;12;306;214;180;"
      shape[91] = "0;White;rect;24;12;287;214;180;"
      shape[92] = "0;White;tri;12;0;0;5;24;5;287;226;180;"
      shape[93] = "3.2;0;line;259;214;275;214;0;0;0;White"
      shape[94] = "3.2;0;line;270.71;185.71;282.02;197.02;0;0;0;White;"
      shape[95] = "3.2;0;line;299;174;299;190;0;0;0;White;"
      shape[96] = "3.2;0;line;327.28;185.71;315.97;197.02;0;0;0;White;"
      shape[97] = "3.2;0;line;339;213.99;323;213.99;0;0;0;White;"
      shape[98] = "3.2;0;line;327.28;242.28;315.97;230.97;0;0;0;White;"
      shape[99] = "3.2;0;line;299;254;299;238;0;0;0;White;"
      shape[100] = "3.2;0;line;270.71;242.28;282.02;230.97;0;0;0;White;"
      shape[101] = "3.2;0;line;259;214;275;214;0;0;0;White;"
      shape[102] = "5.6;0;line;282.2;214;315.8;214;0;0;0;DimGray;"
      shape[103] = "14.4;0;line;299;197.2;299;230.8;0;0;0;DimGray;"
      shape[104] = "3.2;0;line;299;188.4;299;239.6;0;0;0;White;"
      shape[105] = "3.2;0;line;290.2;209.6;299;209.6;0;0;0;White;"
      shape[106] = "3.2;0;line;276.6;218.4;285.4;218.4;0;0;0;White;"
        EndSub
    

    Friday, March 8, 2019 2:32 AM
  • sb clock logo: ZRB036-0  

    for sb desktop+ld xtension only

    • Edited by Tryhest Friday, March 8, 2019 2:44 AM
    Friday, March 8, 2019 2:43 AM
  • draws a S in javascript:

    <!DOCTYPE html>
      <html>
      <head>
      <meta charset=utf-8 />
      <title>Draw a circle</title>
      </head>
      <body onload="draw();">
      <canvas id="circle" width="450" height="550"></canvas>
      </body>
      
      <script type="text/javascript">
      function draw()
      {
    var canvas = document.getElementById('circle');
    if (canvas.getContext)
    {
    var ctx = canvas.getContext('2d'); 
    var X = canvas.width / 2;
    var Y = canvas.height / 2;
    var R = 95;
    ctx.beginPath();
    ctx.arc(X, Y, R, Math.PI/2, 2 * Math.PI, false);
    ctx.arc(X, Y, R/2, 0, Math.PI/2, true);
    ctx.arc(X, Y+R*1.5, R, Math.PI*1.5, 3 * Math.PI, false);
    ctx.arc(X, Y+R*1.5, R/2, Math.PI*3, 1.5 * Math.PI, true);
    ctx.lineWidth = 3;
    ctx.strokeStyle = '#FF0000';
    ctx.stroke();
    }
    }
      </script>
      </html>

    save the file as text.htm and open it with opera or firefox or chrome browser with javascript enabled

    Monday, March 11, 2019 11:41 AM
  • updated canvas to draw by func:

    <!DOCTYPE html>
      <html>
      <head>
      <meta charset=utf-8 />
      <title>Draw a circle</title>
      </head>
      <body onload="draw();">
      <canvas id="circle" width="850" height="550"></canvas>
      </body>
      
      <script type="text/javascript">
    var canva = document.getElementById('circle');
    
    
    function ssd(X,Y,R,a)
    {
    
    if (canva.getContext)
    {
    var ctx = canva.getContext('2d'); 
    ctx.rotate(a * Math.PI / 180);
    ctx.beginPath();
    ctx.arc(X, Y, R, Math.PI/2, 2 * Math.PI, false);
    ctx.arc(X, Y, R/2, 0, Math.PI/2, true);
    ctx.arc(X, Y+R*1.5, R, Math.PI*1.5, 3 * Math.PI, false);
    ctx.arc(X, Y+R*1.5, R/2, Math.PI*3, 1.5 * Math.PI, true);
    ctx.lineWidth = 3;
    ctx.strokeStyle = 'red';
    ctx.stroke();
    }
    return 0;
    }
    
    
      function draw()
      {
    if (canva.getContext)
    {
    var ctxx = canva.getContext('2d'); 
    ctxx.rotate(0 * Math.PI / 180);
    ctxx.rect(20, 20, 150, 100);
    ctxx.stroke();
    
    ctxx.beginPath(); 
    ctxx.moveTo(0, 75);
    ctxx.lineTo(250, 75);
    ctxx.lineWidth = "5";
    ctxx.strokeStyle = "green"; // Green path
    
    ctxx.stroke(); // Draw it
    
    
    ssd(222,222,50,0);
    ssd(122,422,90,-45);
    
    }
    }
      </script>
      </html>

    Monday, March 11, 2019 5:49 PM
  • piechart:

    <!DOCTYPE html>
     <html>
      <head>
      <meta charset=utf-8 />
      <title>Draw pieslices</title>
      </head>
      
      <body onload="draw();">
      <canvas id="circle" width="1450" height="550"></canvas>
      </body>
      
      <script type="text/javascript">
    		  var canvas = document.getElementById('circle');
    		  
    		function sdr(X, Y)  {
    			var diameter = 150;
    			var angs = [30, 10, 45, 35, 60, 38, 75, 67];
    			var lastAng = 0;
    			var rad=Math.PI/180;
    			
    		 if (canvas.getContext){
    			var ctx = canvas.getContext('2d'); 
    
    
    			for (var i = 0; i < angs.length; i++) {
    				ctx.beginPath();
    				var gradient = ctx.createLinearGradient(10, 90, 200, 90);
    				gradient.addColorStop(0, 'black');
    				gradient.addColorStop(1, 'white');
    				ctx.fillStyle = gradient;
    				ctx.moveTo(X,Y);
    				ctx.arc(X,Y, diameter, lastAng, lastAng + rad*(angs[i]),false);
    				ctx.lineTo(X,Y);
    				lastAng += rad*(angs[i]);
    				diameter-=5;
    				ctx.lineWidth = 3;
    				ctx.strokeStyle = 'white';
    				ctx.shadowColor = "black";
    				ctx.shadowBlur = 6;
    				ctx.shadowOffsetX = 6;
    				ctx.shadowOffsetY = 6;
    				ctx.shadowColor = "darkblue";
    				ctx.fill();}
    			}
    		}    
    		  
    		  
    		function draw()  {
    		 document.body.style.background = "skyblue";
    		sdr( 200,200);
    
    		}
      </script>
    </html>

    Tuesday, March 12, 2019 4:39 AM
  • an opentype font definition in js:

    various font styles, and effects can be obtained:

    <!DOCTYPE html>
      <html>
      <head>
      <meta charset=utf-8 />
      <title>HTML5 JS Opentypedef font</title>
      </head>
      <body onload="draw();">
      <canvas id="circle" width="1450" height="550"></canvas>
      </body>
      
      <script type="text/javascript">
      var canvas = document.getElementById('circle');
      var oclr="cyan";      //outline clr
      var shcll="black";    //shdw clr
      var flcll="darkblue"; //fill clr
      
      var shbb=10;  //shadow blur lvl
      var lww=2;    //outline width
      var sxhh=5;   //shdw x offset
      var syhh=5;   //shdw y offset
      
    function ssldr(X, Y, R )  {  
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X+R,Y-R);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X+R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }
      
    function ssbdr(X, Y, R )  {  
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R,Y-R);
    	ctx.lineTo(X+R/2,Y+R*2.5);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X-R/2,Y-R);
    	ctx.lineTo(X-R,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }  
      
    function sxdr(X, Y, R )  {
    ssldr(X, Y, R );
    ssbdr(X, Y, R );
    }  
      
    function svdr(X, Y, R )  {
      ssldr(X, Y, R );
      sidr(X, Y, R );
      }
      
    function sodr(X, Y, R )  {
      if (canvas.getContext){
        var ctx = canvas.getContext('2d'); 
    
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI, 2 * Math.PI, false);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.arc(X, Y, R, Math.PI,  Math.PI*1.01, false);
    
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
     
        ctx.beginPath();
    	ctx.arc(X, Y, R/2, Math.PI, 2 * Math.PI, false);
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI*2, 3 * Math.PI, false);
    	ctx.arc(X, Y, R/2, Math.PI,  Math.PI*1.01, false);
    	ctx.lineWidth = lww;
    	ctx.strokeStyle = oclr;
    	ctx.fillStyle="dimgray";
    	ctx.fill();
    	ctx.stroke();
     
    }
      }
      
    function szdr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.moveTo(X-R,Y-R);
        ctx.lineTo(X+R,Y-R);
    	ctx.lineTo(X+R,Y-R*.45);
    	ctx.lineTo(X-R*.5,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*1.85);
    	ctx.lineTo(X+R*.5,Y-R*.5);
    	ctx.lineTo(X-R,Y-R*.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.fillStyle=flcll;
    	ctx.lineWidth = lww;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }  
      
    function sjdr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI, 2 * Math.PI, true);
        ctx.lineTo(X+R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.lineTo(X-R/2,Y+R*1.5);
    	ctx.fillStyle=flcll;	
    	ctx.lineWidth = lww;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }    
      
    function sidr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
        ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }    
      
    function sldr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
    	ctx.lineTo(X-R*.5,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }    
      
    function sudr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
        ctx.lineTo(X-R/2,Y+R);
    
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI, 2 * Math.PI, true);
        ctx.lineTo(X+R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }  
      
    function sgdr(X, Y, R )  { 
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI, 2 * Math.PI, false);
    	ctx.arc(X, Y, R/2, 0, Math.PI, true);
     
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI, 2 * Math.PI, true);
    	ctx.lineTo(X+R/2,Y+R);
    	ctx.lineTo(X+R/2-R/4,Y+R);
    	ctx.lineTo(X+R/2-R/4,Y+R-R/4);
        ctx.lineTo(X+R,Y+R-R/4);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.arc(X, Y, R, Math.PI, 1.01 * Math.PI, false);
    	ctx.lineWidth = lww;
    	ctx.strokeStyle = oclr;
    	 ctx.shadowColor = shcll;
    	 ctx.shadowBlur = shbb;
    	 ctx.shadowOffsetX = sxhh;
    	 ctx.shadowOffsetY = syhh;
    	 ctx.globalCompositeOperation = 'source-over';
    	ctx.fillStyle=flcll;
    	ctx.fill();
    	ctx.stroke();}
    }
        
    function scdr(X, Y, R )  { 
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI, 2 * Math.PI, false);
    	ctx.arc(X, Y, R/2, 0, Math.PI, true);
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI, 2 * Math.PI, true);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.arc(X, Y, R, Math.PI, 1.01 * Math.PI, false);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }
      
    function ssdr(X, Y, R )  {
      if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI/2, 2 * Math.PI, false);
    	ctx.arc(X, Y, R/2, 0, Math.PI/2, true);
    	ctx.arc(X, Y+R*1.5, R, Math.PI*1.5, 3 * Math.PI, false);
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI*3, 1.5 * Math.PI, true);
    	ctx.lineWidth = lww;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fillStyle=flcll;
    	ctx.fill();
    	ctx.stroke();}
     }
      
    function s8dr(X, Y, R )  {
      if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI/2+Math.PI/4-.1, 2.25 * Math.PI, false);
    	
    	ctx.arc(X, Y+R*1.5, R, -Math.PI/4, Math.PI*1.28, false);
    
    	ctx.lineWidth = lww;
    		ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
    	
    	ctx.beginPath();
    	ctx.arc(X, Y+R*1.5, R/2, 0, 2 * Math.PI, true);
    	ctx.fillStyle="dimgray";
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();		
    	ctx.stroke();
    	
    	ctx.beginPath();
    	ctx.arc(X, Y, R/2, 0, Math.PI*2, true);
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
     }
      
    function s9dr(X, Y, R )  {
      if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI/2-Math.PI/4+.25, 2* Math.PI, false);
    	
    	ctx.arc(X, Y+R*1.5, R, 0, Math.PI, false);
    	ctx.arc(X, Y+R*1.5, R/2, Math.PI,0 , true);
    	ctx.lineTo(X+R/2, Y+R*.85);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
    	
    	ctx.beginPath();
    	ctx.arc(X, Y, R/2, 0, 2 * Math.PI, true);
    	ctx.fillStyle="dimgray";
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();		
    	ctx.stroke();} 
    }  
      
    function s7dr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.moveTo(X-R,Y-R);
        ctx.lineTo(X+R,Y-R);
    	ctx.lineTo(X+R,Y-R*.45);
    	ctx.lineTo(X-R*.5,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X+R*.5,Y-R*.5);
    	ctx.lineTo(X-R,Y-R*.5);
    	ctx.lineTo(X-R,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }    
      
    function sldr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
    	ctx.lineTo(X-R*.5,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }    
      
    function sedr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	ctx.lineTo(X+R,Y-R*.55);
    	ctx.lineTo(X-R/2,Y-R*.55);
    	ctx.lineTo(X-R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*1.95);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }   
      
    function sfdr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	ctx.lineTo(X+R,Y-R*.55);
    	ctx.lineTo(X-R/2,Y-R*.55);
    	ctx.lineTo(X-R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }   
      
    function shdr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.moveTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    
    	ctx.lineTo(X-R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R/4);
    	ctx.lineTo(X+R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*.75);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    	sidr( X+R*1.5,Y, R);
    }     
    
    function sqdr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
        ctx.rect(X-R/4, Y+R, R/2, R*2);
    		ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
    	sodr(X,Y,R);}
    }
    
    function swdr(X, Y, R )  {
    sjdr(X+R*1.5,Y,R);
    sudr(X,Y,R);}
    
    function sydr(X, Y, R )  {
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d');
    	
    	ctx.beginPath();
    	ctx.rect(X-R/4, Y+R/2, R/2, R*2);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
    	
    	ctx.beginPath();  
        ctx.moveTo(X-R/2,Y-R);
        ctx.lineTo(X-R/2,Y);
    	ctx.arc(X, Y, R/2, Math.PI, 2 * Math.PI, true);
        ctx.lineTo(X+R/2,Y-R);
    	ctx.lineTo(X+R,Y-R);
    	ctx.arc(X, Y, R, Math.PI*2, 3 * Math.PI, false);
    	ctx.lineTo(X-R,Y-R);
    	ctx.lineTo(X-R/2,Y-R);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }  
    
    function stdr(X, Y, R )  {
    sidr(X+R*.75,Y,R);
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d');
    	ctx.beginPath();
    	ctx.rect(X-R, Y-R, R*2, R/2);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }
    	
    function snrdr(X, Y, R )  {
    sidr(X,Y,R);
    sidr(X+R*1.5,Y,R);
    }
    
    function sndr(X, Y, R )  { 
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI, 2 * Math.PI, false);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X+R/2,Y+R*2.5);
    	ctx.arc(X, Y, R/2, 0, Math.PI, true);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.arc(X, Y, R, Math.PI, Math.PI*1.01, false);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    }
    
    function sadr(X, Y, R )  { 
    if (canvas.getContext){
    	var ctx = canvas.getContext('2d');
    	
    	ctx.beginPath();
    	ctx.rect(X-R, Y+R, R*2, R/2);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    sndr(X, Y, R );
    }
    
    function smdr(X, Y, R )  { 
    sndr(X+R*1.5, Y, R );
    sndr(X, Y, R );
    }
    
    function spdr(X, Y, R )  { 
    
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y, R, Math.PI, 2.5 * Math.PI, false);
    	ctx.arc(X, Y, R/2, Math.PI*2.5, Math.PI, true);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    	sidr(X, Y, R );
    }
    
    function sbdr(X, Y, R )  {
    ssdr(X, Y, R );
    spdr (X, Y, R );}
    
    function srdr(X, Y, R )  { 
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.arc(X, Y+R*1.5, R, Math.PI, 2 * Math.PI, false);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X+R/2,Y+R*2.5);
    	ctx.arc(X, Y+R*1.5, R/2, 0, Math.PI, true);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*1.5);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    	spdr(X, Y, R );
    }
    
    function skdr(X, Y, R )  { 
     if (canvas.getContext){
    	var ctx = canvas.getContext('2d'); 
    	ctx.beginPath();
    	ctx.moveTo(X+R, Y-R);
    	ctx.lineTo(X+R/2, Y-R);
    	ctx.lineTo(X-R, Y+R);
    	ctx.lineTo(X-R/2, Y+R);
    	ctx.lineTo(X+R, Y-R);
    	
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();
    	
    	ctx.beginPath();
    	ctx.arc(X, Y+R*1.5, R, Math.PI, 2 * Math.PI, false);
    	ctx.lineTo(X+R,Y+R*2.5);
    	ctx.lineTo(X+R/2,Y+R*2.5);
    	ctx.arc(X, Y+R*1.5, R/2, 0, Math.PI, true);
    	ctx.lineTo(X-R/2,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*2.5);
    	ctx.lineTo(X-R,Y+R*1.5);
    	ctx.lineWidth = lww;
    	ctx.fillStyle=flcll;
    	ctx.strokeStyle = oclr;
    	ctx.shadowColor = shcll;
    	ctx.shadowBlur = shbb;
    	ctx.shadowOffsetX = sxhh;
    	ctx.shadowOffsetY = syhh;
    	ctx.fill();
    	ctx.stroke();}
    	sidr(X, Y, R );
    }
    
    function sddr(X, Y, R )  { 
    sodr(X, Y, R );
    sidr(X, Y, R );  
    }
    
     
    function draw()  {
     document.body.style.background = "dimgray";
       var R40=35; //fontsize
        sndr( 200, 45, R40);
    	sadr( 100, 45, R40);
    	smdr( 300, 45, R40);
    	swdr( 500, 45, R40);
    	sudr( 700, 45, R40);
    	sydr( 800, 45, R40);
    	sodr( 900, 45, R40);
    	sqdr(1000, 45, R40);
    	skdr(1100, 45, R40);
    	
    	ssdr( 200,220, R40);
    	sjdr( 300,220, R40);
    	sgdr( 400,220, R40);
    	spdr( 500,220, R40);
    	scdr( 600,220, R40);
    	srdr( 700,220, R40);
    	sddr( 800,220, R40);
    	s9dr( 900,220, R40);
    	sbdr( 100,220, R40);
    	s8dr(1000,220, R40);
    	
        sidr( 100,400, R40);
    	sldr( 200,400, R40);
    	sedr( 300,400, R40);
    	sfdr( 400,400, R40);
    	shdr( 500,400, R40);
    	sxdr( 600,400, R40);
    	szdr( 700,400, R40);
    	s7dr( 800,400, R40);
    	svdr( 900,400, R40);
    	ssbdr(1100,400, R40);
    	stdr(1000,400, R40);
    }
      </script>
      </html>


    • Edited by Tryhest Wednesday, March 13, 2019 3:38 AM
    Wednesday, March 13, 2019 3:32 AM
  • sb logo in HTML5 js code:

    <!DOCTYPE html>
    <html>
      <head> <meta charset=utf-8 />
    <title>SB HTML5 logo</title>  </head>
    <body onload="splitt();" >
     <canvas id="circle" width="650" height="550"></canvas></body>
     
      <script type="text/javascript">
       document.body.style.background = "dimgray";
      shape=Array();
      shape[01] = "0;#F4501F;tri;7;0;0;1;14;1;289;174;0;"
      shape[02] = "0;#7CB70A;tri;7;0;0;1;14;1;295;174;0;"
      shape[03] = "0;#F4501F;rect;3;1;296;174;0;"
      shape[04] = "0;#7CB70A;rect;3;1;299;174;0;"
      shape[05] = "0;#F4501F;tri;7;0;0;3;14;3;282;175;0;"
      shape[06] = "0;#7CB70A;tri;7;0;0;3;14;3;302;175;0;"
      shape[07] = "0;#F4501F;rect;10;3;289;175;0;"
      shape[08] = "0;#7CB70A;rect;10;3;299;175;0;"
      shape[09] = "0;#F4501F;tri;6;0;0;3;12;3;276;178;0;"
      shape[10] = "0;#7CB70A;tri;6;0;0;3;12;3;310;178;0;"
      shape[11] = "0;#F4501F;rect;17;3;282;178;0;"
      shape[12] = "0;#7CB70A;rect;17;3;299;178;0;"
      shape[13] = "0;#F4501F;tri;5;0;0;5;10;5;271;181;0;"
      shape[14] = "0;#7CB70A;tri;5;0;0;5;10;5;317;181;0;"
      shape[15] = "0;#F4501F;rect;23;5;276;181;0;"
      shape[16] = "0;#7CB70A;rect;23;5;299;181;0;"
      shape[17] = "0;#F4501F;tri;5;0;0;5;10;5;266;186;0;"
      shape[18] = "0;#7CB70A;tri;5;0;0;5;10;5;322;186;0;"
      shape[19] = "0;#F4501F;rect;28;5;271;186;0;"
      shape[20] = "0;#7CB70A;rect;28;5;299;186;0;"
      shape[21] = "0;#F4501F;tri;3;0;0;6;6;6;263;191;0;"
      shape[22] = "0;#7CB70A;tri;3;0;0;6;6;6;329;191;0;"
      shape[23] = "0;#F4501F;rect;33;6;266;191;0;"
      shape[24] = "0;#7CB70A;rect;33;6;299;191;0;"
      shape[25] = "0;#F4501F;tri;3;0;0;7;6;7;260;197;0;"
      shape[26] = "0;#7CB70A;tri;3;0;0;7;6;7;332;197;0;"
      shape[27] = "0;#F4501F;rect;36;7;263;197;0;"
      shape[28] = "0;#7CB70A;rect;36;7;299;197;0;"
      shape[29] = "0;#F4501F;tri;1;0;0;7;2;7;259;204;0;"
      shape[30] = "0;#7CB70A;tri;1;0;0;7;2;7;337;204;0;"
      shape[31] = "0;#F4501F;rect;39;7;260;204;0;"
      shape[32] = "0;#7CB70A;rect;39;7;299;204;0;"
      shape[33] = "0;#F4501F;rect;40;3;259;211;0;"
      shape[34] = "0;#7CB70A;rect;40;3;299;211;0;"
      shape[35] = "0;#03A3ED;rect;40;3;259;214;180;"
      shape[36] = "0;#FCB901;rect;40;3;299;214;180;"
      
      shape[37] = "0;#03A3ED;tri;1;0;0;7;2;7;259;217;180;"
      shape[38] = "0;#FCB901;tri;1;0;0;7;2;7;337;217;180;"
      shape[39] = "0;#03A3ED;rect;39;7;260;217;180;"
      shape[40] = "0;#FCB901;rect;39;7;299;217;180;"
      shape[41] = "0;#03A3ED;tri;3;0;0;7;6;7;260;224;180;"
      shape[42] = "0;#FCB901;tri;3;0;0;7;6;7;332;224;180;"
      shape[43] = "0;#03A3ED;rect;36;7;263;224;180;"
      shape[44] = "0;#FCB901;rect;36;7;299;224;180;"
      shape[45] = "0;#03A3ED;tri;3;0;0;6;6;6;263;231;180;"
      shape[46] = "0;#FCB901;tri;3;0;0;6;6;6;329;231;180;"
      shape[47] = "0;#03A3ED;rect;33;6;266;231;180;"
      shape[48] = "0;#FCB901;rect;33;6;299;231;180;"
      shape[49] = "0;#03A3ED;tri;5;0;0;5;10;5;266;237;180;"
      shape[50] = "0;#FCB901;tri;5;0;0;5;10;5;322;237;180;"
      shape[51] = "0;#03A3ED;rect;28;5;271;237;180;"
      shape[52] = "0;#FCB901;rect;28;5;299;237;180;"
      shape[53] = "0;#03A3ED;tri;5;0;0;5;10;5;271;242;180;"
      shape[54] = "0;#FCB901;tri;5;0;0;5;10;5;317;242;180;"
      shape[55] = "0;#03A3ED;rect;23;5;276;242;180;"
      shape[56] = "0;#FCB901;rect;23;5;299;242;180;"
      shape[57] = "0;#03A3ED;tri;6;0;0;3;12;3;276;247;180;"
      shape[58] = "0;#FCB901;tri;6;0;0;3;12;3;310;247;180;"
      shape[59] = "0;#03A3ED;rect;17;3;282;247;180;"
      shape[60] = "0;#FCB901;rect;17;3;299;247;180;"
      shape[61] = "0;#03A3ED;tri;7;0;0;3;14;3;282;250;180;"
      shape[62] = "0;#FCB901;tri;7;0;0;3;14;3;302;250;180;"
      shape[63] = "0;#03A3ED;rect;10;3;289;250;180;"
      shape[64] = "0;#FCB901;rect;10;3;299;250;180;"
      shape[65] = "0;#03A3ED;tri;7;0;0;1;14;1;289;253;180;"
      shape[66] = "0;#FCB901;tri;7;0;0;1;14;1;295;253;180;"
      shape[67] = "0;#03A3ED;rect;3;1;296;253;180;"
      shape[68] = "0;#FCB901;rect;3;1;299;253;180;"
      shape[69] = "0;White;tri;18;0;0;8;36;8;281;188;0;"
      shape[70] = "0;White;tri;8;0;0;18;16;18;273;196;0;"
      shape[71] = "0;White;tri;8;0;0;18;16;18;309;196;0;"
      shape[72] = "0;White;rect;36;18;281;196;0;"
      shape[73] = "0;White;tri;8;0;0;18;16;18;273;214;180;"
      shape[74] = "0;White;tri;8;0;0;18;16;18;309;214;180;"
      shape[75] = "0;White;rect;36;18;281;214;180;"
      shape[76] = "0;White;tri;18;0;0;8;36;8;281;232;180;"
      shape[77] = "0;DimGray;tri;16;0;0;6;32;6;283;192;0;"
      shape[78] = "0;DimGray;tri;6;0;0;16;12;16;277;198;0;"
      shape[79] = "0;DimGray;tri;6;0;0;16;12;16;309;198;0;"
      shape[80] = "0;DimGray;rect;32;16;283;198;0;"
      
      shape[81] = "0;DimGray;tri;6;0;0;16;12;16;277;214;180;"
      shape[82] = "0;DimGray;tri;6;0;0;16;12;16;309;214;180;"
      shape[83] = "0;DimGray;rect;32;16;283;214;180;"
      shape[84] = "0;DimGray;tri;16;0;0;6;32;6;283;230;180;"
      shape[85] = "0;White;tri;12;0;0;5;24;5;287;197;0;"
      shape[86] = "0;White;tri;5;0;0;12;10;12;282;202;0;"
      shape[87] = "0;White;tri;5;0;0;12;10;12;306;202;0;"
      shape[88] = "0;White;rect;24;12;287;202;0;"
      shape[89] = "0;White;tri;5;0;0;12;10;12;282;214;180;"
      shape[90] = "0;White;tri;5;0;0;12;10;12;306;214;180;"
      shape[91] = "0;White;rect;24;12;287;214;180;"
      shape[92] = "0;White;tri;12;0;0;5;24;5;287;226;180;"
      shape[93] = "3.2;0;line;259;214;275;214;0;0;0;White"
      shape[94] = "3.2;0;line;270.71;185.71;282.02;197.02;0;0;0;White;"
      shape[95] = "3.2;0;line;299;174;299;190;0;0;0;White;"
      shape[96] = "3.2;0;line;327.28;185.71;315.97;197.02;0;0;0;White;"
      shape[97] = "3.2;0;line;339;213.99;323;213.99;0;0;0;White;"
      shape[98] = "3.2;0;line;327.28;242.28;315.97;230.97;0;0;0;White;"
      shape[99] = "3.2;0;line;299;254;299;238;0;0;0;White;"
      shape[100] = "3.2;0;line;270.71;242.28;282.02;230.97;0;0;0;White;"
      shape[101] = "3.2;0;line;259;214;275;214;0;0;0;White;"
      shape[102] = "5.6;0;line;282.2;214;315.8;214;0;0;0;DimGray;"
      shape[103] = "14.4;0;line;299;197.2;299;230.8;0;0;0;DimGray;"
      shape[104] = "3.2;0;line;299;188.4;299;239.6;0;0;0;White;"
      shape[105] = "3.2;0;line;290.2;209.6;299;209.6;0;0;0;White;"
      shape[106] = "3.2;0;line;276.6;218.4;285.4;218.4;0;0;0;White;"
      
      function max(input) {
         if (toString.call(input) !== "[object Array]")  
           return false;
      return Math.max.apply(null, input);	}
      
      function min(input) {
         if (toString.call(input) !== "[object Array]")  
           return false;
      return Math.min.apply(null, input);	}
      
      function splitt(){
    
    		var canvas = document.getElementById('circle');
    		if (canvas.getContext){
    		var ctx = canvas.getContext('2d'); 
    		var zz=1.6;
    		  var aa=Array();
    		  for(var q=1; q<107; q++){
    		  aa=txsplit(shape[q]);
    		  if (aa[2]==="rect"){
    			ctx.beginPath();
    		  ctx.rect(aa[5]*zz,aa[6]*zz,aa[3]*zz,aa[4]*zz);
    		  ctx.fillStyle=aa[1];
    		  ctx.fill();
    			ctx.lineWidth = 1;
    			ctx.strokeStyle = aa[1];
    			ctx.stroke();
    		  }
    			if (aa[2]==="tri" && aa[11]==="180"){
    				var xx=aa[9]*zz;
    				var yy=aa[10]*zz;
    						
    						var b=Array();
    						b[0]=aa[3];
    						b[1]=aa[5];
    						b[2]=aa[7];
    						
    				var mx=max(b);
    				
    				var mxy=max([aa[4],aa[6],aa[8]]);
    				
    				var nx=min([aa[3],aa[5],aa[7]]);
    				var ny=min([aa[4],aa[6],aa[8]]);
    				
    				ctx.beginPath();
    				ctx.moveTo(xx+(nx+mx-aa[3])*zz,yy+(ny+mxy-aa[4])*zz);
    				ctx.lineTo(xx+(nx+mx-aa[5])*zz,yy+(ny+mxy-aa[6])*zz);
    				ctx.lineTo(xx+(nx+mx-aa[7])*zz,yy+(ny+mxy-aa[8])*zz);
    				ctx.lineTo(xx+(nx+mx-aa[3])*zz,yy+(ny+mxy-aa[4])*zz);
    				ctx.fillStyle=aa[1];
    				ctx.fill();
    			}
    			if (aa[2]==="tri" && aa[11]==="0"){
    				var xx=aa[9]*zz;
    				var yy=aa[10]*zz;
    				ctx.beginPath();
    				ctx.moveTo(xx+aa[3]*zz,yy+aa[4]*zz);
    				ctx.lineTo(xx+aa[5]*zz,yy+aa[6]*zz);
    				ctx.lineTo(xx+aa[7]*zz,yy+aa[8]*zz);
    				ctx.lineTo(xx+aa[3]*zz,yy+aa[4]*zz);
    				
    			  ctx.fillStyle=aa[1];
    			  ctx.fill();
    		  }
    		   if (aa[2]==="line"){
    			ctx.beginPath();
    			ctx.moveTo(aa[3]*zz,aa[4]*zz);
    			ctx.lineTo(aa[5]*zz,aa[6]*zz);
    			ctx.lineWidth = aa[0]*zz;
    			ctx.strokeStyle = aa[10];
    			ctx.stroke();
    		   }
    		  }
    		 }
    		}
    		  
    		  txsplit = function (str) {
    			 return str.trim().split(";");
    	};
      
      </script>
    </html>

    Wednesday, March 13, 2019 7:48 AM
  • a nice fract-tree:

    <html>
    <body>
    <canvas id="canvas" width="600" height="500"></canvas>
     
    <script type="text/javascript">
    	document.body.style.background = "darkgreen";
    	var elem = document.getElementById('canvas');
    	var ctx = elem.getContext('2d');
    	 
    	ctx.lineWidth = 3;
    	 
    	var deg_to_rad = Math.PI / 180.0;
    	var depth = 9;
    	 
    function drawLine(x1, y1, x2, y2, br){
        ctx.beginPath();
    	ctx.moveTo(x1, y1);
    	ctx.lineTo(x2, y2);
    	ctx.lineWidth = br;
    	ctx.strokeStyle = "darkorange"
    	ctx.stroke()	 }
    	 
    function drawTree(x1, y1, angle, depth){
      if (depth !== 0){
        var x2 = x1 + (Math.cos(angle * deg_to_rad) * depth * 10.0);
        var y2 = y1 + (Math.sin(angle * deg_to_rad) * depth * 10.0);
        drawLine(x1, y1, x2, y2, depth);
        drawTree(x2, y2, angle - 20, depth - 1);
        drawTree(x2, y2, angle + 20, depth - 1);}
    }
     
    	ctx.beginPath();
    	drawTree(300, 500, -90, depth);
    	ctx.closePath();
    	ctx.stroke();
    </script>
     
    </body>
    </html>

    Wednesday, March 13, 2019 7:16 PM
  • cliff html: SFR318

    save as htm file after importing to sb

    Tuesday, March 19, 2019 5:25 AM
  • creates html, svg and sb files drawing: XDD141-0

    usage is simple

    just define array on beginning:

    for triangle tri; x1 y1 x2 y2 x3 y3; fill; outline; outl-wid

    for rectangle rct; x1 y1 ww hh; fill; outline; outl-wid

    for ellipse ell; x1 y1 ww hh ; fill; outline; outl-wid

    for line lin; x1 y1 x2 y2; outline; outline; outl-wid

    output are 3 files in defined dir

    <fff>.htm is html file result

    <fff>.svg is svg file result

    <fff>.sb is sb file

    all files are ready to use and run

    needs ld xtension to run


    • Edited by Tryhest Wednesday, March 20, 2019 8:21 AM
    Wednesday, March 20, 2019 8:19 AM
  • very nice julia set:

    <head>
    		<title>JuliaSet</title>
    		<body style="background: gray;">
    	</head>
    <body  onload="init();">
    
     
    <script>
    var maxIterations = 450, minX = -.5, maxX = .5, 
        minY = -.5, maxY = .5, wid, hei, ctx,
        jsX = 0.285, jsY = 0.01;
     
    function remap( x, t1, t2, s1, s2 ) {
        var f = ( x - t1 ) / ( t2 - t1 ),
            g = f * ( s2 - s1 ) + s1;
        return g;
    }
    function getColor( c ) {
        var r, g, b, p = c / 32,
            l = ~~( p * 6 ), o = p * 6 - l, 
            q = 1 - o;
     
        switch( l % 6 ) {
            case 0: r = 1; g = o; b = 0; break;
            case 1: r = q; g = 1; b = 0; break;
            case 2: r = 0; g = 1; b = o; break;
            case 3: r = 0; g = q; b = 1; break;
            case 4: r = o; g = 0; b = 1; break;
            case 5: r = 1; g = 0; b = q; break;
        }
        var c = "#" + ( "00" + ( ~~( r * 255 ) ).toString( 16 ) ).slice( -2 ) + 
                      ( "00" + ( ~~( g * 255 ) ).toString( 16 ) ).slice( -2 ) + 
                      ( "00" + ( ~~( b * 255 ) ).toString( 16 ) ).slice( -2 );
        return (c);
    }
    function drawFractal() {
        var a, as, za, b, bs, zb, cnt, clr
        for( var j = 0; j < hei; j++ ) {
            for( var i = 0; i < wid; i++ ) {
                a = remap( i, 0, wid, minX, maxX )
                b = remap( j, 0, hei, minY, maxY )
                cnt = 0;
                while( ++cnt < maxIterations ) {
                    za = a * a; zb = b * b;
                    if( za + zb > 4 ) break;
                    as = za - zb; bs = 2 * a * b;
                    a = as + jsX; b = bs + jsY;
                }
                if( cnt < maxIterations ) {
                    ctx.fillStyle = getColor( cnt );
                }
                ctx.fillRect( i, j, 1, 1 );
            }
        }
    }
    function init() {
        var canvas = document.createElement( "canvas" );
        wid = hei = 800;
        canvas.width = wid; canvas.height = hei;
        ctx = canvas.getContext( "2d" );
        ctx.fillStyle = "black"; ctx.fillRect( 0, 0, wid, hei );
        document.body.appendChild( canvas );
        drawFractal();
    }
    </script>
    </body>

    Thursday, March 21, 2019 10:19 PM
  • same fractal in sb translation: ZRG510
    Friday, March 22, 2019 5:25 AM
  • field of ferns in html/js

    <html>
    <body onload="frnn()"
    	  style="background: darkblue;">
         <canvas id="canvas" width="1540" height="940" ></canvas>
     </body>
    
    	 <script >
    	 
    		function frnn(){
    			 var yy=150;
    			 pBarnsleyFern('canvas', 100000,300,yy+600);
    			 pBarnsleyFern('canvas', 100000,700,yy+700); 
    			 pBarnsleyFern('canvas', 100000,550,yy+400);
    			 pBarnsleyFern('canvas', 100000,100,yy+350);
    			 pBarnsleyFern('canvas', 100000,320,yy+150);
    			 pBarnsleyFern('canvas', 100000,800,yy+190); }
    		 
    		 
    		function pBarnsleyFern(canvasId,lim,x260,y540) {
    		  var canvas = document.getElementById(canvasId);
    		  var ctx = canvas.getContext("2d");
    		  var w = canvas.width;
    		  var h = canvas.height;
    		  var x=0.,y=0.,xw=0.,yw=0.,r;
    		  
    		  function randgp(max) {return Math.floor(Math.random()*max)}
    
    		  
    		  for (var i=0; i<lim; i++) {
    			r=randgp(100);
    			if (r<=1) {xw=0;yw=0.16*y;}
    			else if (r<=8) {xw=0.2*x-0.26*y;yw=0.23*x+0.22*y+1.6;}
    			else if (r<=15) {xw=-0.15*x+0.28*y;yw=0.26*x+0.24*y+0.44;}
    			else {xw=0.85*x+0.04*y;yw=-0.04*x+0.85*y+1.6;}
    			x=xw;y=yw; ctx.fillStyle="lime"; ctx.fillRect(x*50+x260,-y*50+y540,1,1);  }
    		}
    	  </script>
     </html>
    
    

    Saturday, March 23, 2019 6:42 AM
  • Translated into SmallBasic:

    GraphicsWindow.BackgroundColor="darkblue"
    GraphicsWindow.BrushColor="lime"
    GraphicsWindow.Height=940
    GraphicsWindow.Width=1140
    yy=150
    xxx="1=300;2=700;3=550;4=100;5=320;6=800"
    yyy="1=600;2=700;3=400;4=350;5=150;6=190"
    lim=100000
    For fer=1 To 6
      x=0
      y=0
      xw=0
      yw=0
      x260=xxx[fer]
      y540=yy+yyy[fer]
      For i=0 To lim
        r=Math.GetRandomNumber(100)
        If r<=1 Then
          xw=0
          yw=0.16*y
        ElseIf r<=8 Then
          xw=0.2*x-0.26*y
          yw=0.23*x+0.22*y+1.6
        ElseIf r<=15 Then
          xw=-0.15*x+0.28*y
          yw=0.26*x+0.24*y+0.44
        Else
          xw=0.85*x+0.04*y
          yw=-0.04*x+0.85*y+1.6
        EndIf
        x=xw
        y=yw
        GraphicsWindow.fillRectangle(x*50+x260,-y*50+y540,1,1)
      EndFor
    EndFor


    Jan [ WhTurner ] The Netherlands

    Saturday, March 23, 2019 3:24 PM
    Answerer
  • I tried to run ZRG510, but I only got a monochrome blue screen!

    During debugging I found that the calculation for za = a * a  got as the answer 0 (zero) even for a value of 0.5 for a. The I realised that my (Dutch) version of windows uses a comma as decimal separator. By inserting 

    LDUtilities.CurrentCulture="US"
    

    at the start of the program, all went well.

    So for Europian Small Basic users who want to run ZRG510 it is nesessary to insert these line.


    Jan [ WhTurner ] The Netherlands

    Monday, March 25, 2019 12:28 PM
    Answerer
  • See my program: BTG660-2
    Monday, March 25, 2019 1:56 PM
  • Very helpful hint from Jan.

    But only "US" is not accepted in my configuration!

    If I use "en-US", everything will work correctly.

    Textwindow.WriteLine("CurrentCulture: " + LDUtilities.CurrentCulture)
    LDUtilities.CurrentCulture="en-US"
    Textwindow.WriteLine("CurrentCulture: " + LDUtilities.CurrentCulture)


    Monday, March 25, 2019 6:10 PM
  • Litdev,

    As there is no explanation about the possible values for CurrentCulture, can these be added to the intellisense?


    Jan [ WhTurner ] The Netherlands


    Monday, March 25, 2019 6:47 PM
    Answerer
  • Litdev,

    As there is no explanation about the possible values for CurrentCulture, can these be added to the intellisense?


    Jan [ WhTurner ] The Netherlands


    LDUtilities.AvailableCultures() method added to beta version.

    Thanks for the suggestion.

    Friday, March 29, 2019 8:22 PM
    Moderator
  • ellipse construction by simple rotating lines:

    GraphicsWindow.BackgroundColor="teal"
    GraphicsWindow.PenWidth=1
    GraphicsWindow.PenColor="lime"
    for a =0 to 360 step 3
      cy=LDMath.Sin(a)*200+300
      cx=LDMath.Cos(a)*200+300
      l=Shapes.AddLine(380 300 cx cy)
      dx=(cx-380)/2+380
      dy=(cy-300)/2+300
    ldShapes.RotateAbout(l dx dy 90)
    EndFor

    Saturday, March 30, 2019 8:23 AM
  • I always use US win bcs of . and , problems :) 
    Saturday, March 30, 2019 8:27 AM
  •     Sorry. I wanted to include my program and excluded yours. This is my first time on this forum.
    Monday, April 1, 2019 12:33 PM
  • zoomable&rotable cardioides:

    use lmb+wheel to rotate, only wheel to zoom

    GraphicsWindow.BackgroundColor="tan"
    GraphicsWindow.PenColor="darkblue"
    GraphicsWindow.PenWidth=.2
    For r50=50 To 130 Step 6
      For f=0 To 360 Step 5
        cf=LDMath.Cos(f)
        x=r50*(1-cf)*cf
        y=r50*(1-cf)*LDMath.Sin(f)
        If f>0 Then
          shapes.addLine(ox+300 oy+200 x+300 y+200)
          shapes.addLine(300-ox oy+200 300-x y+200)
          shapes.addLine(oy+300 ox+200 y+300 x+200)
          shapes.addLine(300-oy 200-ox 300-y 200-x)
        EndIf
        ox=x
        oy=y
      EndFor
    EndFor
    
    LDEvents.MouseWheel=mmm
    zz=1
    sub mmm
      if Mouse.IsLeftButtonDown Then
        rr=rr+LDEvents.LastMouseWheelDelta*3
        else
        zz=zz+LDEvents.LastMouseWheelDelta/15
        EndIf
      LDGraphicsWindow.Reposition(zz zz 0 0 rr)
    EndSub
    
    

    Thursday, April 4, 2019 5:30 AM
  • adapted for sb- online: KHJ989

    Thursday, April 4, 2019 5:47 AM
  • similar in js/html:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <style>
            canvas {
                background-color: darkblue;
            }
        </style>
    </head>
    <body style="background: darkblue;"> 
      <canvas></canvas>
        <script>
    
            var canvas = document.querySelector("canvas");
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
            var g = canvas.getContext("2d");
            var nodes=[[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],
    					[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],
    					[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];
    
            function Cub(pX, pY, rr) {
    		var yy=0;
    		var ff=3.1415926/180;
    	    nodes.forEach(function (node) {
            var sinX = Math.sin(yy*ff);
            var cosX = Math.cos(yy*ff);
            node[0]=pX+rr*(1-cosX)*cosX;
            node[1]=pY+rr*(1-cosX)*sinX;
    		yy+=6;});
     }
     
            function drawc() {
    
    			g.clearRect(0, 0, canvas.width, canvas.height);
                g.translate(canvas.width / 2, canvas.height / 2);
    			for(var qq=130; qq>0;qq-=5){
    
               Cub(50,50,qq+100);
    
    			g.strokeStyle = "darkblue";
    			g.beginPath();
    			var p1 = nodes[0];
    			g.moveTo(p1[0],p1[1]);
               for (var y=1; y<60; y++){
                    var p2 = nodes[y];
                    g.lineTo(p2[0], p2[1]);
                };
     
                g.closePath();
                g.stroke();
    			g.fillStyle="rgb(0,"+(200-qq)+","+qq+")";
    			g.fill();}
        }
            drawc();
        </script>
      </body>
    </html>

    Thursday, April 4, 2019 10:56 AM
  • js flower

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <style>
            canvas {
                background-color: darkblue;
            }
        </style>
    </head>
    <body style="background: darkblue;"> 
      <canvas></canvas>
        <script>
    
            var canvas = document.querySelector("canvas");
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
            var g = canvas.getContext("2d");
            var nodes=[[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],
    					[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],
    					[1,1],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];
    
            function Cub(pX, pY, rr) {
    		var yy=0;
    		var ff=3.1415926/180;
    	    nodes.forEach(function (node) {
            var sinX = Math.sin(yy*ff);
            var cosX = Math.cos(yy*ff);
            node[0]=pX+rr*(1-cosX)*cosX;
            node[1]=pY+rr*(1-cosX)*sinX;
    		yy+=6;});
     }
     
            function drawc() {
    var f300=100;
    var h2=100;
    			g.clearRect(0, 0, canvas.width, canvas.height);
                g.translate(canvas.width / 2, canvas.height / 2);
    			for(var qq=130; qq>0;qq-=5){
    
    				   Cub(50,50,qq+100);
    
    					g.strokeStyle = "darkblue";
    					g.beginPath();
    					var p1 = nodes[0];
    					g.moveTo(f300-p1[0],p1[1]);
    				   for (var y=1; y<60; y++){
    						var p2 = nodes[y];
    						g.lineTo(f300-p2[0], p2[1]);
    					};
    		 
    					g.closePath();
    					g.stroke();
    					g.fillStyle="rgba(0,"+(200-qq)+","+qq+",0.3)";
    					g.fill();
    			
    								g.beginPath();
    					var p1 = nodes[0];
    					g.moveTo(p1[0],p1[1]);
    				   for (var y=1; y<60; y++){
    						var p2 = nodes[y];
    						g.lineTo(p2[0], p2[1]);
    					};
    		 
    					g.closePath();
    					g.stroke();
    					g.fillStyle="rgba(0,"+(200-qq)+","+qq+",0.3)";
    					g.fill();
    					
    					
    										g.beginPath();
    					var p1 = nodes[0];
    					g.moveTo(p1[1],p1[0]);
    				   for (var y=1; y<60; y++){
    						var p2 = nodes[y];
    						g.lineTo(p2[1], p2[0]);
    					};
    		 
    					g.closePath();
    					g.stroke();
    					g.fillStyle="rgba(0,"+(200-qq)+","+qq+",0.2)";
    					g.fill();
    					
    					
    					g.beginPath();
    					var p1 = nodes[0];
    					g.moveTo(p1[1],h2-p1[0]);
    				   for (var y=1; y<60; y++){
    						var p2 = nodes[y];
    						g.lineTo(p2[1], h2-p2[0]);
    					};
    		 
    					g.closePath();
    					g.stroke();
    					g.fillStyle="rgba(0,"+(200-qq)+","+qq+",0.2)";
    					g.fill();
    			
    			}
        }
            drawc();
        </script>
      </body>
    </html>

    Thursday, April 4, 2019 7:25 PM
  • found this opensource vesion of sb javawritten shell:

    it was a big deal to start it bcs it contains some corean chars which can't be compiled so i had to remove all of them.

    the result is very promising, the shell is stabile and runs 30-40%faster than original sb

    to start it u must run it from powershell or cmdprompt.

    u can find original post on https://github.com/kwanghoon/MySmallBasic?fbclid=IwAR0_bC_bH9nizl2Os9o7my8KIV7LB-xchu88e-ha8jhF5R_77LcZY-qFu1E

    Sunday, April 7, 2019 4:42 AM
  • the positive side is it can be run on any javasupporting os such as win, linux, ubuntu, android, iphone...

    it must be compiled on desired os by javac compiler

    the compile instructions are here:

    https://github.com/kwanghoon/MySmallBasic/wiki/Quick-Start-Guide

    also found inside a blockly sb shell https://blockly-demo.appspot.com/static/demos/index.html

    blockly is a nice graphic composer for object-like apps

    blockly has xml output of composed program:

    • Edited by Tryhest Sunday, April 7, 2019 5:01 AM
    Sunday, April 7, 2019 4:58 AM
  • blockly can run js apps online

    also has nice online demos and instant graphs

    I think blockly is the next step towards sb 3.0 online


    • Edited by Tryhest Sunday, April 7, 2019 5:28 AM
    Sunday, April 7, 2019 5:13 AM
  • sokocute playable on java sb:

    works on:

    • sb desktop (1.0 and above)
    • sb java emulator

    setup()
    InitLevels()
    KeyUp()
    Main()
    
    Sub setup'----------------------------------------
      GraphicsWindow.CanResize  = false
      GraphicsWindow.Width = 1024
      GraphicsWindow.Height = 768
      GraphicsWindow.Title = "Sokoban"
      GraphicsWindow.FontName = "Calibri"
      GraphicsWindow.FontSize = 25
      GraphicsWindow.BrushColor ="darkblue"
      true = "true"
      false = "false"
      tmmr= Shapes.AddText ("t")
      mmv= Shapes.AddText ("m")
      Shapes.Move (mmv, 1, 40)
      lww= Shapes.AddText ("m")
      Shapes.Move (lww, 1, 80)
      
      nokey=true
      sf=1
    Path = "http://smallbasic.com/drop/soko"
    background = ImageList.LoadImage( Path + "/sokocuteff.png")
    image["A"] = ImageList.LoadImage( Path + "/sokocute0a.png")
    image["B"] = ImageList.LoadImage( Path + "/sokocute0b.png")
    image["7"] = ImageList.LoadImage( Path + "/sokocute07.png")
    image["6"] = ImageList.LoadImage( Path + "/sokocute06.png")
    image["5"] = ImageList.LoadImage( Path + "/sokocute05.png")
    image["4"] = ImageList.LoadImage( Path + "/sokocute04.png")
    image["3"] = ImageList.LoadImage( Path + "/sokocute03.png")
    image["2"] = ImageList.LoadImage( Path + "/sokocutegg.png")
    image["1"] = ImageList.LoadImage( Path + "/sokocutess.png")
    image["0"] = ImageList.LoadImage( Path + "/sokocute00.png")
    GraphicsWindow.DrawImage(background, 0, 0)
      cppi=(Path + "/sokocutep2.png")
      cpp1=(Path + "/sokocutep1.png")
      leftKey  = "Left"
      rightKey = "Right"
      forwardKey = "Up"
      backKey = "Down"
      fireKey = "Space"
      returnKey = "Return"
      escapeKey = "Escape"
      pauseKey = "P"
      resetKey = "R"
      'important var for moving the crystals
      korrx = 36
      'init any other var
      animtime = 1500
      status = "start"
      game="gamearray"
      block = "blockArray"
      
      stage = 0
    EndSub
    
    Sub Main'-----------------------------------------------------------
      GraphicsWindow.KeyDown = KeyDown
      GraphicsWindow.KeyUp= KeyUp
      endtime = Clock.ElapsedMilliseconds
      starttime = Clock.ElapsedMilliseconds
      blinktime = Clock.ElapsedMilliseconds
      gamestarttime = Clock.ElapsedMilliseconds
      Timer.Interval=1000
      Timer.Tick=ttt
      gemfall = false
      freecells = 1
      blink     = 0
      
      looptime = 0
      play = true
      pause = 0
      rot = 0
      oo=50
      
      While play
        Input()
        If status = "game" Then
          Program.Delay (10)
          
          If gemfall = false and gemwater <> 99 and Clock.ElapsedMilliseconds - watertime > 550 Then
            Shapes.Animate(crystalimg[gemwater],Shapes.GetLeft(crystalimg[gemwater]), Shapes.GetTop(crystalimg[gemwater]) + 35, 650)
            gemfall = true
          EndIf
          If gemfall and gemwater <> 99 and Clock.ElapsedMilliseconds - watertime > 550 and Clock.ElapsedMilliseconds - watertime < 1400 Then
            gemzoom = gemzoom - gemmove
            gemmove = gemmove + 0.001
            Shapes.Zoom(crystalimg[gemwater], gemzoom, gemzoom)
          EndIf
          If gemwater <> 99 and Clock.ElapsedMilliseconds - watertime > 1400 Then
            Shapes.Move(crystalimg[gemwater], 1000, 1000)
    
            gemwater = 99
            gemmove = 0
            gemfall = false
          EndIf
          
          If (gemchng <> 99) And (Clock.ElapsedMilliseconds - gemtime > 400) Then
            If ground[gemy][gemx] = 1 Then
              Shapes.Move(crystalimg[gemchng], gemchng * 52, -100)
              freecells = 0
              For y = 0 To 15
                For x = 0 To 19
                  If level[y][x] = 1 Then
                    freecells = freecells + 1
                  EndIf
                EndFor
              EndFor
              
              Else
              Shapes.SetOpacity(crystalimg[gemchng],66)
       '       Shapes.Move(crystalimg[gemchng], Shapes.GetLeft(crystalbnk[gemchng]), Shapes.GetTop(crystalbnk[gemchng]))
        '      Shapes.Move(crystalbnk[gemchng], gemchng * 52, -100)
            EndIf
            gemchng = 99
          EndIf
          
          'move the player
          If newmove < 20 Then
            newmove = newmove + 1
            xplayer = xplayer + movex
            yplayer = yplayer + movey
            Shapes.Move(player1, xplayer, yplayer)
            Shapes.Move(player2, xplayer, yplayer)
          EndIf
          
          'blinking crystals when level is done
          If freecells = 0 And Clock.ElapsedMilliseconds - blinktime > 350 Then
            oo=100-oo
            For i = 0 To (cryst - 1)
           
                Shapes.SetOpacity(crystalimg[i], oo)
              EndFor
            blink = blink + 1
            blinktime = Clock.ElapsedMilliseconds
          EndIf
          
          ' end level if crystals changed color 10 times
          If blink = 3 Then
            LevelExplosion()
                     status = "reset"
              resettime = Clock.ElapsedMilliseconds
     
            EndIf
            
        
          
        EndIf  'of Status = game
        
        'reset level after a short delay
        If status ="reset" And (Clock.ElapsedMilliseconds - resettime > 500) Then
          GraphicsWindow.BrushColor = "#3975e5"
          GraphicsWindow.FillRectangle(70,690,170,80)
          GraphicsWindow.FillRectangle(800,690,224,80)
          freecells = 1
          blink = 0
          'LevelRelease()
          LevelLoad()
          starttime = Clock.ElapsedMilliseconds
          status = "game"
          
          Shapes.SetText (mmv,  " moves: "+ moves)
          Shapes.SetText (lww,  " level: "+ (stage + 1) )
        EndIf
        If status = "start" Then
          'MoveStars()
        EndIf
        
      EndWhile
    EndSub
    
    Sub LevelExplosion  
      
      Shapes.Animate(player1, Shapes.GetLeft(player1), 1500, 4000)
      Shapes.Animate(player2, Shapes.GetLeft(player2), 1500, 4000)  
    
     
      For i = 0 To cryst
          angle = Math.GetRandomNumber(360) 
          xv = Math.Cos(angle * 0.0174) * 1200
          yv = Math.Sin(angle * 0.0174) * 600            
          If Shapes.GetTop(crystalimg[i]) > 0 then
            Shapes.Animate(crystalimg[i], xv + 512, yv + 350, 1500)
          EndIf
        EndFor  
      
        For y = 0 To 15
         For x = 0 To 19
             angle = Math.GetRandomNumber(360) 
             xv = Math.Cos(angle * 0.0174) * 1200
             yv = Math.Sin(angle * 0.0174) * 600            
             Shapes.Animate(levelshapes[y][x], xv + 512, yv + 350, 1500)
        EndFor
      EndFor      
    EndSub
    
    Sub ttt'--------------------------------------
      ' show time and fps
      If status = "game" Then
        gametime = Clock.ElapsedMilliseconds - starttime
        GraphicsWindow.BrushColor = "white"
        tsecgesamt = Math.Round(gametime/ 1000)
        tsec       = Math.Remainder(tsecgesamt , 60)
        tmingesamt = Math.Floor(tsecgesamt/ 60)
        tmin       = Math.Remainder(tmingesamt , 60)
        thour      = Math.Floor(tmingesamt / 60)
        If tsec < 10 Then
          strSec = Text.Append( ":0", tsec)
        Else
          strSec = Text.Append( ":", tsec)
        EndIf
        If tmin < 10 Then
          strMin = Text.Append( "0", tmin)
        Else
          strMin = Text.Append( "", tmin)
        EndIf
        
        Shapes.SetText (tmmr, " time "+ thour + ":" + Text.Append( strMin, strSec))
        
      EndIf
    EndSub
    
    Sub KeyDown'-------------------------------------------------------------------------
      'If nokey Then
        nokey="false"
        bleftKey    = false
        brightKey   = false
        bforwardKey = false
        bbackKey    = false
        bescapeKey  = false
        lk=GraphicsWindow.LastKey
        If  lk = leftKey Then
          bleftKey = true
        ElseIf lk = rightKey Then
          brightKey = true
        ElseIf lk = forwardKey Then
          bforwardKey = true
        ElseIf lk = backKey Then
          bbackKey = true
        ElseIf lk = returnKey Then
          breturnKey = true
        ElseIf lk = escapeKey Then
          bescapeKey = true
        EndIf
      'EndIf
    EndSub
    
    Sub KeyUp'-------------------------------------------------------------------------------
      bleftKey    = false
      brightKey   = false
      bforwardKey = false
      bbackKey    = false
      breturnKey  = false
      nokey=true
      
      If GraphicsWindow.LastKey = resetKey Then
        status = "reset"
        resettime = Clock.ElapsedMilliseconds
      EndIf
      
      If status = "start" Then
        status = "reset"
        resettime = Clock.ElapsedMilliseconds
      EndIf
    EndSub
    
    Sub Input'----------------------------------------------------------------------------
      
      If newmove >= 20  and blink = 0 Then
        
        'move right
        If(brightKey   = true) and (level[posy][posx+1] <= 2) Then
          'move crystal
          If level[posy][posx+1] = 2 and ground[posy][posx+1] <= 1 And (level[posy][posx+2] <= 1 or ground[posy][posx+2] = 3) Then
            chestarray[posy][posx+2] = chestarray[posy][posx+1]
            chestarray[posy][posx+1] = 99
            level[posy][posx+1] = ground[posy][posx+1]
            level[posy][posx+2] = 2
            
            'move crystal into water
            If ground[posy][posx+2] = 3 Then
              watertime = Clock.ElapsedMilliseconds
              gemwater = chestarray[posy][posx+2]
              gemzoom = 1
            EndIf
            If (ground[posy][posx+2] = 1 and ground[posy][posx+1] <= 0) Or (ground[posy][posx+2] <= 0 and ground[posy][posx+1] = 1) Then
              gemtime = Clock.ElapsedMilliseconds
              gemchng = chestarray[posy][posx+2]
              gemy    = posy
              gemx    = posx+2
            EndIf
            
            '		animate crystal
            If ground[posy][posx+1] = 1 Then
              Shapes.SetOpacity(crystalimg[chestarray[posy][posx+2]],66)
                     Shapes.Move(crystalimg[chestarray[posy][posx+2]] , (posx+2) * 50 + korrx, (posy) * 40 )
    
              ElseIf ground[posy][posx+2] = 3 Then
              Shapes.Move(crystalimg[chestarray[posy][posx+2]] , (posx+2) * 50 + korrx, (posy) * 40)
            Else
              Shapes.Move(crystalimg[chestarray[posy][posx+2]] , (posx+2) * 50 + korrx, (posy) * 40)
            EndIf
          EndIf
          '		move player right
          If level[posy][posx+1] <= 1 Then
            moves   = moves + 1
            newmove = 0
            movex   = 2.5
            movey   = 0
            posx = posx + 1
            gametime = Clock.ElapsedMilliseconds
            Shapes.SetText (mmv,  " moves: "+ moves)
          EndIf
          '		move left
        ElseIf( bleftKey    = true) and (level[posy][posx-1]<= 2 ) Then
          '		move crystal
          
          If (level[posy][posx-1] = 2 ) And ground[posy][posx-1] <= 1 and (level[posy][posx-2] <= 1 or ground[posy][posx-2] = 3) Then
            
            chestarray[posy][posx-2] = chestarray[posy][posx-1]
            chestarray[posy][posx-1] = 99
            level[posy][posx-1] = ground[posy][posx-1]
            level[posy][posx-2] = 2
            
            '		move crystal into water
            If ground[posy][posx-2] = 3 Then
              watertime = Clock.ElapsedMilliseconds
              gemwater = chestarray[posy][posx-2]
              gemzoom = 1
            EndIf
            If (ground[posy][posx-2] = 1 and ground[posy][posx-1] <= 0) Or (ground[posy][posx-2] <= 0 and ground[posy][posx-1] = 1) Then
              gemtime = Clock.ElapsedMilliseconds
              gemchng = chestarray[posy][posx-2]
              gemy    = posy
              gemx    = posx-2
            EndIf
            '		animate crystal
            If ground[posy][posx-1] = 1 Then
              Shapes.SetOpacity(crystalimg[chestarray[posy][posx-2]], 66)
              Shapes.Move(crystalimg[chestarray[posy][posx-2]] , (posx-2) * 50 + korrx, (posy) * 40 - 0)
              
    
            '  Shapes.Animate(crystalbnk[chestarray[posy][posx-2]] , (posx-2) * 50 + korrx, (posy) * 40 - 0, 400)
            ElseIf ground[posy][posx-2] = 3 Then
              Shapes.Move(crystalimg[chestarray[posy][posx-2]] , (posx-2) * 50 + korrx, (posy) * 40 + 0)
            Else
              Shapes.Move(crystalimg[chestarray[posy][posx-2]] , (posx-2) * 50 + korrx, (posy) * 40 - 0)
            EndIf
          EndIf
          '		move player left
          If level[posy][posx-1] <= 1 Then
            moves   = moves + 1
            newmove = 0
            movex   =-2.5
            movey   = 0
            posx = posx - 1
            gametime = Clock.ElapsedMilliseconds
            Shapes.SetText (mmv,  " moves: "+ moves)
          EndIf
          '		move down
        ElseIf(bbackKey    = true) and (level[posy+1][posx]<= 2) Then
          '		move crystal
          If level[posy+1][posx] = 2 And ground[posy+1][posx] <= 1 and (level[posy+2][posx] <= 1 or ground[posy+2][posx] = 3) Then
            chestarray[posy+2][posx] = chestarray[posy+1][posx]
            chestarray[posy+1][posx] = 99
            level[posy+1][posx] = ground[posy+1][posx]
            level[posy+2][posx] = 2
            
            '		move crystal into water
            If ground[posy+2][posx] = 3 Then
              watertime = Clock.ElapsedMilliseconds
              gemwater = chestarray[posy+2][posx]
              gemzoom = 1
            EndIf
            If (ground[posy+2][posx] = 1 and ground[posy+1][posx] <= 0) Or (ground[posy+2][posx] <= 0 and ground[posy+1][posx] = 1) Then
              gemtime = Clock.ElapsedMilliseconds
              gemchng = chestarray[posy+2][posx]
              gemy    = posy+2
              gemx    = posx
            EndIf
            '		animate crystal
            If ground[posy+1][posx] = 1 Then
              
                Shapes.SetOpacity(crystalimg[chestarray[posy+2][posx]], 66)
                   Shapes.Move(crystalimg[chestarray[posy+2][posx]] , (posx) * 50 + korrx, (posy+2) * 40 - 0)
             ' Shapes.Animate(crystalbnk[chestarray[posy+2][posx]] , (posx) * 50 + korrx, (posy+2) * 40 - 0, 400)
            ElseIf ground[posy+2][posx] = 3 Then
              Shapes.Move(crystalimg[chestarray[posy+2][posx]] , (posx) * 50 + korrx, (posy+2) * 40 + 0)
            Else
              Shapes.Move(crystalimg[chestarray[posy+2][posx]] , (posx) * 50 + korrx, (posy+2) * 40 - 0)
            EndIf
          EndIf
          '		move player down
          If level[posy+1][posx] <= 1 Then
            moves   = moves + 1
            newmove = 0
            movex   = 0
            movey   = 2
            posy = posy + 1
            gametime = Clock.ElapsedMilliseconds
            Shapes.SetText (mmv,  " moves: "+ moves)
          EndIf
          '		move up
        ElseIf(bforwardKey = true) and (level[posy-1][posx]<= 2) Then
          '		move crystal
          If level[posy-1][posx] = 2 And ground[posy-1][posx] <= 1 And (level[posy-2][posx] <= 1 or ground[posy-2][posx] = 3) Then
            chestarray[posy-2][posx] = chestarray[posy-1][posx]
            chestarray[posy-1][posx] = 99
            level[posy-1][posx] = ground[posy-1][posx]
            level[posy-2][posx] = 2
            
            '		move crystal into water
            If ground[posy-2][posx] = 3 Then
              watertime = Clock.ElapsedMilliseconds
              gemwater = chestarray[posy-2][posx]
              gemzoom = 1
            EndIf
            If (ground[posy-2][posx] = 1 and ground[posy-1][posx] <= 0) Or (ground[posy-2][posx] <= 0 and ground[posy-1][posx] = 1) Then
              gemtime = Clock.ElapsedMilliseconds
              gemchng = chestarray[posy-2][posx]
              gemy    = posy-2
              gemx    = posx
            EndIf
            '		animate crystal
            If ground[posy-1][posx] = 1 Then
              Shapes.SetOpacity(crystalimg[chestarray[posy-2][posx]], 66)
                   Shapes.Move(crystalimg[chestarray[posy-2][posx]] , (posx) * 50 + korrx, (posy-2) * 40 - 0)
    
              'Shapes.Animate(crystalbnk[chestarray[posy-2][posx]] , (posx) * 50 + korrx, (posy-2) * 40 - 0, 400)
            ElseIf ground[posy-2][posx] = 3 Then
              Shapes.Move(crystalimg[chestarray[posy-2][posx]] , (posx) * 50 + korrx, (posy-2) * 40 + 0)
            Else
              Shapes.Move(crystalimg[chestarray[posy-2][posx]] , (posx) * 50 + korrx, (posy-2) * 40 - 0)
            EndIf
          EndIf
          '		move player up
          If level[posy-1][posx] <= 1 Then
            moves   = moves + 1
            newmove = 0
            movex   = 0
            movey   =-2
            posy = posy - 1
            gametime = Clock.ElapsedMilliseconds
            Shapes.SetText (mmv,  " moves: "+ moves)
          EndIf
        EndIf
      EndIf
      bleftKey    = false
      brightKey   = false
      bforwardKey = false
      bbackKey    = false
      bescapeKey  = false
    EndSub
    
    Sub Sort'--------------------------------------------------------
      For y = 0 To 15
        For x = 0 To 15
          If level[y][x] = 3 Then
            Shapes.Remove(levelshapes[y][x])
            levelshapes[y][x] = Shapes.AddImage(image["3"])
            Shapes.Move(levelshapes[y][x], (x) * 50 + korrx, (y) * 40 )
          EndIf
        EndFor
      EndFor
    EndSub
    
    Sub LevelLoad'----------------------------------------------------------
      cryst = 0
      posx  = 4
      posy  = 4
      moves = 0
      
      For i = 0 To 15
        For p = 1 To Text.GetLength(block[stage][i])
          blockcode = Text.GetSubText(block[stage][i], p, 1)
          If blockcode = "X" Then
            posy = i
            posx = p-1
            blockcode = 0
          EndIf
          
          If blockcode = 2 Then
            ground[i][p-1] = 0
          ElseIf blockcode = "C" Then 'crystal on gras
            ground[i][p-1] = "A"
          ElseIf blockcode = "D" Then 'crystal on wood
            ground[i][p-1] = "B"
          Else
            ground[i][p-1] = blockcode
          EndIf
        EndFor
      EndFor
      
      '		load the water first
      For i = 0 To 15
        For p = 1 To Text.GetLength(block[stage][i])
          blockcode = Text.GetSubText(block[stage][i], p, 1)
          If blockcode = 3 Then
            levelshapes[i][p-1] = Shapes.AddImage(image[blockcode])
            
            Shapes.move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
          EndIf
        EndFor
      EndFor
      
      For i = 0 To 15
        For p = 1 To Text.GetLength(block[stage][i])
          blockcode = Text.GetSubText(block[stage][i], p, 1)
          If blockcode = "X" Then
            posy = i
            posx = p-1
            blockcode = 0
          ElseIf blockcode = "Y" Then
            posy = i
            posx = p-1
            blockcode = "A"
          ElseIf blockcode = "Z" Then
            posy = i
            posx = p-1
            blockcode = "B"
          EndIf
          
          If blockcode = 2 Then
            ground[i][p-1] = 0
          ElseIf blockcode = "C" Then
            ground[i][p-1] = "A"
          ElseIf blockcode = "D" Then
            ground[i][p-1] = "B"
          Else
            ground[i][p-1] = blockcode
          EndIf
          
          If blockcode = "C" Then
            level[i][p-1] = 2
          ElseIf blockcode = "D" Then
            level[i][p-1] = 2
          Else
            level[i][p-1] = blockcode
          EndIf
          If blockcode = "C" Then '		crystal on gras
            levelshapes[i][p-1] = Shapes.AddImage(image["A"])
            Shapes.move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
            
          ElseIf blockcode = "D" Then '	crystal on wood
            levelshapes[i][p-1] = Shapes.AddImage(image["B"])
            Shapes.move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
            
          ElseIf blockcode < 2  Then
            levelshapes[i][p-1] = Shapes.AddImage(image[blockcode])
            If blockcode=0 Then
              Shapes.SetOpacity(levelshapes[i][p-1],75)
            EndIf
            Shapes.Move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
            
          ElseIf blockcode = 2  Then
            levelshapes[i][p-1] = Shapes.AddImage(image["0"])
            Shapes.SetOpacity(levelshapes[i][p-1],75)
            Shapes.Move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
          EndIf
        EndFor
      EndFor
      
      Program.Delay (5)
      
      'load blocks
      f = 0
      For i = 0 To 15
        For p = 1 To Text.GetLength(block[stage][i])
          blockcode = Text.GetSubText(block[stage][i], p, 1)
          If blockcode = 2 or blockcode = "C" or blockcode = "D" Then
            crystalimg[cryst] = Shapes.AddImage(image[2])
           
            chestarray[i][p-1] = cryst
            Shapes.Move(crystalimg[cryst] , (p-1) * 50 + korrx, (i) * 40 - 0)
            
             Program.Delay (50)
            cryst = cryst + 1
          EndIf
        EndFor
      EndFor
      player1 = Shapes.AddImage(cppi)
      
      '		load lower player shape first. it has to be behind the walls
      Shapes.Move(player1, (posx) * 50 + korrx, (posy) * 40 - 0)
      
      For i = 0 To 15
        For p = 1 To Text.GetLength(block[stage][i])
          blockcode = Text.GetSubText(block[stage][i], p, 1)
          If blockcode >= 4 Then
            levelshapes[i][p-1] = Shapes.AddImage(image[blockcode])
            Shapes.Move(levelshapes[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0)
          EndIf
        EndFor
      EndFor
      
      '	load players face at last. It has always to be in front of the walls
      player2 = Shapes.AddImage(cpp1)
      Shapes.Move(player2, (posx) * 50 + korrx, (posy) * 40 - 0)
      xplayer = Shapes.GetLeft(player1)
      yplayer = Shapes.GetTop(player1)
    EndSub
    
    Sub InitLevels
    block[0][01]="____________________"
    block[0][02]="____________________"
    block[0][03]="____________________"
    block[0][04]="_____66666__________"
    block[0][05]="_____60006__________"
    block[0][06]="_____62006__________"
    block[0][07]="___66600266_________"
    block[0][08]="___60020206_________"
    block[0][09]="_6660606606AA555555_"
    block[0][10]="_600060660666700115_"
    block[0][11]="_60200200000X000115_"
    block[0][12]="_666660666066700115_"
    block[0][13]="_____60000066555555_"
    block[0][14]="_____6666666________"
    block[0][15]="____________________"
    block[0][16]="____________________"
    EndSub

    • Edited by Tryhest Monday, April 8, 2019 9:33 AM
    Monday, April 8, 2019 7:06 AM
  • html js text wrapper:

    <html>
    	<head>
    		<title>Textwrap</title>
    		<body style="background: gray;">
    	</head>
      <body>
    		<form>
    		Num : <input type="text" id="fNum" /><br>
    		<input type="button" onClick="divid()" Value="Divide" />
    		</form>
    	<span id = "result"></span>
    		
    	<script>
    	function clog(txt){
    	document.getElementById("result").innerHTML =txt;} 
    
    	function divid(){ 
    			num1 = document.getElementById("fNum").value;
    	clog( wordwrap("The quick brown fox jumped over the lazy dog. Sine ira inter pares pro bono hic et nunc lorem ipsum dolor sit ament cum granum salis et nabla pecatorum. Hic et nunc ora pronobis teo nomen est omen. Hic Rhodos hic salta una corda post hoc ego proper hoc divide et impera.", num1, "<br>\n"));
    	}
    
    	function wordwrap(text, width = 80, br = '\n', cut = false) {
    
    	  width >>>= 0;
    	  if (0 === width || text.length <= width) {
    		return text;
    	  }
    
    	  return text.split('\n').map(line => {
    		if (line.length <= width) {
    		  return line;
    		}
    
    		let words = line.split(' ');
    	   
    		if (cut) {
    		  let temp = [];
    		  for (const word of words) {
    			if (word.length > width) {
    			  let i = 0;
    			  const length = word.length;
    			  while (i < length) {
    				temp.push(word.slice(i, Math.min(i + width, length)));
    				i += width;
    			  }
    			} else {
    			  temp.push(word);
    			}
    		  }
    		  words = temp;
    		}
    	   
    		let wrapped = words.shift();
    		let spaceLeft = width - wrapped.length;
    		for (const word of words) {
    		  if (word.length + 1 > spaceLeft) {
    			wrapped += br + word;
    			spaceLeft = width - word.length;
    		  } else {
    			wrapped += ' ' + word;
    			spaceLeft -= 1 + word.length;
    		  }
    		}
    		return wrapped;
    	  }).join('\n'); 
    	}
    	
     
    	</script>
      </body>
    </html> 
     

    Thursday, April 11, 2019 6:04 AM
  • plays a music theme in 3 channels, with notes shown:

    args=0
    ii=1
    d1="CDEFGAB"
    pp=900
    d2=LDText.Split("E F G A B C D" " ")
    For i = 0 To 2
     
      For j = 0 To 1
        ldcall.function2("hton" "C", 0.5)
        ldcall.function2("hton" "E", 0.5)
        ldcall.function2("hton" "G", 0.5)
      EndFor
      For j = 0 To 2
        ldcall.function2("hton" "A", 0.5)
      EndFor
      ldcall.function2("hton" "G",1)
      ldcall.function2("hton" 0, 1.5)
      For j = 0 To 2
        ldcall.function2("hton" "F", 0.5)
      EndFor
      For j = 0 To 2
        ldcall.function2("hton" "E", 0.5)
      EndFor
      For j = 0 To 2
        ldcall.function2("hton" "D", 0.5)
      EndFor
      ldcall.function2("hton" "C", 1)
      ldcall.function2("hton" 0, 2)
      pp=pp/1.618
    EndFor
    LDMusic.Reset()

    Sub hton
      If args[1]=0 Then
      Else
        tt=args[1]+(4/args[2])
        TextWindow.Write(tt+" ")
        LDMusic.Instrument=103
        TextWindow.Title=ii
        ii=ii+1
        LDMusic.PlayNote(4 args[1] 1)
        LDMusic.PlayNote(6 args[1] 3)
        LDMusic.PlayNote(5 d2[text.GetIndexOf(d1 args[1])] 2)
      EndIf
      Program.Delay(args[2]*pp)
    EndSub



    • Edited by Tryhest Sunday, April 14, 2019 3:54 AM
    Sunday, April 14, 2019 3:01 AM
  • hexapawn-like game:

    <!DOCTYPE html>
    <html><head><meta charset="UTF-8">
    <title>Hexapawn clone</title>
    <script>
    var board, playBtn, turn, memory = [], lastMove = {brd: "", mvi: 0},chb='\u2657',chw='\u2659',
        clicks = {first: null, second: null}, win = {c: 0, p: 0}, score;
     
    function getPossibles() {
        var pos = [], tp = turn == 0 ? chw : chb, gp = turn == 0 ? chb : chw;
     
        for( var j = 0; j < 3; j++ ) {
            var jj = j + (turn == 0 ? -1 : 1);
            if( jj < 3 && jj > -1 ) {
                for( var i = 0; i < 3; i++ ) {
                    if( board[i][j] == tp ) {
                        for( var k = -1; k < 2; k++ ) {
                            if(i + k > -1 && i + k < 3 &&
                                ((board[i + k][jj] == " " && i + k == i) || (board[i + k][jj] == gp && i + k != i))) {
                                pos.push( {f: i + j * 3, t: i + k + jj * 3});
                            }
                        }
                    }
                }
            }
        }
        return pos;
    }
    function computerMoves() {
        var brd = getBoard(), mvs, needSave = false;
     
    	for( var i = 0; i < memory.length; i++ ) {
            if( memory[i].board == brd ) {
                mvs = memory[i].moves;
                break;
            }
        }
     
        if( !mvs ) {
            mvs = getPossibles();
            needSave = true;    
        }
        if( mvs.length == 0 ) return 0;
     
    	var idx = Math.floor( Math.random() * mvs.length );
    	lastMove.brd = brd;
    	lastMove.mvi = idx;
    	var i = mvs[idx].f % 3, j = Math.floor( mvs[idx].f / 3 ),
    		ii = mvs[idx].t % 3, jj = Math.floor( mvs[idx].t / 3 );
    	board[i][j] = " "; board[ii][jj] = chb;
     
        if( needSave ) {
            memory.push( {board: brd, moves: mvs} );
        }
    	updateBtns();
        return -1;
    }
    function getBoard() {
        var str = "";
        for( var j = 0; j < 3; j++ ) {
            for( var i = 0; i < 3; i++ ) {
                str += board[i][j];
            }
        }
        return str;
    }
    function updateScore() {
    	score.innerHTML = "Player: " + win.p + " Computer: " + win.c;
    }
    function finish( r ) {
    	var str = "The PC won!";
    	if( r == 0 ) {
    		str = "You win!";
    		win.p++;
    		for( var i = 0; i < memory.length; i++ ) {
    			if( memory[i].board == lastMove.brd ) {
    				memory[i].moves.splice( lastMove.mvi, 1 );
    				break;
    			}
    		}
    	} else {
    		win.c++;
    	}
    	playBtn.innerHTML = str + "<br />Click to play.";
    	playBtn.className = "button long"
    	updateScore();
    }
    function checkFinished() {
        if( getPossibles().length < 1 ) return turn == 0 ? 1 : 0;
     
        for( var i = 0; i < 3; i++ ) {
            if( board[i][0] == chw ) return 0;
            if( board[i][2] == chb ) return 1;
        }
     
        var w = 0, b = 0;
        for( var j = 0; j < 3; j++ ) {
            for( var i = 0; i < 3; i++ ) {
                if( board[i][j] == chw ) w++;
                if( board[i][j] == chb ) b++;
            }
        }
        if( w == 0 ) return 1;
        if( b == 0 ) return 0;
        return -1;
    }
    function nextPlayer() {
    	var r;
    	updateBtns();
    	turn = turn == 0 ? 1 : 0;
    	r = checkFinished();
     
    	if( r > -1 ) {
    		finish( r );
    	} else {
    		if( turn == 1 ) {
    			r = computerMoves();
    			if( r < 0 ) nextPlayer();
    			else finish( r );
    		}
    	}
    }
    function search( o, arr ) {
    	for( var i = 0; i < arr.length; i++ ) {
    		if( o.f == arr[i].f && o.t == arr[i].t ) return i;
    	}
    	return -1;
    }
    function btnHandle( e ) {
        if( turn > 0 ) return;
        if( clicks.first == null && e.target.firstChild.data == chw ) {
            clicks.first = e.target;
            clicks.first.className += " marked"
        } else if( clicks.first != null && e.target.firstChild.data == chw ) {
    		clicks.first.className = clicks.first.className.split(" ")[0];
            clicks.first = clicks.second = null;
    	} else if( clicks.first != null && ( e.target.firstChild.data == " " ||
                                             e.target.firstChild.data == chb ) ) {
            clicks.second = e.target;
            var moves = getPossibles( turn ),
                i = clicks.first.i, ii = clicks.second.i,
                j = clicks.first.j, jj = clicks.second.j,
                obj = {f: i + j * 3, t: ii + jj * 3};
            if( search( obj, moves ) > -1 ) {
                board[i][j] = " "; board[ii][jj] = chw;
    			clicks.first.className = clicks.first.className.split(" ")[0];
    			clicks.first = clicks.second = null;
    			nextPlayer();
    		}
        }
    }
    function updateBtns() {
        var b, v;
        for( var j = 0; j < 3; j++ ) {
            for( var i = 0; i < 3; i++ ) {
                b = document.getElementById( "btn" + ( i + j * 3 ) );
                b.innerHTML = ( board[i][j] );
            }
        }
    }
    function restart() {
        turn = 0;
        createBoard();
        updateBtns();
    	playBtn.className += " hide";
    }
    function createBoard() {
        board = new Array( 3 );
        for( var i = 0; i < 3; i++ ) {
            board[i] = new Array( 3 );
        }
        for( var j = 0; j < 3; j++ ) {
            for( var i = 0; i < 3; i++ ) {
                board[i][j] = j == 0 ? chb : j == 2 ? chw : " ";
            }
        }
    }
    function createBtns() {
        var b, d = document.createElement( "div" ), v = false;
        d.className += "board";
        document.body.appendChild( d );
        for( var j = 0; j < 3; j++ ) {
            for( var i = 0; i < 3; i++ ) {
                b = document.createElement( "button" );
                b.id = "btn" + ( i + j * 3 );
                b.i = i; b.j = j;
                b.addEventListener( "click", btnHandle, false );
                b.appendChild( document.createTextNode( "" ) );
                d.appendChild( b );
                if( v ) b.className = "button"
                else  b.className = "empty";
                v = !v;
            }
        }
        playBtn = document.createElement( "button" );
        playBtn.className = "button long hide";
    	playBtn.addEventListener( "click", restart, false );
    	score = document.createElement( "p" );
        score.className = "txt";
    	d.appendChild( score );
        d.appendChild( playBtn );
        updateScore();
    }
    function init() {
        createBtns();
        restart();
    }
     
    </script>
    <style>
        html,body{padding:0; margin:0;padding-top:6vh;background:#222;color:#111}
        .txt{color:#fff;text-align:center;font-size:6vh}
        .board{padding:0;margin:auto;width:33vh;height:33vh}
        .long, .button, .empty{border:1px solid black;font-size:9vh;margin:0;padding:0;height:11vh;width:11vh;line-height:5vh;
    	vertical-align:middle;background:brown;text-align:center;border-radius:3px;cursor:pointer;float:left}
        .empty{background:gold}
    	.hide{display:none}
        .marked{border:red 3px solid}
    	.long{width:100%;font-size:3vh}
    </style>
    </head><body onLoad="init()"></body></html>

    Wednesday, April 17, 2019 2:47 AM
  • wireframe of earth rotating:

    for all sb editions desktop/online/java:

    a=-15
    b=23
    c=5
    d=15
    u=128
    v=87
    r=150
    d5=18' use 5 for desktop and 8 for java sb'
    bm=Math.Pi/180
    'GraphicsWindow.Title="Earth Rotation"'
    GraphicsWindow.PenWidth=1
    mx=120
    my=150
    GraphicsWindow.BackgroundColor="darkblue"
    GraphicsWindow.PenColor="skyblue"
    For c=0 To 3600 Step 1.3
      sff()
      Program.Delay(25)
    EndFor
    
    Sub sff
      GraphicsWindow.Clear()
      GraphicsWindow.DrawEllipse( mx+u-r,my+v-r,r*2, r*2)
      h=0.5
      s1=Math.Sin (a*bm)
      s2=Math.Sin (b*bm)
      s3=Math.Sin (c*bm)
      c1=Math.Cos (a*bm)
      c2=Math.Cos (b*bm)
      c3=Math.Cos (c*bm)
      'calc rotate matrix'
      ax=c2*c3
      ay=-c2*s3
      az=s2
      bx=c1*s3+s1*s2*c3
      by=c1*c3-s1*s2*s3
      bz=-s1*c2
      cx=s1*s3-c1*s2*c3
      cy=s1*c3+c1*s2*s3
      cz=c1*c2
      'draw lenght-circle'
      For l=0 To 180-d Step d
        f1=0
        For p=0 To 360 Step d5
          sbb()
          If yy>0 Then
            f2=0
            f1=0
            Goto l580
          EndIf
          
          xb=Math.Floor (u+xx+h)
          yb=Math.Floor (v+zz+h)
          f2=1
          If f1=0 Then
            x1=xb
            y1=yb
            f1=1
            Goto l580
          EndIf
          GraphicsWindow.DrawLine( mx+x1,my+y1, mx+xb, my+yb)
          
          x1=xb
          y1=yb
          f1=f2
          l580:
        EndFor 
      EndFor 
      'draw wide-circle'
      For p=-90+d To 90-d Step d
        f1=0
        For l=0 To 360 Step d5
          sbb()
          If yy>0 Then
            f2=0
            f1=0
            Goto l680
          EndIf
          xb=Math.Floor (u+xx+h)
          yb=Math.Floor (v+zz+h)
          f2=1
          If f1=0 Then
            x1=xb
            y1=yb
            f1=1
            Goto l680
          EndIf
          GraphicsWindow.DrawLine( mx+x1,my+y1, mx+xb, my+yb)
          x1=xb
          y1=yb
          f1=f2
          l680:
        EndFor 
      EndFor 
    EndSub
    
    Sub sbb 'sfere-coordinates>>>Cartesis Coordinate'
      x=r*Math.Cos (p*bm)*Math.Cos (l*bm)
      y=r*Math.Cos (p*bm)*Math.Sin (l*bm)
      z=r*Math.Sin (p*bm)
      xx=ax*x+ay*y+az*z
      yy=bx*x+by*y+bz*z
      zz=cx*x+cy*y+cz*z
    EndSub








    • Edited by Tryhest Friday, April 19, 2019 5:09 AM
    Friday, April 19, 2019 4:05 AM
  • Sunday, April 21, 2019 3:50 AM
  • sb online issue: (takes a longtime redraw)


    GraphicsWindow.BackgroundColor ="green"
    GraphicsWindow.PenColor ="yellow"
    GraphicsWindow.PenWidth =3
    
    f7=0.72
    pi=Math.Pi/180
    
    For xxx=1 To 5
      egg()
    EndFor
    
    Sub ColorwwHSLtoRGB
       If wwl <= 0.5 Then
         rN2 = wwl * (1 + wws)
       Else
         rN2 = wwl + wws - wwl * wws
       EndIf
       rN1 = 2 * wwl - rN2
       If wws = 0 Then
         iR = Math.Round(wwl * 255)
         iG = Math.Round(wwl * 255)
         iB = Math.Round(wwl * 255)
       Else
         rH = wwh + 120
         ColorwwValue()
         iR = iValue
         rH = wwh
         ColorwwValue()
         iG = iValue
         rH = wwh - 120
         ColorwwValue()
         iB = iValue
       EndIf
       GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(iR, iG, iB)
    EndSub
    
    Sub ColorwwValue
       If rH >= 360 Then
         rH = rH - 360
       EndIF
       If rH < 0 Then
         rH = rH + 360
       EndIF
       If rH < 60 Then
         rV = rN1 + (rN2 - rN1) * rH / 60
       ElseIf rH < 180 Then
         rV = rN2
       ElseIf rH < 240 Then
         rV = rN1 + (rN2 - rN1) * (240 - rH) / 60
       Else
         rV = rN1
       EndIf
       iValue = Math.Round(rV * 255)
    EndSub
    
    Sub egg
      hh=Math.GetRandomNumber(360)
      dx=Math.GetRandomNumber(400)
      dy=Math.GetRandomNumber(350)
      r=50
      For r1=1 to 3
        r=r-2
        wwh=hh
        wws=1
        wwl=1-r/100
       ColorwwHSLtoRGB()
       x=0
        For x1=0 To 180
          y =Math.SquareRoot (Math.Abs(Math.Sin(x*pi)+0.1*Math.Sin(2*x*pi)))*r
          If x>0 Then
            GraphicsWindow.DrawLine (dx+oy+100, dy+155-(x-1)*f7, dx+y+100, dy+155-x*f7 )
            GraphicsWindow.DrawLine (dx+100-oy, dy+155-(x-1)*f7, dx+100-y, dy+155-x*f7 )
          EndIf
          oy=y
          x=x+1
        EndFor
      EndFor
    EndSub

    Sunday, April 21, 2019 4:40 AM
  • in the meanwhile java-sb can draw 250 eggs in a fraction of time:

    (with small bugs however)

    Sunday, April 21, 2019 5:20 AM
  • as for now we have many sb issues and editions with pro's and contras:

    • the most stabile and reliable is still sb1.2 desktop+ld xtension+ Sb Prime editor
    • sb-java is very fast but has some bugs and very annoying grammar, no xtenstons but can be easily upgraded in java code, UC/lc differences <math.> is not as <Math.>, no ommision of " and , ...
    • sb online 1.0 is nice look but catastrophic slow in graphic draw, the program is easily lost if back/refresh is pressed, doesn't import/publish yet, no xtensions,different array usage...

    • Edited by Tryhest Sunday, April 21, 2019 5:33 AM
    Sunday, April 21, 2019 5:31 AM
  • easter labyrinth:BZV866

    egg image:

    • Edited by Tryhest Sunday, April 21, 2019 7:14 PM
    Sunday, April 21, 2019 7:13 PM
  • added floodfill solution: NDR599

    Sunday, April 21, 2019 7:38 PM
  • upgraded nonki's disabled sign: DVL670

    use lmb+mswheel to rotate, wheel to zoom in/out

     

    Wednesday, April 24, 2019 12:00 AM
  • adapted for sb-java:

    GraphicsWindow.Title = "Pictogram - Handicapped Accesible Sign"
    GraphicsWindow.Width = 600
    GraphicsWindow.Height = 600
    border = "#666666"
    blue = "#155196"
    GraphicsWindow.PenWidth = 2
    GraphicsWindow.PenColor = border
    GraphicsWindow.BrushColor = "White"
    param["x"]=1
    param["y"]=1
    param["width"]=598
    param["height"]=598
    param["border-radius"]=50
    
    GW_FillRoundRectangle()
    GW_DrawRoundRectangle()
    
    param["x"]=15
    param["y"]=15
    param["width"]=570
    param["height"]=570
    param["border-radius"]=35
    GraphicsWindow.BrushColor = blue
    GW_FillRoundRectangle()
    GraphicsWindow.PenWidth = 40
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.DrawEllipse(113, 246, 280, 280)
    GraphicsWindow.BrushColor = blue
    GraphicsWindow.FillRectangle(253, 216, 160, 160)
    GraphicsWindow.PenWidth = 68
    GraphicsWindow.PenColor = blue
    GraphicsWindow.DrawLine(212, 98, 228, 290)
    GraphicsWindow.PenWidth = 40
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.DrawLine(212, 98, 228, 320)
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillEllipse(188, 50, 87, 87)
    GraphicsWindow.PenWidth = 84
    GraphicsWindow.PenColor = blue
    GraphicsWindow.DrawLine(378, 306, 452, 490)
    GraphicsWindow.PenWidth = 40
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.DrawLine(379, 327, 442, 470)
    GraphicsWindow.DrawLine(225, 250, 352, 250)
    GraphicsWindow.DrawLine(227, 320, 370, 320)
    GraphicsWindow.DrawLine(444, 475, 500, 447)
    
    Sub GW_DrawRoundRectangle
      Stack.PushValue("local", param)
      Stack.PushValue("local", local)
      local = param
      param = ""
      param["r"] = local["border-radius"]
      If (local["width"] / 2 < param["r"]) Or (local["height"] / 2 < param["r"]) Then
        param["r"] = Math.Min(local["width"] / 2, local["height"] / 2)
      EndIf
      param["da"] = 5
      param["x"] = local["x"] + param["r"]
      param["y"] = local["y"] + param["r"]
      param["a1"] = 180
      param["a2"] = 270
      GW_DrawArc()
      GraphicsWindow.DrawLine(local["x"] + param["r"], local["y"], local["x"] + local["width"] - param["r"], local["y"])
      param["x"] = local["x"] + local["width"] - param["r"]
      param["y"] = local["y"] + param["r"]
      param["a1"] = 270
      param["a2"] = 360
      GW_DrawArc()
      GraphicsWindow.DrawLine(local["x"] + local["width"], local["y"] + param["r"], local["x"] + local["width"], local["y"] + local["height"] - param["r"])
      param["x"] = local["x"] + local["width"] - param["r"]
      param["y"] = local["y"] + local["height"] - param["r"]
      param["a1"] = 0
      param["a2"] = 90
      GW_DrawArc()
      GraphicsWindow.DrawLine(local["x"] + param["r"], local["y"] + local["height"], local["x"] + local["width"] - param["r"], local["y"] + local["height"])
      param["x"] = local["x"] + param["r"]
      param["y"] = local["y"] + local["height"] - param["r"]
      param["a1"] = 90
      param["a2"] = 180
      GW_DrawArc()
      GraphicsWindow.DrawLine(local["x"], local["y"] + param["r"], local["x"], local["y"] + local["height"] - param["r"])
      local = Stack.PopValue("local")
      param = Stack.PopValue("local")
    EndSub
    
    Sub GW_FillRoundRectangle
      Stack.PushValue("local", param)
      If (param["width"] / 2 < param["border-radius"]) Or (param["height"] / 2 < param["border-radius"]) Then
        param["border-radius"] = Math.Min(param["width"] / 2, param["height"] / 2)
      EndIf
      GraphicsWindow.FillEllipse(param["x"], param["y"], param["border-radius"] * 2, param["border-radius"] * 2)
      GraphicsWindow.FillRectangle(param["x"] + param["border-radius"], param["y"], param["width"] - param["border-radius"] * 2, param["height"])
      GraphicsWindow.FillEllipse(param["x"] + param["width"] - param["border-radius"] * 2, param["y"], param["border-radius"] * 2, param["border-radius"] * 2)
      GraphicsWindow.FillRectangle(param["x"], param["y"] + param["border-radius"], param["width"], param["height"] - param["border-radius"] * 2)
      GraphicsWindow.FillEllipse(param["x"], param["y"] + param["height"] - param["border-radius"] * 2, param["border-radius"] * 2, param["border-radius"] * 2)
      GraphicsWindow.FillEllipse(param["x"] + param["width"] - param["border-radius"] * 2, param["y"] + param["height"] - param["border-radius"] * 2, param["border-radius"] * 2, param["border-radius"] * 2)
      param = Stack.PopValue("local")
    EndSub
    
    Sub GW_DrawArc
      Stack.PushValue("local", param)
      Stack.PushValue("local", local)
      Stack.PushValue("local", a)
      local = param
      param = ""
      local["pw"] = GraphicsWindow.PenWidth
      local["pc"] = GraphicsWindow.PenColor
      local["bc"] = GraphicsWindow.BrushColor
      GraphicsWindow.BrushColor = local["pc"]
      local["r1"] = local["r"] - local["pw"] / 2
      local["r2"] = local["r"] + local["pw"] / 2
      For a = local["a1"] To local["a2"] Step local["da"]
        local["rad"] = Math.GetRadians(a)
        param["x1"] = local["x"] + local["r1"] * Math.Cos(local["rad"])
        param["y1"] = local["y"] + local["r1"] * Math.Sin(local["rad"])
        param["x2"] = local["x"] + local["r2"] * Math.Cos(local["rad"])
        param["y2"] = local["y"] + local["r2"] * Math.Sin(local["rad"])
        If local["a1"] < a Then
          GW_FillQuadrangle()
        EndIf
        param["x4"] = param["x1"]
        param["y4"] = param["y1"]
        param["x3"] = param["x2"]
        param["y3"] = param["y2"]
      EndFor
      GraphicsWindow.BrushColor = local["bc"]
      a = Stack.PopValue("local")
      local = Stack.PopValue("local")
      param = Stack.PopValue("local")
    EndSub
    
    Sub GW_FillQuadrangle
      GraphicsWindow.FillTriangle(param["x1"], param["y1"], param["x2"], param["y2"], param["x3"], param["y3"])
      GraphicsWindow.FillTriangle(param["x3"], param["y3"], param["x4"], param["y4"], param["x1"], param["y1"])
    EndSub
    

    Wednesday, April 24, 2019 12:24 AM
  • sb online issue: TKV170


    • Edited by Tryhest Wednesday, April 24, 2019 12:54 AM
    Wednesday, April 24, 2019 12:51 AM
  • updated nonki's carp: KTT043

    • reduced to 84 lines code
    • added zoom/rotate
    • added flashing colors

    Wednesday, April 24, 2019 4:30 AM
  • nonki shapes editor updated: CHH529

    • ld xtension required
    • added new rightclick menu features
    • reduced 1000 lines
    • color changes
    • svg changed in order to be visible with chrome
    • other small changes



    • Edited by Tryhest Thursday, April 25, 2019 7:43 AM
    Thursday, April 25, 2019 7:42 AM
  • icons for shapes editor:

    copy

    cut

    paste

    repeat

    open

    save

    Thursday, April 25, 2019 9:06 AM
  • new iconset for shapes editor w standard menu:

    Thursday, April 25, 2019 10:58 AM
  • new shapes model shell: PDT672

    started to develop a new shell for nonki's shapes app

    it uses a complete new shell bcs nonki's is way too complex to add new items

    this new shell will enable to do much more and with much bigger precision

    further editions will include:

    • SVG and HTML import/export
    • javascript code for drawing
    • SB import/export
    • 100% compatibility w nonki's shapes format
    • ms powerpoint import/export

    usage tips:

    • after object is selected from menu it creatres a default object (e.g. rectangle 100x50 px)
    • u can move it around with mouse
    • while moving u can adjust zoom and rotation by lmb/rmb+mswheel
    • u can unzoom and unrotate at anytime by rightclick menu options unzoom/unrotate
    • ballons can't be changed colors and text and outline after creation (for now)

     

    Friday, April 26, 2019 4:02 AM
  • nonki's butterfly now flies! JDS861

    use mswheel to fly, lmb+wheel to rotate

    (ld xtenstion required)

    Friday, April 26, 2019 3:56 PM
  • Jupiter & blinking stars: QGT518

    • based on nonki's jupiter
    • reduced lines
    • speedup draw
    • added blinking stars
    • ld xtension req.

    base pic:

    Saturday, April 27, 2019 3:50 AM
  • saturn: RWB273

    (ld xt req.)

    Saturday, April 27, 2019 4:48 AM
  • 3D Textures: e.g.

    Planet Maps

    planet texture maps

    and a lot more

    Saturday, April 27, 2019 8:41 AM
    Answerer
  • it's too simple to code like that eheh: (with ld xtension)

    GraphicsWindow.BackgroundColor="darkblue"
    dw=desktop.Width
    dh=desktop.Height
    GraphicsWindow.width=dw
    GraphicsWindow.Height=dh
    GraphicsWindow.Top=0
    GraphicsWindow.Left=0
    
    view3D = LD3DView.AddView(dw,dh,"True")
    LD3DView.AddAmbientLight(view3D "#77777777")
    LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10)
    LD3DView.AddDirectionalLight (view3D,"white" ,-1,-1,-1)
    LD3DView.AutoControl2 (1 1)
    mss=LD3DView.AddSphere (view3D 1 20 "red" "d")
    ii=ImageList.LoadImage("e:\marsmap.jpg")
    LD3DView.AddImage(view3D mss "" ii "D")
    LD3DView.AnimateRotation(view3D mss 0 0 1 0, -360 90,-1)

    result:

    Saturday, April 27, 2019 11:45 AM
  • it seems we have a big head on mars!

    Saturday, April 27, 2019 11:48 AM
  • ... that swallows Mt.Everest 3x.

    But theres another one on this planet

    Saturday, April 27, 2019 12:47 PM
    Answerer
  • strange but it's a perfect head with curved hair and big beard 
    Saturday, April 27, 2019 5:41 PM
  • Humans are pre-programmed to see faces in anything...


    Saturday, April 27, 2019 8:51 PM
    Moderator
  • phobos 3d model wireframe: PSV325

    Saturday, April 27, 2019 8:55 PM
  • Uups, think i found him, does'nt look like Cydonia or a vulcano nor Madonna on a toast.

      JCS

    Just like seeing deers, other animals, faces and persons in a waterfall, mountainsides or clouds aso.

    Saturday, April 27, 2019 9:08 PM
    Answerer
  • small planetarium:XZF459

    rightclick to select planet/moon

    images to include:

    neptune

    earth

    moon

    venus

    mercury

    jupiter

    Monday, April 29, 2019 4:12 AM
  • shapes3 updt 0.2: VJW228-0

    Tuesday, April 30, 2019 10:43 AM
  • xor gate simulator viewer: TXD725

    Wednesday, May 1, 2019 2:52 AM
  • combined nonki's goat and frame: VWJ159

    (ld xtension needed)

    Wednesday, May 1, 2019 10:35 AM
  • shapes3 update 0.3: XCL270

    • added opening of nonki's shape files (rename it to .nsh)
    • added object precision docker


    • Edited by Tryhest Thursday, May 2, 2019 5:40 AM
    Thursday, May 2, 2019 5:11 AM
  • demo of new LDGeography database:

    (found in prerelease of the LD xtension)

    aa=LDGeography.GetAllCountries()
    bb=Array.GetAllIndices(aa[1])
    cc=Array.GetItemCount(bb)
    ll=LDControls.AddListView(1600 900 bb)
    lii=LDList.CreateFromValues("")
    GraphicsWindow.Title="Countries: "+Array.GetItemCount(aa)
    For x=1 To Array.GetItemCount(aa)
      vv=""
      For y=1 To cc
        If y=0 Then
          qq=x
        Else
          qq=aa[x][bb[y]]
        EndIf
        mm=""
        If Text.StartsWith(qq "1=") Then
          ct=Array.GetItemCount(qq)
          For f=1 To ct
            mm=mm+qq[f]
            If ct>1 Then
              mm=mm+"| "
            EndIf
          EndFor
        Else
          mm=qq
        EndIf
        
        If mm="" Then
          vv[y]="-/-"
        Else
          vv[y]=mm
        EndIf
      EndFor
      qq=aa[x][bb[1]]
      If qq="" Then
      Else
        LDList.Add(lii vv)
      EndIf
    EndFor
    LDList.SortByText(lii)
    ar=LDList.ToArray(lii)
    For t=1 To 250
      LDControls.ListViewSetRow(ll x ar[t])
    EndFor


    • Edited by Tryhest Friday, May 3, 2019 4:15 PM
    Friday, May 3, 2019 4:14 PM
  • collection of 250 world flags: CFK767

    Monday, May 6, 2019 5:55 AM
  • "Old~school" 3d plot: QNN392

    Tuesday, May 7, 2019 9:38 AM
  • SHAPES3  V 0.35 beta XPD736

    • click list to mark object added
    • new lst format open/save added

     

    Tuesday, May 7, 2019 11:03 PM
  • v0.40: HMB331

    • added group operations
    • rebuild objects ID
    • added arrays

    Wednesday, May 8, 2019 6:55 PM
  • The Compass game: LSP860

    • find target dots by the help of arrow
    • totat 60 secs to play
    • correct click 10 pts wrong -5
    • bonus added at end

    Thursday, May 9, 2019 5:58 AM
  • Gradients of 2-forces field: FMJ110

    use leftclick to set 1st force attractor and rmb for 2nd force

     
    Thursday, May 9, 2019 8:56 AM
  • a bit buggy game: DTJ730

    Friday, May 10, 2019 6:36 AM
  • the moontree house 3d study: CTZ827

    Friday, May 10, 2019 7:35 PM
  • can draw realistic images out of simple polys: NSL135-0

    usage is simple:

    • rigtclick and select polymode
    • click and make some poly, ondy dots appear
    • rightclick and select clear
    • rigtclick and select gradfl
    • choose 2 colors for gradients and grad.type (best are 2 and 3)
    • rightclick and choose drwpolymod
    • click and draw by slowly dragging mouse
    • if u like regular extrudes choose Xtrude and type height, then click for basepoint
    • also some hidden features and shortcuts to discover


    • Edited by Tryhest Sunday, May 12, 2019 6:54 AM
    Sunday, May 12, 2019 6:43 AM
  • 3d bridge: NRJ055

    (ld xtension req.)

    Tuesday, May 14, 2019 12:46 AM
  • new zx+ shell: ZWS254

    Friday, May 17, 2019 6:55 AM
  • added simple cmds run mode and vars:ZWS254-1

    Saturday, May 18, 2019 7:39 AM
  • added help also: ZWS254-2

    to see help press&release alt then press ? twice, then press cmd key

    Saturday, May 18, 2019 9:53 AM
  • atm box WCF798

    pw is 2234,

    serv.mode pw cnc-0-9-bck, sm diary 1000 

    sm exit: canc (000)
    • Edited by Tryhest Sunday, May 19, 2019 3:35 AM
    Sunday, May 19, 2019 3:31 AM
  • This thread will continue to small basic graphic and animation and more (12).

    Nonki Takahashi

    Wednesday, May 22, 2019 2:53 AM
    Moderator