home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 May
/
PCW596.iso
/
polskie
/
eduk
/
genfast
/
genfast.lzh
/
DEMO_10.PAK
/
FUNKCJE.DA_
< prev
next >
Wrap
Text File
|
1996-03-16
|
7KB
|
308 lines
; Program przykÆadowy z matematyki. Wykresy funkcji.
; Na tablicy rysowane så funkcje, które wybiera siæ klawiszami
; z prawej strony tablicy, w kolorze wybranym w pasku przewijania
; znajdujåcym siæ pod spodem tablicy.
; Bajerki: gåbka (wyciera z tablicy wykres(y) narysowane w danym
; kolorze (klawisze funkcji nie så wtedy aktywne), kreda, którå
; trzeba wybraì po skoñczeniu wycierania gåbkå oraz biaÆa ₧cierka,
; wiszåca z lewej strony u doÆu tablicy, którå w dowolnym momencie
; moºna wytrzeì caÆå tablicæ ze wszystkich wykresów.
; Wyj₧cie z programu zapewnia procedura @defkeyboardhandler, która
; w stronie [50] uruchamia wyj₧cie z programu klawiszem [Esc].
[procedure TABLICA]
; tablica jest czarna, ma niebieskie 'pas-par-tout', a ukÆad wspóÆrzædnych
; jest narysowany w kolorze szarym
@downarea(100,100,500,400,0)
; maÆa kreda
@uparea(380,412,395,415,15)
; gåbka
@uparea(410,395,445,415,6)
@SetColors(7,7)
; o₧ X
@line(110,250,490,250)
; strzaÆka na osi X
@line(480,245,490,250)
@line(480,255,490,250)
; o₧ Y
@line(300,110,300,390)
; strzaÆka na osi Y
@line(295,120,300,110)
@line(305,120,300,110)
@SetPosition(303,253)
@fastwrite('0,0')
@line(350,250,350,255)
@SetPosition(353,253)
@fastwrite('1,0')
@line(400,250,400,255)
@SetPosition(403,253)
@fastwrite('2,0')
@line(450,250,450,255)
@SetPosition(453,253)
@fastwrite('3,0')
@line(300,200,305,200)
@SetPosition(303,203)
@fastwrite('0,1')
@line(300,150,305,150)
@SetPosition(303,153)
@fastwrite('0,2')
; linie dodatkowe ujemne na X
@line(150,250,150,255)
@line(200,250,200,255)
@line(250,250,250,255)
; linie dodatkowe ujemne na Y
@line(300,300,305,300)
@line(300,350,305,350)
@return
[procedure FUNKCJA]
@d:=%a-200
@e:=-200
@i:=0;
@repeat:400
; wszelkie wspóÆczynniki så wynikiem 'kontekstu ekranu'
@if (%g = 11) then begin
@f:=-%e*%e/50
@end
@if (%g = 12) then begin
@if (%e < 0) then goto:2
@f:=-ln(%e*10)*5
@end
@if (%g = 13) then begin
@if (%e < 0) then goto:2
@f:=-exp(%e/20)
@end
@if (%g = 14) then begin
@f:=-log(%e)*30
@end
@if (%g = 15) then begin
@f:=-%e*%e*%e/2000
@end
@if (%g = 16) then begin
@f:=-%e*sin(%e/20)
@end
@if (%g = 17) then begin
@f:=-%e*cos(%e/20)
@end
@if (%g = 18) then begin
@f:=-(%e^2/100)*cos(%e/20)
@end
@if (%g = 19) then begin
@f:=-arctan(%e)*20
@end
@if (%g = 20) then begin
@f:=-arctan(%e)*20+sin(%e)*2
@end
@if (%g = 21) then begin
@f:=-%e*cos(%e/20)*sin(%e/20)
@end
@if (%g = 22) then begin
@if (%e < 0) then goto:2
@f:=-sqrt(%e)*6
@end
@if (%d < 100) then goto:2
@if (%d > 500) then goto:2
@if (%f+%b > 400) then goto:2
@if (%f+%b < 100) then goto:2
@if (%i=0) then begin
@putpixel(%d,%f+%b,%l);
@else
@SetColors(%l,%l);
@line(%i,%j,%d,%f+%b);
@end;
@i:=%d;
@j:=%f+%b;
[2]
@e:=%e+1
@d:=%d+1
@next
@return
[1]
@a:=300
@b:=250;
@l:=14
@defkeyboardhandler(50)
@disablestatusbar;
@SetColors(8,7)
@bar(270,65,330,86)
@uparea(250,80,350,86,0)
@line(85,479,135,400)
@line(135,400,155,400)
@line(155,400,105,479)
@line(85,479,105,479)
@fillarea(90,477,8)
@line(515,479,465,400)
@line(465,400,445,400)
@line(445,400,495,479)
@line(495,479,515,479)
@fillarea(497,477,8)
@uparea(75,415,525,420,0)
@uparea(85,85,515,415,1)
@call:tablica
; kreda
@SetColors(0,7)
@rectangle(200,440,400,470)
@SetColors(7,7)
@bar(210,435,310,443)
@SetPosition(217,433)
@SetColors(0,7)
@fastwrite('Kolor kredy')
@SetColors(0,7)
@drawbutton(210,445,240,465,8,23,'<','')
@drawbutton(360,445,390,465,8,24,'>','')
@SetColors(%l,7)
@bar(241,445,359,465)
; ₧cierka do tablicy
@SetColors(15,7)
@SetPosition(70,416)
@Picture('biala.cgv')
@SetColors(0,7)
@Picture('sciera.cgv')
; NAPIS "WYKRESY FUNKCJI" - jako zbiór .cgv
@SetColors(15,7)
@SetPosition(120,15)
@Picture('napis.cgv')
@SetColors(0,7)
@SetPosition(122,17)
@Picture('napis.cgv')
; klawisze zmiany ₧rodka ukÆadu wspóÆrzædnych
@SetColors(8,7)
@bar(5,100,40,400)
@bar(45,100,80,400)
@SetColors(7,7)
@drawbutton(7,102,38,150,7,30,'X+','')
@drawbutton(7,350,38,398,7,31,'X-','')
@drawbutton(47,102,78,150,7,32,'Y+','')
@drawbutton(47,350,78,398,7,33,'Y-','')
@setcolors(15,7)
@writevalue(7,151,38,349,0,0,(%a-300)/50)
@writevalue(47,151,78,349,0,0,(%b-250)/50)
; klawisze poszczególnych funkcji
@SetColors(7,7)
@setinvisiblebutton(70,420,100,470,28)
@drawbutton(530,90,630,110,7,11,'y=x^2','')
@drawbutton(530,115,630,135,7,12,'y=ln(x)','')
@drawbutton(530,140,630,160,7,13,'y=e^x','')
@drawbutton(530,165,630,185,7,14,'y=log(x)','')
@drawbutton(530,190,630,210,7,15,'y=x^3','')
@drawbutton(530,215,630,235,7,16,'y=x*sin(x)','')
@drawbutton(530,240,630,260,7,17,'y=x*cos(x)','')
@drawbutton(530,265,630,285,7,18,'y=x^2*cos(x)','')
@drawbutton(530,290,630,310,7,19,'y=arctan(x)','')
@drawbutton(530,315,630,335,7,20,'y=arctan*sin','')
@drawbutton(530,340,630,360,7,21,'y=xsinxcosx','')
@drawbutton(530,365,630,385,7,22,'y=sqrt(x)','')
@setinvisiblebutton(380,412,395,415,27)
@setinvisiblebutton(410,395,445,415,25)
@showscreen
@checkevents
[11..22]
@getcurrentpage(%k)
@g:=%k
@i:=100;
@call:funkcja
@checkevents
[23]
@l:=%l-1
@if (%l = 7) then begin
@l:=%l-1
@end
@if (%l < 1) then begin
@l:=1
@end
@SetColors(%l,7)
@bar(241,445,359,465)
@checkevents
[24]
@l:=%l+1
@if (%l = 7) then begin
@l:=%l+1
@end
@if (%l > 15) then begin
@l:=15
@end
@SetColors(%l,7)
@bar(241,445,359,465)
@checkevents
[25]
; wycieranie gåbkå wykresu w wybranym kolorze
@sound(300,100)
@deletebutton;
@setinvisiblebutton(515,0,639,479,60)
@setinvisiblebutton(0,0,1,1,60)
[26]
@deletebutton;
@setinvisiblebutton(100,100,500,400,51)
@checkevents
[51]
@I:=%X
@J:=%Y
@SetColors(%L,0);
@reversearea(%I-5,%J-5,%I+5,%J+5);
@GoTo:26
[27]
; wytarÆe₧ - teraz weª kredæ!
@sound(200,200)
@deletebutton;
@deletebutton;
@deletebutton;
@setinvisiblebutton(380,412,395,415,27)
@setinvisiblebutton(410,395,445,415,25)
@checkevents
[28]
@call:tablica
@checkevents;
[30]
@a:=%a+50
@if (%a > 450) then begin
@a:=450
@end
@SetColors(8,0)
@bar(7,151,38,349)
@setcolors(15,7)
@writevalue(7,151,38,349,0,0,(%a-300)/50)
@checkevents;
[31]
@a:=%a-50
@if (%a < 150) then begin
@a:=150
@end
@SetColors(8,0)
@bar(7,151,38,349)
@setcolors(15,7)
@writevalue(7,151,38,349,0,0,(%a-300)/50)
@checkevents;
[32]
@b:=%b-50
@if (%b < 150) then begin
@b:=150
@end
@SetColors(8,0)
@bar(47,151,78,349)
@setcolors(15,7)
@writevalue(47,151,78,349,0,0,-(%b-250)/50)
@checkevents;
[33]
@b:=%b+50
@if (%b > 350) then begin
@b:=350
@end
@SetColors(8,0)
@bar(47,151,78,349)
@setcolors(15,7)
@writevalue(47,151,78,349,0,0,-(%b-250)/50)
@checkevents;
[50]
; je₧li [Esc] to koniec!
@if (%z = $011B) then goto:0
@checkevents;
[60]
; nic nie rób tylko informuj !
@sound(440,50)
@checkevents