Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
DYPonomarev
Задание объекты. повысить оценку
Commits
9ba1c61d
Commit
9ba1c61d
authored
Oct 05, 2021
by
DYPonomarev
Browse files
Update Объекты.py
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Объекты.py
0 → 100644
View file @
9ba1c61d
import
math
as
m
dt
=
0.001
class
TAObject
:
def
__init__
(
self
,
x
,
y
):
self
.
f
=
True
self
.
x
=
x
self
.
y
=
y
def
__del__
(
self
):
print
(
'Destructor called. Object deleted!'
)
class
TLA
(
TAObject
):
def
__init__
(
self
,
x
,
y
,
xc
,
yc
,
v
):
super
().
__init__
(
x
,
y
)
self
.
xc
=
xc
self
.
yc
=
yc
self
.
r
=
m
.
sqrt
((
self
.
x
-
self
.
xc
)
**
2
+
(
self
.
y
-
self
.
yc
)
**
2
)
self
.
v
=
v
if
self
.
x
>
self
.
xc
:
self
.
b
=
0
elif
self
.
y
<
self
.
yc
:
self
.
b
=
-
1
elif
self
.
x
<
self
.
xc
and
self
.
y
>
self
.
yc
:
self
.
b
=
1
self
.
fi
=
self
.
b
*
m
.
pi
+
m
.
atan
((
self
.
y
-
self
.
yc
)
/
(
self
.
x
-
self
.
xc
))
self
.
landing
=
False
def
move
(
self
,
a
):
if
a
==
0
:
self
.
f
=
False
elif
a
==
1
:
self
.
f
=
True
class
TAircraft
(
TLA
):
def
__init__
(
self
,
x
,
y
,
xc
,
yc
,
v
):
super
().
__init__
(
x
,
y
,
xc
,
yc
,
v
)
self
.
types
=
'AC'
def
move
(
self
,
t
,
a
):
self
.
omega
=
-
self
.
v
/
self
.
r
self
.
x
=
-
(
self
.
xc
+
self
.
r
*
m
.
cos
(
self
.
fi
+
self
.
omega
*
t
))
*
(
a
-
1
)
+
a
*
(
self
.
x
+
self
.
v
*
dt
)
self
.
y
=
-
(
self
.
yc
+
self
.
r
*
m
.
sin
(
self
.
fi
+
self
.
omega
*
t
))
*
(
a
-
1
)
+
self
.
y
*
a
class
THelicopter
(
TLA
):
def
__init__
(
self
,
x
,
y
,
xc
,
yc
,
v
):
super
().
__init__
(
x
,
y
,
xc
,
yc
,
v
)
self
.
types
=
'HC'
def
move
(
self
,
a
):
self
.
x
=
self
.
x
-
a
*
self
.
v
*
m
.
cos
(
self
.
fi
)
*
dt
self
.
y
=
self
.
y
-
a
*
self
.
v
*
m
.
sin
(
self
.
fi
)
*
dt
class
TAirport
(
TAObject
):
def
__init__
(
self
,
x
,
y
,
l
,
LA
):
super
().
__init__
(
x
,
y
)
self
.
l
=
l
self
.
LA
=
LA
def
Do
(
self
,
t0
,
tk
):
while
t0
<
tk
:
for
aircraft
in
self
.
LA
:
X
=
self
.
x
+
1.1
*
self
.
l
if
aircraft
.
types
==
'AC'
:
if
aircraft
.
x
>
self
.
x
+
self
.
l
and
aircraft
.
f
==
True
:
aircraft
.
landing
=
True
elif
self
.
f
==
True
:
aircraft
.
landing
=
False
if
not
(
self
.
f
and
not
aircraft
.
f
)
and
aircraft
.
x
<
X
and
abs
(
aircraft
.
y
-
self
.
y
)
<
self
.
l
/
50
:
self
.
a
=
1
else
:
self
.
a
=
0
else
:
if
(
aircraft
.
x
-
self
.
x
)
**
2
+
(
aircraft
.
y
-
self
.
y
)
**
2
<
(
self
.
l
/
50
)
**
2
and
aircraft
.
f
==
True
:
aircraft
.
landing
=
True
else
:
aircraft
.
landing
=
False
if
not
(
self
.
f
and
not
aircraft
.
f
):
self
.
a
=
1
else
:
self
.
a
=
0
aircraft
.
move
(
t0
,
self
.
a
)
t0
+=
dt
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment