(Solved) : Ships Create Shippy Module Contains Ship Class Private Members Ship Class Length Integer N Q42696105 . . .

Ships • Create a Ship.py module that contains a Ship class • The private members for the ship class should be - length (integPLEASE IF SOMEONE CAN MAKE THISBATTLEBattleships • Create a Battleship.py module that contains a Battleship class and imports your ship class and random • The priBattleships • The methods (cont.) - getMove () - gets input from the user in the form of a letter (A-J) and number (0-9) thatSample Output Output Enter your move: 15 Missed. Enter your move: H3 Hit Destroyer. You sunk the Destroyer! Game over A B C DNotes • Add comments throughout your code • No hard coding (use variables, len, loops, etc.) - Points will be severely deductPlay Battleships • Create a playBattleship.py file that imports your Battleship class • Add a function playGame (bship) thatSHIPS PROGRAM IN PYTHON!

Ships • Create a Ship.py module that contains a Ship class • The private members for the ship class should be – length (integer) – name (string) – orientation (‘x’ or ‘y’) • The methods should be – __init__(name, length) et Length (len) – getLength() tName (shipname) getName() setOrientation (orient) getOrientation () D D D We were unable to transcribe this imageBattleships • The methods (cont.) – getMove () – gets input from the user in the form of a letter (A-J) and number (0-9) that coincides with a coordinate on the board. It should keep asking user for input until they enter correct coordinates. makeMove (coordinate) – Takes a parameter, marks the board and prints • “Missed” – If no ship is at the coordinate, marks with M. • “Hit [ship name)” – if a ship is at the coordinate, marks with X • “You sunk the [ship name]” – If the whole ship has been marked – isGameOver() – Returns true if all ships are marked, false otherwise. – printBoard () – Prints the board with coordinates Sample Output Output Enter your move: 15 Missed. Enter your move: H3 Hit Destroyer. You sunk the Destroyer! Game over A B C D E F G H I J ооооооооо 1 омххоооо 2 ооооооооо ооомооохо оооооооо омоооооо оохомоооо оохоооххх омх моооооо 9 ооооооооо © © No1 Ба мно оохооооооо We were unable to transcribe this imagePlay Battleships • Create a playBattleship.py file that imports your Battleship class • Add a function playGame (bship) that takes a Battleship parameter, calls CreateShips (). and repeatedly calls getMove () and makeMove () until isGameOver () returns true then calls printBoard () • Add a main () function that creates an instance of your Battleship class and passes it to playGame () Show transcribed image text Ships • Create a Ship.py module that contains a Ship class • The private members for the ship class should be – length (integer) – name (string) – orientation (‘x’ or ‘y’) • The methods should be – __init__(name, length) et Length (len) – getLength() tName (shipname) getName() setOrientation (orient) getOrientation () D D D

Battleships • The methods (cont.) – getMove () – gets input from the user in the form of a letter (A-J) and number (0-9) that coincides with a coordinate on the board. It should keep asking user for input until they enter correct coordinates. makeMove (coordinate) – Takes a parameter, marks the board and prints • “Missed” – If no ship is at the coordinate, marks with M. • “Hit [ship name)” – if a ship is at the coordinate, marks with X • “You sunk the [ship name]” – If the whole ship has been marked – isGameOver() – Returns true if all ships are marked, false otherwise. – printBoard () – Prints the board with coordinates
Sample Output Output Enter your move: 15 Missed. Enter your move: H3 Hit Destroyer. You sunk the Destroyer! Game over A B C D E F G H I J ооооооооо 1 омххоооо 2 ооооооооо ооомооохо оооооооо омоооооо оохомоооо оохоооххх омх моооооо 9 ооооооооо © © No1 Ба мно оохооооооо

Play Battleships • Create a playBattleship.py file that imports your Battleship class • Add a function playGame (bship) that takes a Battleship parameter, calls CreateShips (). and repeatedly calls getMove () and makeMove () until isGameOver () returns true then calls printBoard () • Add a main () function that creates an instance of your Battleship class and passes it to playGame ()

Expert Answer


Answer to Ships • Create a Ship.py module that contains a Ship class • The private members for the ship class should be – leng…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us