-
Notifications
You must be signed in to change notification settings - Fork 0
/
KREISBAH.PAS
executable file
·93 lines (82 loc) · 1.92 KB
/
KREISBAH.PAS
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
program kreisbahn;
uses crt,graph;
var
treiber,modus:integer;
r,rmond,t,dt,phi,alpha,xmond,ymond,x,y:real;
wahl:char;
Zeit:string;
procedure graphik;
begin
treiber:=detect;
initgraph(treiber,modus,'');
setbkcolor(1);
setcolor(15);
outtextxy(220,30,'Erde-Mond-Bewegung um die Sonne');
outtextxy(470,430,'pause -> p');
outtextxy(465,440,'weiter -> w');
outtextxy(400,450,'doppelte Geschwindigkeit -> d');
outtextxy(420,460,'halbe Geschwindigkeit -> h');
outtextxy(460,470,'beenden -> b');
outtextxy(10,450,'Tage:');
end;
procedure umlauf;
begin
r:=150;
rmond:=10;
t:=0;
dt:=0.01;
wahl:=' ';
x:=0;
xmond:=0;
ymond:=rmond;
y:=r;
setcolor(14);setfillstyle(1,14);
sector(320,240,0,360,7,7);
setcolor(11);setfillstyle(1,11);
sector(320+round(x),240-round(y),0,360,3,3);
setcolor(15);setfillstyle(1,15);
sector(320+round(x+xmond),240-round(y+ymond),0,360,2,2);
repeat until keypressed;
repeat
phi:=2*pi/365*t;
alpha:=2*pi/28*t;
setcolor(0);
sector(320+round(x),240-round(y),0,360,3,3);
sector(320+round(x+xmond),240-round(y+ymond),0,360,2,2);
setcolor(11);setfillstyle(1,11);
x:=r*sin(phi);
y:=r*cos(phi);
xmond:=rmond*sin(alpha);
ymond:=rmond*cos(alpha);
sector(320+round(x),240-round(y),0,360,3,3);
setcolor(15);setfillstyle(1,15);
sector(320+round(x+xmond),240-round(y+ymond),0,360,2,2);
setcolor(14);setfillstyle(1,14);
sector(320,240,0,360,7,7);
t:=t+dt;
setcolor(0);
outtextxy(50,450,Zeit);
setcolor(15);
str(t:5:0,Zeit);
outtextxy(50,450,Zeit);
if keypressed then wahl:=readkey;
case wahl of
'h':
begin
dt:=dt/2;
wahl:=' ';
end;
'd':
begin
dt:=dt*2;
wahl:=' ';
end;
'p':wahl:=readkey;
end;
until wahl='b';
end;
{Main}
begin
graphik;
umlauf;
end.