FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/101.bas at master · smallbasic/smallbasic.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
smallbasic
/
smallbasic.github.io
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
101.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
105 lines (94 loc) · 1.64 KB
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
101.bas
Copy path
File metadata and controls
105 lines (94 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
'
'' Program: Stars.bas
'
' Author: Alberto Fornasari
'
' Version: 2.1
'
' Date: 22/06/2002
'
' =================
'
' Useful constants
'
' ===========
reset
=
chr
$(
27
)+
"
[0m
"
boldOn
=
chr
$(
27
)+
"
[1m
"
boldOff
=
chr
$(
27
)+
"
[21m
"
'
' General introduction and main input
'
' ========================
label Start
Frame
=
YMAX
-16
gosub
InitialFrame
at
35
,
20
?
boldOn
+
"
Program: STARS
"
+
boldOff
at
17
,
50
?
"
--------- Version 2.1 ----------
"
at
17
,
60
?
"
AlbertoFornasari@hotmail.com
"
at
17
,
90
?
"
Draw stars with N sharp points.
"
at
17
,
100
?
"
With N integer greater than 2.
"
at
17
,
110
?
"
After drawing, strike any key.
"
at
17
,
YMAX
-11
sound
440
,
100
,
25
N
=
0
input
"
Enter N to start or 0 to QUIT:
"
,
N
N
=
int
(
N
)
if
N
=
0
then
goto
Quit
if
N
<
3
then
N
=
3
'
' Central circle drawing
'
' ===============
Frame
=
YMAX
-1
gosub
InitialFrame
Xc
=
int
((
XMAX
-1
)/
2
)
Yc
=
int
((
YMAX
-1
)/
2
)
Ofset
=
11
Radius
=
Yc
-
Ofset
circle Xc,
Yc
,
Radius
color
15
filled
circle Xc,
Yc
,
Radius
color
0
'
'Analysis and drawing
'
' ==============
if
(
N
MOD
2
)=
0
then
N
=
N
/
2
Sign
=
-1
gosub
DrawStar
endif
Sign
=
1
gosub
DrawStar
'
' Ending and waiting for restart
'
' ====================
sound
880
,
100
,
25
pause
goto
Start
'
' Quiting
'
' =====
label Quit
? reset
cls
stop
'
' === Subroutines ===
'
' Soubroutine InitialFrame
'
' =================
Label InitialFrame
? reset
cls
rect
0
,
0
,
XMAX
-1
,
Frame
color
9
filled
rect
0
,
0
,
XMAX
-1
,
Frame
color
0
return
'
'Soubroutine DrawStar
'
' ===============
Label DrawStar
'
' Initial conditions (loop preparation)
A
=
PI
/
2
/
N
B
=
A
Q
=
2
*Radius*
cos
(
A
)
X
=
Xc
Y
=
Yc
-
Sign
*Radius
line X,
Y
,
X
,
Y
'
' Lines drawing loop
for
i
=
1
to
N
X
=
X
+
Sign
*Q*
sin
(
B
)
Y
=
Y
+
Sign
*Q*
cos
(
B
)
line
round
(
X
),
round
(
Y
)
B
=
B
+
PI
+
2
*A
next
i
return
'
' ======
end
'
Back
|
FazBrowse Home
|
New Git URL