home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #3
/
amigamamagazinepolishissue1998.iso
/
maksiu
/
kurs-ma
/
krzywa_smoka_przyklad.amos
/
krzywa_smoka_przyklad.amosSourceCode
Wrap
AMOS Source Code
|
1998-01-25
|
2KB
|
103 lines
Screen Open 0,320,256,16,Lowres
Curs Off : Palette $0,$FFF
Cls 1 : Flash Off : Ink 0,1
Dim D(2),X(2),Y(2)
Global D(),X(),Y(),X,Y
STP_SMOKA=11
' zmienna _STOPIE�_SMOKA zawiera warto�� okre�laj�c�
' ilo�� z�o�e� paska papieru
D�UGO��=(2^STP_SMOKA)-1
' zmienna D�UGO��_SMOKA zawiera warto�� okre�laj�c� d�ugo�� smoka
' (ilo�� skr�t�w)
Reserve As Data 10,D�UGO��
D(1)=Start(10)
Poke D(1),1
Poke D(1)+1,1
Poke D(1)+2,0
D(2)=2
For P=1 To STP_SMOKA
KONIEC_SMOKA=D(1)+D(2)
Poke KONIEC_SMOKA+1,1
Inc D(2)
For L=KONIEC_SMOKA To D(1) Step -1
Inc D(2)
If Peek(L)
Poke D(1)+D(2),0
Else
Poke D(1)+D(2),1
End If
Next L
Next P
Plot 100,72
X(1)=100 : Y(1)=72
X(2)=100 : Y(2)=70
X=100 : Y=70
For P=D(1) To D(1)+D(2)
B=Peek(P)
If B
LEWO
Else PRAWO
End If
Next P
Erase All
End
Procedure LEWO
If Y(1)=Y(2)
If X(1)>X(2)
Add Y,2
End If
If X(1)<X(2)
Add Y,-2
End If
End If
If X(1)=X(2)
If Y(1)<Y(2)
Add X,2
End If
If Y(1)>Y(2)
Add X,-2
End If
End If
X(1)=X(2)
Y(1)=Y(2)
Y(2)=Y
X(2)=X
Draw To X(2),Y(2)
End Proc
Procedure PRAWO
If Y(1)=Y(2)
If X(1)>X(2)
Add Y,-2
End If
If X(1)<X(2)
Add Y,2
End If
End If
If X(1)=X(2)
If Y(1)<Y(2)
Add X,-2
End If
If Y(1)>Y(2)
Add X,2
End If
End If
X(1)=X(2)
Y(1)=Y(2)
Y(2)=Y
X(2)=X
Draw To X(2),Y(2)
End Proc