try: if int(input[1]) > 0 and int(input[1]) < 11: pass else: return False except ValueError: return False if input[2].lower() == 'down' or input[2].lower() == 'right': pass else: return False # def playInst(self): # Boards myBoard = gameboard() hitBoard = gameboard() # Players human = player(0) computer = player(1) # Game interaction. menu = menu() # Instructions and intro menu.intro() menu.placementInst() # Setting fleet. human.storeShips(menu.placeShips(myBoard))
if int(input[1]) > 0 and int(input[1]) < 11: pass else: return False except ValueError: return False if input[2].lower() == 'down' or input[2].lower() == 'right': pass else: return False # def playInst(self): # Boards myBoard = gameboard() hitBoard = gameboard() # Players human = player(0) computer = player(1) # Game interaction. menu = menu() # Instructions and intro menu.intro() menu.placementInst() # Setting fleet. human.storeShips(menu.placeShips(myBoard))
and "this is ugly and overly complex but I don't have the time to stop and think about doing it better". +) The computer opponent does not randomly place their ships. I know this was a requirement for the final and it also means the game is not worth playing more than once (if you pick up on it). I added static positions as a means of testing throughout development and didn't realize until recently that I forgot to implement random fleet placement. Just going to have to take a hit on that one (no pun intended). """ from players import player from board import gameboard from menus import menu # Boards humanBoard = gameboard() hitBoard = gameboard() # Players human = player(0) computer = player(1) # Interaction object. menu = menu() # Intro and placement instructions menu.intro() menu.placementInst() # Setting fleet. human.storeShips(menu.placeShips(humanBoard))