In the game Flick Fleet, players undertake space combat by flicking a six sided die at other ships.   There is an object called SpaceShip, where ships have a type corresponding to: Destroyer, Cruiser, Bomber, or Fighter.  This object has a method called: get_ship_type(): Returns a string that corresponds to the type of ship (e.g. "Destroyer", "Cruiser", "Bomber" or "Fighter") Each ship has different regions that have a corresponding number between 1 and 5.   Fighter - Hull (1), Engines (2) Bomber - Hull (1), Engines (2), Shield Generator (3) Cruiser - Hull (1), Engines (2),  Shield Generator (3), Defense Grid (4) Destroyer - Hull (1), Engines (2), Shield Generator (3), Defense Grid (4), Engineering (5)   Write a function called laser_attack that takes in as its parameters a ship of type Ship, and an integer value between 1 and 6. This function should return true if the number passed in the second parameter corresponds to a region possessed by the ship (representing a hit) or false otherwise (representing a miss). solve in python

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question

(Difficulty Level 3)
In the game Flick Fleet, players undertake space combat by flicking a six sided die at other ships.  

There is an object called SpaceShip, where ships have a type corresponding to: Destroyer, Cruiser, Bomber, or Fighter.  This object has a method called:

get_ship_type(): Returns a string that corresponds to the type of ship (e.g. "Destroyer", "Cruiser", "Bomber" or "Fighter")

Each ship has different regions that have a corresponding number between 1 and 5.

 

  • Fighter - Hull (1), Engines (2)
  • Bomber - Hull (1), Engines (2), Shield Generator (3)
  • Cruiser - Hull (1), Engines (2),  Shield Generator (3), Defense Grid (4)
  • Destroyer - Hull (1), Engines (2), Shield Generator (3), Defense Grid (4), Engineering (5)

 

Write a function called laser_attack that takes in as its parameters a ship of type Ship, and an integer value between 1 and 6.

This function should return true if the number passed in the second parameter corresponds to a region possessed by the ship (representing a hit) or false otherwise (representing a miss).

solve in python 

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT