Dodalem klasy
This commit is contained in:
parent
8966fd0e15
commit
18af3c5b7e
47
ai-wozek/classes.py
Normal file
47
ai-wozek/classes.py
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
class Cargo:
|
||||
def __init__(self, name, category, size, weight):
|
||||
self.name = name
|
||||
self.size = size
|
||||
self.weight = weight
|
||||
self.category = category
|
||||
|
||||
|
||||
class Clothes(Cargo):
|
||||
def __init__(self, name, size, weight, fragility):
|
||||
super().__init__(name,"clothes", size, weight)
|
||||
self.fragility = fragility
|
||||
|
||||
class NuclearWaste(Cargo):
|
||||
def __init__(self, name, size, weight, exp_date, toxicity):
|
||||
super().__init__(name,"nuclear_waste" ,size, weight)
|
||||
self.exp_date = exp_date
|
||||
self.toxicity = toxicity
|
||||
|
||||
class Fruit(Cargo):
|
||||
def __init__(self, name ,size, weight, exp_date):
|
||||
super().__init__(name,"fruit" ,size, weight)
|
||||
self.exp_date = exp_date
|
||||
|
||||
class Carparts(Cargo):
|
||||
def __init__(self, name ,size, weight):
|
||||
super().__init__(name,"car_parts" ,size, weight)
|
||||
|
||||
class Forklift:
|
||||
def __init__(self, model):
|
||||
self.model = model
|
||||
|
||||
class Shelf:
|
||||
def __init__(self, category):
|
||||
self.category = category
|
||||
self.items = []
|
||||
|
||||
def add_item(self, item):
|
||||
if isinstance(item, Cargo) and item.category == self.category:
|
||||
self.items.append(item)
|
||||
else:
|
||||
print(f"Can't add: {item.name}. Shelf is for: {self.category}")
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ import sys
|
||||
import random
|
||||
import os
|
||||
import time
|
||||
from classes import *
|
||||
|
||||
class Node():
|
||||
def __init__(self,position,rotation,action,parent):
|
||||
|
Loading…
Reference in New Issue
Block a user