Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
1af37406
Commit
1af37406
authored
1 year ago
by
Florian Schröder
Browse files
Options
Downloads
Patches
Plain Diff
combine and drop off of stove and tomatos
parent
87ba0c35
No related branches found
No related tags found
1 merge request
!10
Resolve "Pot and stove and cooking tomato soup"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
overcooked_simulator/counters.py
+10
-4
10 additions, 4 deletions
overcooked_simulator/counters.py
overcooked_simulator/game_items.py
+20
-19
20 additions, 19 deletions
overcooked_simulator/game_items.py
with
30 additions
and
23 deletions
overcooked_simulator/counters.py
+
10
−
4
View file @
1af37406
...
...
@@ -15,6 +15,7 @@ from overcooked_simulator.game_items import (
Plate
,
Tomato
,
Pot
,
Pan
,
)
...
...
@@ -208,11 +209,16 @@ class Stove(Counter):
occupied_by
=
Pot
()
super
().
__init__
(
pos
,
occupied_by
)
def
pick_up
(
self
):
pass
def
drop_off
(
self
,
item
)
->
Item
|
None
:
pass
if
isinstance
(
item
,
(
Pot
,
Pan
)):
self
.
occupied_by
=
item
else
:
self
.
occupied_by
.
combine
(
item
)
return
None
def
can_drop_off
(
self
,
item
)
->
bool
:
if
isinstance
(
item
,
(
Pot
,
Pan
)):
return
not
self
.
occupied_by
if
self
.
occupied_by
:
return
self
.
occupied_by
.
can_combine
(
item
)
return
False
This diff is collapsed.
Click to expand it.
overcooked_simulator/game_items.py
+
20
−
19
View file @
1af37406
...
...
@@ -28,10 +28,10 @@ class Plate(Item):
class
ProgressibleItem
(
Item
):
"""
Class for items which need to be processed (cut, cooked, ...)
"""
def
__init__
(
self
,
steps_needed
):
self
.
progressed_steps
=
0
def
__init__
(
self
,
finished
:
bool
=
False
,
steps_needed
:
int
=
1500
):
self
.
progressed_steps
=
steps_needed
if
finished
else
0
self
.
steps_needed
=
steps_needed
self
.
finished
=
False
self
.
finished
=
finished
super
().
__init__
()
def
progress
(
self
):
...
...
@@ -44,9 +44,9 @@ class ProgressibleItem(Item):
def
__repr__
(
self
):
if
self
.
finished
:
return
"
CutTomato
"
return
f
"
{
self
.
__class__
.
__name__
}
()
"
else
:
return
f
"
{
self
.
__class__
.
__name__
}
(
{
int
(
self
.
progressed_steps
/
self
.
steps_needed
*
100
)
}
%)
"
return
f
"
{
self
.
__class__
.
__name__
}
(
progress=
{
int
(
self
.
progressed_steps
/
self
.
steps_needed
*
100
)
}
%)
"
class
CuttableItem
(
ProgressibleItem
):
...
...
@@ -66,28 +66,29 @@ class Tomato(CuttableItem):
class
Pot
(
ProgressibleItem
):
def
can_combine
(
self
,
other
):
return
False
def
__init__
(
self
):
def
__init__
(
self
,
holds
:
Item
=
None
):
self
.
holds
=
[]
if
holds
is
None
else
holds
super
().
__init__
(
steps_needed
=
1500
)
def
combine
(
self
,
other
):
pass
def
can_combine
(
self
,
other
):
# TODO based on recipes
return
(
isinstance
(
other
,
Tomato
)
# and other.finished
and
len
(
self
.
holds
)
<
3
and
all
([
isinstance
(
h
,
Tomato
)
for
h
in
self
.
holds
])
)
def
__repr__
(
self
):
return
f
"
{
self
.
__class__
.
__name__
}
()
"
def
combine
(
self
,
other
):
self
.
holds
.
append
(
other
)
class
Pan
(
ProgressibleItem
):
def
can_combine
(
self
,
other
):
return
False
def
__init__
(
self
):
super
().
__init__
(
steps_needed
=
1500
)
def
can_combine
(
self
,
other
):
return
False
def
combine
(
self
,
other
):
pass
def
__repr__
(
self
):
return
f
"
{
self
.
__class__
.
__name__
}
()
"
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