Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Tree Recursion

  1. #11
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,818
    Rep Power
    10
    No, no, it means he/she used a recursive algorithm in order to find an apartment and thanks to that he/she succeeded.

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #12
    Eros,

    You are truly the eternal optimist. Continuing with PB as your foundation of your BASIC is a testimonial of your faith.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  3. #13
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    I discovered this thread tonight, had to join the fun

    Wow, what a fun thread. I had fun tonight playing with your guys code!!! Thanks.

    My Fun:
    'Press SpaceBar to make new trees, ESC to Exit
    Uses "ui", "math"
    #INCLUDE "abc.inc"
    OpenWindow 800, 600
    SetHandleDC hdc, hwnd
    Dim depth As Long
    Boolean cnt = FALSE 
    
    Sub MainDraw(x1, y1 As Long, angle As Single, d As Long)
        Dim x2, y2 As Long
        If d > 0 Then
            x2 = x1 + Cos(DegToRad(angle)) * d * Rnd(5, 12)
            y2 = y1 + Sin(DegToRad(angle)) * d * Rnd(5, 12)
            Select Case Rnd(1,3)  
                Case 1 : DrawLine x1, y1, x2, y2, d, Rgb(180-d*10, 100-d, 100)  
                Case 2 : DrawLine x1, y1, x2, y2, d, Rgb(180-d*10, 90-d, 75)
                Case 3 : DrawLine x1, y1, x2, y2, d, Rgb(180-d*10, 80-d, 50)
            End Select
            If cnt = TRUE Then 
            'DrawPoint(x2,y2,Rnd(5,20),Rnd(5,20),Rgb(0, 255-(d*25), 0)) 
            DrawCircle(x2,y2,Rnd(5,20),Rnd(1,11),Rgb(0, 255-(d*25), 0))
            EndIf
            'Canvas_Redraw  'uncomment this if you want to see the tree draw
            MainDraw(x2, y2, angle - 20, d-1)
            MainDraw(x2, y2, angle + 20, d-1) 
            cnt = TRUE
        End If
    End Sub  
    
    Randomize
    Do
        Canvas_Clear &HFFF8F8 
        DrawPoint(0,550,800,50,Rgb(0, 175, 0)) 
        For depth = 1 To 10000
            SetPixel(Rnd(0,800),Rnd(550,600),Rgb(Rnd(50,200), Rnd(50,255), 0))
        Next
        depth = Rnd(8, 10)
        MainDraw(400, 600, -90, depth)
        Canvas_Redraw 
        cnt = FALSE
    Loop While Asc(Canvas_WaitKey) <> 27
    Canvas_Window End hwnd
    
    abcTree.png A Southern Oak Tree
    Last edited by kryton9; 12-05-2017 at 06:11.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #14
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,155
    Rep Power
    736
    Pretty stylish tree, I like this modern art


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 2 of 2 FirstFirst 12

Similar Threads

  1. A nice (verbal) example of recursion
    By RobbeK in forum General
    Replies: 2
    Last Post: 25-03-2014, 02:05
  2. Replies: 1
    Last Post: 22-12-2010, 22:41
  3. Various types of recursion
    By Petr Schreiber in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 6
    Last Post: 25-05-2010, 06:38
  4. Expanded tree
    By kryton9 in forum thinAir General
    Replies: 1
    Last Post: 21-02-2008, 22:44
  5. tree view?
    By sandyrepope in forum UI (User Interface)
    Replies: 3
    Last Post: 16-07-2007, 18:18

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •