rocket-aymen 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rocket_aymen-1.0.0/LICENSE.txt +21 -0
- rocket_aymen-1.0.0/PKG-INFO +17 -0
- rocket_aymen-1.0.0/README.md +0 -0
- rocket_aymen-1.0.0/rocket/__init__.py +1 -0
- rocket_aymen-1.0.0/rocket/rocket.py +62 -0
- rocket_aymen-1.0.0/rocket_aymen.egg-info/PKG-INFO +17 -0
- rocket_aymen-1.0.0/rocket_aymen.egg-info/SOURCES.txt +9 -0
- rocket_aymen-1.0.0/rocket_aymen.egg-info/dependency_links.txt +1 -0
- rocket_aymen-1.0.0/rocket_aymen.egg-info/top_level.txt +1 -0
- rocket_aymen-1.0.0/setup.cfg +4 -0
- rocket_aymen-1.0.0/setup.py +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rocket-aymen
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An awesome package that does something
|
|
5
|
+
Home-page: http://pypi.python.org/pypi/<your_package_name>/
|
|
6
|
+
Author: <author_name>
|
|
7
|
+
Author-email: a.boualdja@esi-sba.dz
|
|
8
|
+
License: LICENSE.txt
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: author-email
|
|
13
|
+
Dynamic: description-content-type
|
|
14
|
+
Dynamic: home-page
|
|
15
|
+
Dynamic: license
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
Dynamic: summary
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import rocket
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Save as rocket.py
|
|
2
|
+
from math import sqrt, pi
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Rocket():
|
|
6
|
+
# Rocket simulates a rocket ship for a game, or a physics simulation.
|
|
7
|
+
|
|
8
|
+
def __init__(self, x=0, y=0):
|
|
9
|
+
# Each rocket has an (x,y) position.
|
|
10
|
+
self.x = x
|
|
11
|
+
self.y = y
|
|
12
|
+
|
|
13
|
+
def move_rocket(self, x_increment=0, y_increment=1):
|
|
14
|
+
# Move the rocket according to the parameters given.
|
|
15
|
+
# Default behavior is to move the rocket up one unit.
|
|
16
|
+
self.x += x_increment
|
|
17
|
+
self.y += y_increment
|
|
18
|
+
|
|
19
|
+
def get_distance(self, other_rocket):
|
|
20
|
+
# Distance from this rocket to another rocket.
|
|
21
|
+
return sqrt((self.x - other_rocket.x) ** 2
|
|
22
|
+
+ (self.y - other_rocket.y) ** 2)
|
|
23
|
+
|
|
24
|
+
# ---- Added for Challenge 4.2 (equality from Challenge 1) ----
|
|
25
|
+
def __eq__(self, other):
|
|
26
|
+
if not isinstance(other, Rocket):
|
|
27
|
+
return NotImplemented
|
|
28
|
+
return self.x == other.x and self.y == other.y
|
|
29
|
+
|
|
30
|
+
def __str__(self):
|
|
31
|
+
return f"A Rocket positioned at ({self.x},{self.y})"
|
|
32
|
+
|
|
33
|
+
def __repr__(self):
|
|
34
|
+
return f"Rocket({self.x},{self.y})"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Shuttle(Rocket):
|
|
38
|
+
# Shuttle simulates a space shuttle, which is really just a reusable rocket.
|
|
39
|
+
|
|
40
|
+
def __init__(self, x=0, y=0, flights_completed=0):
|
|
41
|
+
super().__init__(x, y)
|
|
42
|
+
self.flights_completed = flights_completed
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# ---- Added for Challenge 4.3 ----
|
|
46
|
+
class CircleRocket(Rocket):
|
|
47
|
+
# A rocket shaped like a circle of radius r.
|
|
48
|
+
|
|
49
|
+
def __init__(self, x=0, y=0, r=1):
|
|
50
|
+
super().__init__(x, y)
|
|
51
|
+
self.r = r
|
|
52
|
+
|
|
53
|
+
def get_area(self):
|
|
54
|
+
return pi * self.r ** 2
|
|
55
|
+
|
|
56
|
+
def get_circumference(self):
|
|
57
|
+
return 2 * pi * self.r
|
|
58
|
+
|
|
59
|
+
def __repr__(self):
|
|
60
|
+
return f"CircleRocket({self.x},{self.y},{self.r})"
|
|
61
|
+
|
|
62
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rocket-aymen
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An awesome package that does something
|
|
5
|
+
Home-page: http://pypi.python.org/pypi/<your_package_name>/
|
|
6
|
+
Author: <author_name>
|
|
7
|
+
Author-email: a.boualdja@esi-sba.dz
|
|
8
|
+
License: LICENSE.txt
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: author-email
|
|
13
|
+
Dynamic: description-content-type
|
|
14
|
+
Dynamic: home-page
|
|
15
|
+
Dynamic: license
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rocket
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='rocket-aymen',
|
|
5
|
+
version='1.0.0',
|
|
6
|
+
author='<author_name>',
|
|
7
|
+
author_email='a.boualdja@esi-sba.dz',
|
|
8
|
+
packages=['rocket'],
|
|
9
|
+
url='http://pypi.python.org/pypi/<your_package_name>/',
|
|
10
|
+
license='LICENSE.txt',
|
|
11
|
+
description='An awesome package that does something',
|
|
12
|
+
long_description=open('README.md').read(),
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
install_requires=[]
|
|
15
|
+
)
|