Author Topic: simple Mathematics  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
simple Mathematics
« on: December 29, 2012, 08:46:42 AM »
Deleted
« Last Edit: April 25, 2015, 04:09:00 AM by Peter »

Aurel

  • Guest
Re: simple Mathematics
« Reply #1 on: December 29, 2012, 01:25:13 PM »
Ok..
That's why I ask on retrogamecoding:
Code: [Select]
include "easy.inc"
include "turtle.inc"

screen 640,480,1
setcaption "Fractal Ant"

CLS Rgb(0,0,140)

goxy (120, 220)
turnright(90)

function koch(x, t)

IF t > 2
t=t-1
x=x/3
koch(x, t)
turnleft(45)
koch(x, t)
turnright(90)
koch(x, t)
turnleft(45)
koch(x, t)
ELSE
forward(2*x)
END IF

end function
for x = 1 to 4
koch(128,4)
turnright(180)
next

waitkey(27)
closewindow                 

and here is turtle.inc
Code: [Select]
'TURTLE include file
INT k = 0
INT posx = 0
INT posy = 0
INT drawing = 0
INT color =0
'------------------------------------------------
Function Color( r as int,g as int,b as int )
INT rgbColor = 0
rgbColor = RGB(r,g,b)
Return rgbColor
End Function
'-----------------------------------------------
Function forward(d as INT)

    INT a, b, x, y
    a = sin(k * pi / 180) * d
    b = cos(k * pi / 180) * d
    x = posx + a
    y = posy - b
   
    LINE (posx, posy, x, y,1, 0xFFFFFF )
   
    posx = x
    posy = y
   
End Function
'------------------------------------------
function backward(d as INT)

    INT a, b, x, y
    a = sin(k * pi / 180) * d
    b = cos(k * pi / 180) * d
    x = posx - a
    y = posy + b
   
  LINE (posx, posy, x, y,1, 0xFFFFFF)
   
    posx = x
    posy = y
   
End Function
'-------------------------------------------
function turnright(z as int)
    k = k + z
    if k > 360
        k = k - 360
    end if
    if k < 0
        k = k + 360
    end if
end function

function turnleft (z as int)
    k = k - z
    if k > 360
        k = k - 360
    end if
    if k < 0
        k = k + 360
    end if
end function

function penup(drawing as int) as int
    drawing = 0
return drawing
end function

function penup(drawing as int) as int
    drawing = 1
return drawing
end function

function goxy(zx as int, zy as int)
    posx = zx
    posy = zy
end function


X

JRS

  • Guest
Re: simple Mathematics
« Reply #2 on: December 29, 2012, 03:31:36 PM »
Quote
And I found this,  looks like AureBasic!

Looks more like TinyBasic.

JRS

  • Guest
Re: simple Mathematics
« Reply #3 on: December 29, 2012, 06:15:15 PM »
Quote
seems the same thing!

 ;D

Aurel

  • Guest
Re: simple Mathematics
« Reply #4 on: December 29, 2012, 10:56:48 PM »
So what if is written by someone else....freak :P
Work for me and if you don't like ,that is your problem....
oohh poor Peter is jelous... :D :D :D :D :D :D :D :D

by the way your examples are ordinary crap.. ;D
« Last Edit: December 29, 2012, 11:13:20 PM by Aurel »

JRS

  • Guest
Re: simple Mathematics
« Reply #5 on: December 30, 2012, 06:34:42 AM »


Look out Peter, Aurel's pissed.


Aurel

  • Guest
Re: simple Mathematics
« Reply #6 on: July 21, 2013, 10:16:42 AM »
Because i am wired with fractal antennas here is brand new Minkowski Islands fractal...
Code: [Select]
include "awinh.inc"
#lookahead
INT win
'GLOBALS for drawing to DC -------------------------------------------- 
INT hdc, hdcMem, hbmMem,   oldBmp, oldBrush, oldPen, oldFont, fColor,bColor
INT textX,textY,hBrush
INT ww,hh
INT wstyle = WS_MINMAXSIZE Or WS_CLIPCHILDREN
'create main window ****************************************************
win = SetWindow("Minkowski",40,40,600,550,0,wstyle)
InitDrawing(win)

