GarbageTruck #10
@ -1,33 +1,35 @@
|
||||
from typing import List
|
||||
|
||||
class garbageTruck:
|
||||
position: List[int, int]
|
||||
paper: []
|
||||
plastic_and_metal: []
|
||||
glass: []
|
||||
bio: []
|
||||
mixed: []
|
||||
truckSpritePath = 'imgs/dust_car.png'
|
||||
def __init__(self, position: List[int, int]) -> None:
|
||||
self.position = position
|
||||
self.paper = []
|
||||
self.plastic_and_metal = []
|
||||
self.glass = []
|
||||
self.bio = []
|
||||
self.mixed = []
|
||||
|
||||
def sort_garbage(self, RecognizedGarbage) -> None:
|
||||
if RecognizedGarbage.garbage_type == 0:
|
||||
self.paper.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 1:
|
||||
self.plastic_and_metal.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 3:
|
||||
self.glass.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 4:
|
||||
self.bio.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 5:
|
||||
from typing import List
|
||||
|
||||
class GarbageTruck:
|
||||
s473616 marked this conversation as resolved
Outdated
|
||||
position: Tuple[int, int]
|
||||
s473616 marked this conversation as resolved
Outdated
s473616
commented
Tuple zamiast List? Tuple zamiast List?
|
||||
paper: []
|
||||
s473616
commented
Typ listy: RecognizedGarbage Typ listy: RecognizedGarbage
s473616
commented
chodzi o to, żeby listy śmieci były typowane, czyli np. paper: List[RecognizedGarbage], tak dla wszystkich list chodzi o to, żeby listy śmieci były typowane, czyli np. paper: List[RecognizedGarbage], tak dla wszystkich list
|
||||
plastic_and_metal: []
|
||||
glass: []
|
||||
bio: []
|
||||
mixed: []
|
||||
RecognizedGarbage: []
|
||||
truckSpritePath = 'imgs/dust_car.png'
|
||||
def __init__(self, position: List[int, int]) -> None:
|
||||
self.position = position
|
||||
self.paper = []
|
||||
self.plastic_and_metal = []
|
||||
self.glass = []
|
||||
self.bio = []
|
||||
self.mixed = []
|
||||
|
||||
|
||||
def sort_garbage(self, RecognizedGarbage) -> None:
|
||||
if RecognizedGarbage.garbage_type == 0:
|
||||
self.paper.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 1:
|
||||
self.plastic_and_metal.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 3:
|
||||
self.glass.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 4:
|
||||
self.bio.append(RecognizedGarbage)
|
||||
|
||||
elif RecognizedGarbage.garbage_type == 5:
|
||||
self.mixed.append(RecognizedGarbage)
|
Loading…
Reference in New Issue
Block a user
możesz używać Pascal Case do nazywania klas? Czyli w naszym wypadku "GarbageTruck"