Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MarsRover
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Muhamed Alici
MarsRover
Commits
fa5bcfe0
Commit
fa5bcfe0
authored
1 month ago
by
Muhamed (aider)
Browse files
Options
Downloads
Patches
Plain Diff
```python
fix: Mars-Klasse zu Singleton umgestaltet ```
parent
80572101
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mars.py
+22
-4
22 additions, 4 deletions
mars.py
with
22 additions
and
4 deletions
mars.py
+
22
−
4
View file @
fa5bcfe0
...
...
@@ -2,17 +2,35 @@ from plateau import Plateau
class
Mars
:
"""
Eine Klasse zur Repräsentation des Mars.
Eine Singleton-Klasse zur Repräsentation des Mars.
Es kann nur eine Instanz dieser Klasse existieren.
"""
_instance
=
None
def
__
init__
(
self
,
plateau
:
Plateau
):
def
__
new__
(
cls
,
plateau
:
Plateau
=
None
):
"""
Initialisiert den Mars mit einem Plateau.
Erstellt eine neue Mars-Instanz oder gibt die existierende zurück.
Args:
plateau: Das Plateau, das den Mars repräsentiert (nur beim ersten Aufruf verwendet)
Returns:
Die einzige Instanz der Mars-Klasse
"""
if
cls
.
_instance
is
None
:
cls
.
_instance
=
super
(
Mars
,
cls
).
__new__
(
cls
)
cls
.
_instance
.
plateau
=
plateau
return
cls
.
_instance
def
__init__
(
self
,
plateau
:
Plateau
=
None
):
"""
Initialisiert den Mars (wird nur beim ersten Mal ausgeführt).
Args:
plateau: Das Plateau, das den Mars repräsentiert
"""
self
.
plateau
=
plateau
if
not
hasattr
(
self
,
'
plateau
'
):
self
.
plateau
=
plateau
def
drive
(
self
,
cmd
:
str
)
->
str
:
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment