Question: In python. Do not change anything in preliminaries Preliminaries For this homework assignment you will be woeking with the following classes that nepeesent the game

 In python. Do not change anything in preliminaries Preliminaries For this
homework assignment you will be woeking with the following classes that nepeesentIn python. Do not change anything in preliminaries

Preliminaries For this homework assignment you will be woeking with the following classes that nepeesent the game itself and a game board class Game def -(self, player-board); -init. self.a board-as board self.player board player board ai-board, def repr [self) i # see battleship.py for contents class Board: self num TOws-num rows self.un_cols # nun_cols self.cells self.air strike abilitY True self.nove ability - True t see course project.py for contents see battleship.py for contents We will use the following values to represent the state of a cell in the game boards EMPTYuu2SA1 EXPLORED . u"\u2612" # A square with an X inside # A white square # A black quare CSE 10I-Fall 2017 Course Projoct Page 2 Two concentric circles An icon of sailboat Note: The top-left cell of a game board is at (1,1).and the botiom-right cell of a game bourd is atl Cnum.rows num.cols). Youf code munt properly translate these cellumbers 10 iadeseino Board, en 1 Isie.g..he cell at position E,C))is stored at Board.cellstr-11lc-1 Notes on Testing Your Work ne eourse.pro ject-Py file includes several les cases for eached the tatis below Expected output for these test cases are given as an appendix to this PDF docment at you a e to write. To actually play a game of Battleship, run the file called course projeet deiver-py. Yuwt be able to play a full game util you have writlen all six functions described bekw PartI: Validate a Cell Position (10 points) Write the function is.valid position .which takes the following argmentsin this onder 1. board: A Board object. 2. row An integer value that scpeesents a sow ee the board. Valid sow mumbers sturt with 1. 3 col: An inleger value that represents a column on the board. Valid colmn mmbers start with 1 The function returas True if row is in the range 1 theough board.nun rows and col is in the range 1 through board,num.cols, Otherwise, the function returns False Part II: Place Ship (20 points) Write the function place.shipo. whch takes the following arguments, in this order 1. board: A Board object. 2 row. Aa integer value that sepeesents a #ow ce the board Vallow u hers sun with 1. 3 col: Am integer valuc that rpecsents a column on the board. Valid column mambers start with 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!