Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My implementation to interface for ant/spider.py doesn't seem to work. Can I get critical feedbackon how to apporach this?? Ant.py Code: from MobileCritter import MobileCritter
My implementation to interface for ant/spider.py doesn't seem to work. Can I get critical feedbackon how to apporach this??
Ant.py Code:
from MobileCritter import MobileCritter from Insect import Insect class Ant(Insect, MobileCritter): def __init__(self): Insect.__init__(self) class Ant(MobileCritter, Insect): def __init__(self): MobileCritter.__init__(self) def move_right(self): """moves this ant's position 1 unit right""" # todo raise NotImplementedError() def move_left(self): """moves this ant's position 1 unit right""" # todo raise NotImplementedError() def move_up(self): """moves this ant's position 2 units up""" # todo raise NotImplementedError() def move_down(self): """moves this ant's position 2 units down""" # todo raise NotImplementedError() def __str__(self): return u'\u1F41C'
spider.py code:
from MobileCritter import MobileCritter from Insect import Insect class Spider(Insect, MobileCritter): def __init__(self): Insect.__init__(self) Class Spider(MobileCritter, Insect) def __init__(self): MobileCritter.__init__(self) def move_right(self): """moves this spider's position 1 unit right""" # todo raise NotImplementedError() def move_left(self): """moves this spider's position 2 units left""" # todo raise NotImplementedError() def move_up(self): """moves this spider's position 1 unit up""" # todo raise NotImplementedError() def move_down(self): """moves this spider's position 2 units down""" # todo raise NotImplementedError() def __str__(self): return u'\u1F577'
Ant. py - contains an incomplete subclass of Insect that must implement the MobileCritter interface. Spider.py - contains an incomplete subclass of Insect that must implement the MobileCritter interface. Implement the Ant and Spider classes so that they fulfill the operations described in the documentation of the listed methods. Test your implementation by running main.py and playing the game
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started