change Game structure

This commit is contained in:
xVulpeSx 2022-04-14 23:21:44 +02:00
parent 59676e176a
commit 430cdc761e

View File

@ -1,32 +1,37 @@
from data import Direction
from data.CATEGORY import CATEGORY from data.CATEGORY import CATEGORY
from data.Item import Item from data.Item import Item
from data.Order import Order from data.Order import Order
from typing import Dict
class Game: class Game:
def __init__(self, id: int, agentPos: (int, int), deliveryPos: (int, int), orderPos: (int,int), stockPilePos: [(int,int)], def __init__(self, id: int, agentPos: (int, int), agentDirection: Direction, deliveryPos: (int, int), orderPos: (int,int), stockPilePos: Dict,
deliveryItem: Item, agentHandId: int, orderStock:[id], orderList: [Order] ): deliveryItem: Item, carriedItem: Item, orderStock: Dict, orderList: [Order]):
self.agentDirection = agentDirection
self.id = id self.id = id
self.agentPos = agentPos self.agentPos = agentPos
self.deliveryPos = deliveryPos self.deliveryPos = deliveryPos
self.orderPos = orderPos self.orderPos = orderPos
self.stockPilePos = stockPilePos self.stockPilePos = stockPilePos
self.deliveryItem = deliveryItem self.deliveryItem = deliveryItem
self.agentHandId = agentHandId self.carriedItem = carriedItem
self.orderStock = orderStock self.orderStock = orderStock
self.orderList = orderList self.orderList = orderList
def move(self, x: int, y:int): def getCopy(self):
self.agentPos = (x, y) newGame = Game(self)
return newGame
def pickUp(self, item: Item): # def move(self, x: int, y: int):
self.deliveryItem = item # self.agentPos = (x, y)
#
def drop(self, item: Item): # def pickUp(self, item: Item):
self.deliveryItem = -1 # self.deliveryItem = item
#
def identify(item: Item, category: CATEGORY): # def drop(self, item: Item):
item.category = category # self.deliveryItem = -1
#
def finishOrder(order: Order): # def identify(item: Item, category: CATEGORY):
order.id = -1 # item.category = category
#
# def finishOrder(order: Order):
# order.id = -1