sys k, posx, posy

goxy (20, 20)
turnright(90)

Function Mink(sys x, t) as sys
    if t > 0.2
t=t-1
x=x/3

TextColor win,RGB(x,130,190)
Mink(x, t)
turnright(90)

Mink(x, t)
turnleft(90)

TextColor win,RGB(150,x,180)
Mink(x, t)
turnleft(90)

    Mink(x,t)
    turnright(90)

Mink(x, t)
     else
  forward(x*6)
     end if
End Function

for x = 1 to 4
    Mink(140,4)
    turnright(90)
next

'------------------------------------------------------------------------
Wait()
'------------------------------------------------------------------------
Function WndProc (byval hwnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback

Select hwnd
'>>>>>>>>>>>>>>>>>>>>>>>>>

Case win
'>>>>>>>>>>>>>>>>>>>><<<
Select wMsg
'----------------------------
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
'----------------------------
Case WM_CLOSE
If win <> 0
     CleanUp()
CloseWindow(win)
EndProgram
End If
End Select

End Select

Return Default

End Function

'-------------------------------------------------------------------------
'================================================
SUB InitDrawing(byval wnd as INT)
'INT ww,hh
''get current size of window
GetSize(wnd,0,0,ww,hh)
'get window DC
hdc=GetDC(wnd)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, ww, hh)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wnd, hdc)
End SUB

'=================================================
SUB TextColor (wID as INT,byval frontColor as sys)
hdc = GetDC(wID)
sys bColor
fColor=frontColor
bColor = RGB(231,223,231)
SetTextColor( hDC, frontColor)
SetBkColor( hDC, bColor)

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wID, hdc)

End SUB
'=================================================
Sub TextOn( int wnd,sys x, y, string txt)
'INT ww,hh
hdc=GetDC(wnd)
GetSize(wnd,0,0,ww,hh)
TextOut sys_hdc,x,y,txt,Len(txt)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC(wnd,Hdc)
End Sub

'=================================================
SUB LineXY (wID as INT,Lx as INT,Ly as INT,Lx1 as INT,Ly1 as INT)

hdc = GetDC(wID)
GetSize(wID,0,0,ww,hh)
SelectObject(hdc, CreatePen(PS_SOLID,1,fColor))

MoveToEx hdc,Lx,Ly,Byval 0
LineTo hdc,Lx1,Ly1

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
SUB Pset (wID as int , px as int ,py as int)
hdc = GetDC(wID)
'GetSize(wID,0,0,ww,hh)
SetPixel ( hdc, px, py, fColor)

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wID, hdc)

End SUB
'//////////////////////////////////////////////
SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
End SUB
'/////////////////////////////////////////////

'************************************
'    TURTLE FUNCTIONS               
'************************************
Function forward(sys d) as sys
    sys a, b, x, y
    a = sin(k * pi / 180) * d
    b = cos(k * pi / 180) * d
    x = posx + a
    y = posy - b
    LineXY (win,posx, posy, x, y)
    posx = x
    posy = y
End Function
'------------------------------------------
Function backward(sys d) as sys
    sys a, b, x, y
    a = sin(k * pi / 180) * d
    b = cos(k * pi / 180) * d
    x = posx - a
    y = posy + b
    LineXY(win,posx, posy, x, y)
    posx = x
    posy = y
End Function
'-------------------------------------------
Function turnright(sys z) as sys
    k = k + z
    if k > 360
        k = k - 360
    end if
    if k < 0
        k = k + 360
    end if
End Function
'---------------------------------------------
Function turnleft(sys z) as sys
    k = k - z
    if k > 360
        k = k - 360
    end if
    if k < 0
        k = k + 360
    end if
End Function
'----------------------------------------------
Function penup(sys drawing) as sys
    return drawing
End Function
'----------------------------------------------
Function goxy(sys zx, zy) as sys
    posx=zx
    posy=zy
End Function
'----------------------------------------------

           

X