‘name’: ‘Problem 11’,
‘points’: 3,
‘suites’: [
‘cases’: [
Copyright By PowCoder代写 加微信 powcoder
‘answer’: ‘8c21596e7c99426f499e411c2d636734’,
‘choices’: [
It is waterproof, so its health won’t be reduced to 0 when it is
placed in a Water Place
It is not waterproof, so its health will be reduced to 0 when it is
placed in a Water Place
‘It throws water pellets instead of leaves’
‘hidden’: False,
‘locked’: True,
‘multiline’: False,
‘question’: ‘How is a ScubaThrower different from a regular ThrowerAnt?’
‘answer’: ’18a7799a74ffdc04ceb34a10cb99b75a’,
‘choices’: [
‘name, is_waterproof, food_cost’,
‘food_cost, action, damage’,
‘is_waterproof, action’,
‘name, nearest_bee, is_waterproof’
‘hidden’: False,
‘locked’: True,
‘multiline’: False,
‘question’: r”””
Which inherited attributes and/or methods should ScubaThrower
‘scored’: False,
‘type’: ‘concept’
‘cases’: [
‘code’: r”””
>>> # Testing ScubaThrower parameters
>>> scuba = ScubaThrower()
>>> ScubaThrower.food_cost
1417936d6fc6e9b3ac66b50e5d407ada
>>> scuba.health
10d7626438082950badf2b6216f9b0a8
‘hidden’: False,
‘locked’: True,
‘multiline’: False
‘scored’: False,
‘setup’: r”””
>>> from ants import *
‘teardown’: ”,
‘type’: ‘doctest’
‘cases’: [
‘code’: r”””
>>> # Testing if ScubaThrower is waterproof
>>> water = Water(‘Water’)
>>> ant = ScubaThrower()
>>> water.add_insect(ant)
>>> ant.place is water
154afc22815a37701b5fa71e532da526
>>> ant.health
10d7626438082950badf2b6216f9b0a8
‘hidden’: False,
‘locked’: True,
‘multiline’: False
‘code’: r”””
>>> # Testing that ThrowerAnt is not waterproof
>>> water = Water(‘Water’)
>>> ant = ThrowerAnt()
>>> water.add_insect(ant)
>>> ant.place is water
e0390565eddec8c7f85375354a9d8b87
>>> ant.health
40031e7755cbca1da159a160d30dbc21
‘hidden’: False,
‘locked’: True,
‘multiline’: False
‘code’: r”””
>>> # Testing ScubaThrower on land
>>> place1 = gamestate.places[“tunnel_0_0”]
>>> place2 = gamestate.places[“tunnel_0_4″]
>>> ant = ScubaThrower()
>>> bee = Bee(3)
>>> place1.add_insect(ant)
>>> place2.add_insect(bee)
>>> ant.action(gamestate)
>>> bee.health # ScubaThrower can throw on land
‘hidden’: False,
‘locked’: False,
‘multiline’: False
‘code’: r”””
>>> # Testing ScubaThrower in the water
>>> water = Water(“water”)
>>> water.entrance = gamestate.places[“tunnel_0_1”]
>>> target = gamestate.places[“tunnel_0_4″]
>>> ant = ScubaThrower()
>>> bee = Bee(3)
>>> water.add_insect(ant)
>>> target.add_insect(bee)
>>> ant.action(gamestate)
>>> bee.health # ScubaThrower can throw in water
‘hidden’: False,
‘locked’: False,
‘multiline’: False
‘scored’: True,
‘setup’: r”””
>>> from ants import *
>>> beehive, layout = Hive(AssaultPlan()), dry_layout
>>> dimensions = (1, 9)
>>> gamestate = GameState(None, beehive, ant_types(), layout, dimensions)
‘teardown’: ”,
‘type’: ‘doctest’
‘cases’: [
‘code’: r”””
>>> # Testing ScubaThrower Inheritance from ThrowerAnt
>>> def new_action(self, gamestate):
… raise NotImplementedError()
>>> def new_throw_at(self, target):
… raise NotImplementedError()
>>> ThrowerAnt.action = new_action
>>> test_scuba = ScubaThrower()
… test_scuba.action(gamestate)
… except NotImplementedError:
… print(‘inherits action!’)
inherits action!
>>> ThrowerAnt.action = old_thrower_action
>>> ThrowerAnt.throw_at = new_throw_at
>>> test_scuba = ScubaThrower()
… test_scuba.throw_at(Bee(1))
… except NotImplementedError:
… print(‘inherits throw_at!’)
inherits throw_at!
‘hidden’: False,
‘locked’: False,
‘multiline’: False
‘scored’: True,
‘setup’: r”””
>>> from ants import *
>>> beehive, layout = Hive(AssaultPlan()), dry_layout
>>> dimensions = (1, 9)
>>> gamestate = GameState(None, beehive, ant_types(), layout, dimensions)
>>> old_thrower_action = ThrowerAnt.action
>>> old_throw_at = ThrowerAnt.throw_at
‘teardown’: r”””
>>> ThrowerAnt.action = old_thrower_action
>>> ThrowerAnt.throw_at = old_throw_at
‘type’: ‘doctest’
‘cases’: [
‘code’: r”””
>>> from ants import *
>>> ScubaThrower.implemented
‘hidden’: False,
‘locked’: False,
‘multiline’: False
‘scored’: True,
‘setup’: ”,
‘teardown’: ”,
‘type’: ‘doctest’
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com