Hey, this is the assignment I need help in.

1 answer below »
Hey, this is the assignment I need help in.
Answered 5 days AfterApr 17, 2021

Answer To: Hey, this is the assignment I need help in.

Sandeep Kumar answered on Apr 22 2021
152 Votes
"""
End of Dayz
Assignment 2
Semester 1, 2021
CSSE1001/CSSE7030
A text-based zombie survival game wherein the player has to reach
the hospital whilst evading zombies.
"""
#from abc import ABC
from typing import Tuple, Optional, Dict, List
from a2_support import *
#from abc import *
# Replace these with your name, student number and email address.
__author__ = ", "
__email__ = "Student Email>"
# Implement your classes here.
class Entity:
'''class Entity'''
def __init__(self):
'''class Entity'''
self._id = 'Entity'
self.position = None
self.game = None

def __repr__(self):
'''class Entity'''
return 'Entity()'
def display(self):
'''class Entity'''
raise NotImplementedError

def step(self, position, game):
'''class Entity'''
self.position = position
self.game = game

class Player(Entity):
'''class Player'''
inventory = []
id = "O"
def __init__(self):
'''class Player'''
self._id='Player'

def __repr__(self):
'''class Player'''
return 'Player()'
def display(self):
'''class Player'''
return 'P'
#this could also return set_position as that is the method defining the players position at that time
class Hospital(Entity):
'''class Hospital'''
def __init__(self):
'''class Hospital'''
self._id = 'Hospital'

def __repr__(self):
'''class Hospital'''
return 'Hospital()'
def display(self):
'''class Hospital'''
return 'H'
class Grid:
'''Zombie'''
def __init__(self, size: int):
'''Zombie'''
self.size = size
self.entities = {}
def get_size(self) -> int:
'''Zombie'''
return self.size
def in_bounds(self, position: Position) -> bool:
'''Zombie'''
if 0 <= position.get_x() < self.size and 0 <= position.get_y() < self.size:
return True
else:
return False
def add_entity(self, position: "Position", entity: Entity) -> None:
'''Zombie'''
self.position_x = position.get_x()
self.position_y = position.get_y()
self.entities[position] = entity
def remove_entity(self, position: Position):
'''Zombie'''
del (self.entities[position])
position_x = 0
Position_y = 0
return self.position
def get_entity(self, position: "Position") -> Optional[Entity]:
'''Zombie'''
if self.entities is not None and self.in_bounds(position):
return self.entities[position]
else:
return None
def get_mapping(self) -> Dict[Position, Entity]:
'''Zombie'''
return self.entities
def get_entities(self) -> List[Entity]:
'''Zombie'''
entity = []
for k in self.entities:
entity.append(self.entities[k])
return entity
def move_entity(self, start: Position, end: Position) -> None:
'''Zombie'''
if self.in_bounds(start) and self.in_bounds(end):
for k in self.entities:
if start.get_x() == k.get_x() and start.get_y() == k.get_y():
popped = self.entities.pop(k)
k = end
self.entities[k] = popped
break
else:
return None
def find_player(self) -> Optional[Position]:
'''Zombie'''
for k in self.entities:
'''Zombie'''
if type(self.entities[k]) == type(Player()) and self.in_bounds(k):
return k
def serialize(self):
'''Zombie'''
return dict[Tuple[int, int], str]
class MapLoader:
'''Zombie'''
def load(self, filename: str) -> Grid:
'''Zombie'''
raise NotImplementedError("implement load method")
def create_entity(self, token: str) -> Entity:
'''Zombie'''
raise NotImplementedError("implement create_entity method")
class BasicMapLoader(MapLoader):
'''Zombie'''
def create_entity(self, token: str) -> Entity:
'''Zombie'''
if token == PLAYER:
return...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here