seds-rocket 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.
- seds_rocket-1.0.0/LICENSE.txt +21 -0
- seds_rocket-1.0.0/MANIFEST.in +1 -0
- seds_rocket-1.0.0/PKG-INFO +48 -0
- seds_rocket-1.0.0/README.md +27 -0
- seds_rocket-1.0.0/rocket/__init__.py +1 -0
- seds_rocket-1.0.0/rocket/rocket.py +75 -0
- seds_rocket-1.0.0/seds_rocket.egg-info/PKG-INFO +48 -0
- seds_rocket-1.0.0/seds_rocket.egg-info/SOURCES.txt +10 -0
- seds_rocket-1.0.0/seds_rocket.egg-info/dependency_links.txt +1 -0
- seds_rocket-1.0.0/seds_rocket.egg-info/top_level.txt +1 -0
- seds_rocket-1.0.0/setup.cfg +4 -0
- seds_rocket-1.0.0/setup.py +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 <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 @@
|
|
|
1
|
+
include README.md LICENSE.txt
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seds-rocket
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Rockets, shuttles and circular rockets for simulations
|
|
5
|
+
Home-page: http://pypi.python.org/pypi/seds-rocket/
|
|
6
|
+
Author: amineachir
|
|
7
|
+
Author-email: achiraminemohamed@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: author-email
|
|
14
|
+
Dynamic: description
|
|
15
|
+
Dynamic: description-content-type
|
|
16
|
+
Dynamic: home-page
|
|
17
|
+
Dynamic: license
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# seds-rocket
|
|
23
|
+
|
|
24
|
+
`seds-rocket` is a small Python library that simulates rockets, shuttles
|
|
25
|
+
and circular rockets for games or physics simulations.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `seds-rocket`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install seds-rocket
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from rocket import Rocket, Shuttle, CircleRocket
|
|
39
|
+
|
|
40
|
+
r1 = Rocket(0, 0)
|
|
41
|
+
r2 = Rocket(3, 4)
|
|
42
|
+
r1.get_distance(r2) # returns 5.0
|
|
43
|
+
|
|
44
|
+
CircleRocket(0, 0, 2).get_area() # returns 12.566...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# seds-rocket
|
|
2
|
+
|
|
3
|
+
`seds-rocket` is a small Python library that simulates rockets, shuttles
|
|
4
|
+
and circular rockets for games or physics simulations.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `seds-rocket`.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install seds-rocket
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from rocket import Rocket, Shuttle, CircleRocket
|
|
18
|
+
|
|
19
|
+
r1 = Rocket(0, 0)
|
|
20
|
+
r2 = Rocket(3, 4)
|
|
21
|
+
r1.get_distance(r2) # returns 5.0
|
|
22
|
+
|
|
23
|
+
CircleRocket(0, 0, 2).get_area() # returns 12.566...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .rocket import Rocket, Shuttle, CircleRocket
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Save as rocket.py
|
|
2
|
+
from math import pi, sqrt
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Rocket():
|
|
6
|
+
# Rocket simulates a rocket ship for a game,
|
|
7
|
+
# or a physics simulation.
|
|
8
|
+
|
|
9
|
+
def __init__(self, x=0, y=0):
|
|
10
|
+
# Each rocket has an (x,y) position.
|
|
11
|
+
self.x = x
|
|
12
|
+
self.y = y
|
|
13
|
+
|
|
14
|
+
def move_rocket(self, x_increment=0, y_increment=1):
|
|
15
|
+
# Move the rocket according to the parameters given.
|
|
16
|
+
# Default behavior is to move the rocket up one unit.
|
|
17
|
+
self.x += x_increment
|
|
18
|
+
self.y += y_increment
|
|
19
|
+
|
|
20
|
+
def get_distance(self, other_rocket):
|
|
21
|
+
# Calculates the distance from this rocket to another rocket,
|
|
22
|
+
# and returns that value.
|
|
23
|
+
distance = sqrt((self.x - other_rocket.x) ** 2
|
|
24
|
+
+ (self.y - other_rocket.y) ** 2)
|
|
25
|
+
return distance
|
|
26
|
+
|
|
27
|
+
def __eq__(self, other):
|
|
28
|
+
# Challenge 1: two rockets are equal if they are at the same position
|
|
29
|
+
if not isinstance(other, Rocket):
|
|
30
|
+
return NotImplemented
|
|
31
|
+
return self.x == other.x and self.y == other.y
|
|
32
|
+
|
|
33
|
+
def __str__(self):
|
|
34
|
+
return f"A Rocket positioned at ({self.x},{self.y})"
|
|
35
|
+
|
|
36
|
+
def __repr__(self):
|
|
37
|
+
return f"Rocket({self.x},{self.y})"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Shuttle(Rocket):
|
|
41
|
+
# Shuttle simulates a space shuttle, which is really
|
|
42
|
+
# just a reusable rocket.
|
|
43
|
+
|
|
44
|
+
def __init__(self, x=0, y=0, flights_completed=0):
|
|
45
|
+
super().__init__(x, y)
|
|
46
|
+
self.flights_completed = flights_completed
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CircleRocket(Rocket):
|
|
50
|
+
# A rocket that has the form of a circle with radius r.
|
|
51
|
+
|
|
52
|
+
def __init__(self, x=0, y=0, r=1):
|
|
53
|
+
super().__init__(x, y)
|
|
54
|
+
self.r = r
|
|
55
|
+
|
|
56
|
+
def get_area(self):
|
|
57
|
+
# area = pi * r^2
|
|
58
|
+
return pi * self.r ** 2
|
|
59
|
+
|
|
60
|
+
def get_circumference(self):
|
|
61
|
+
# circumference = 2 * pi * r
|
|
62
|
+
return 2 * pi * self.r
|
|
63
|
+
|
|
64
|
+
def __eq__(self, other):
|
|
65
|
+
# Same position AND same radius
|
|
66
|
+
if not isinstance(other, CircleRocket):
|
|
67
|
+
return NotImplemented
|
|
68
|
+
return super().__eq__(other) and self.r == other.r
|
|
69
|
+
|
|
70
|
+
def __str__(self):
|
|
71
|
+
return (f"A CircleRocket positioned at ({self.x},{self.y}) "
|
|
72
|
+
f"with radius {self.r}")
|
|
73
|
+
|
|
74
|
+
def __repr__(self):
|
|
75
|
+
return f"CircleRocket({self.x},{self.y},{self.r})"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seds-rocket
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Rockets, shuttles and circular rockets for simulations
|
|
5
|
+
Home-page: http://pypi.python.org/pypi/seds-rocket/
|
|
6
|
+
Author: amineachir
|
|
7
|
+
Author-email: achiraminemohamed@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: author-email
|
|
14
|
+
Dynamic: description
|
|
15
|
+
Dynamic: description-content-type
|
|
16
|
+
Dynamic: home-page
|
|
17
|
+
Dynamic: license
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# seds-rocket
|
|
23
|
+
|
|
24
|
+
`seds-rocket` is a small Python library that simulates rockets, shuttles
|
|
25
|
+
and circular rockets for games or physics simulations.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `seds-rocket`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install seds-rocket
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from rocket import Rocket, Shuttle, CircleRocket
|
|
39
|
+
|
|
40
|
+
r1 = Rocket(0, 0)
|
|
41
|
+
r2 = Rocket(3, 4)
|
|
42
|
+
r1.get_distance(r2) # returns 5.0
|
|
43
|
+
|
|
44
|
+
CircleRocket(0, 0, 2).get_area() # returns 12.566...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rocket
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='seds-rocket',
|
|
5
|
+
version='1.0.0',
|
|
6
|
+
author='amineachir',
|
|
7
|
+
author_email='achiraminemohamed@gmail.com',
|
|
8
|
+
packages=['rocket'],
|
|
9
|
+
url='http://pypi.python.org/pypi/seds-rocket/',
|
|
10
|
+
license='MIT',
|
|
11
|
+
description='Rockets, shuttles and circular rockets for simulations',
|
|
12
|
+
long_description=open('README.md').read(),
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
python_requires='>=3.8',
|
|
15
|
+
)
|