Guest User

Untitled

a guest
Jan 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. board[y][x]
  2. board = []
  3.  
  4. #Start with a greeting, player chooses against computer or another opponent
  5. game = input("""Welcome to a bad game of BATTLESHIPS, a game where you must
  6. destroy your opponent's ships. Please choose against Computer, if you are playing
  7. alone (computer), or against another opponent (player).""")
  8.  
  9. if game.lower() == 'c':
  10.  
  11.  
  12. #Set up the board automatically
  13.  
  14.  
  15. #Players place their ships (The computer will place the ships anywhere automatically)
  16.  
  17.  
  18. #Players choose co-ordinates to destroy the opponent's ships
  19. board[y] = input("Please enter the letter co-ordinate: ")
  20. board[x] = input("Please enter the number co-ordinate: ")
  21. if board[y][x] == "X":
  22. print("Hit!")
  23. #this part of the boat has now been sunk
  24. board[y][x] = "O"
  25.  
  26. #At the end of the player's turn the computer chooses the co-ordinates randomly
  27.  
  28. #If a player or computer destroys all the opponent's ships they win
  29.  
  30.  
  31.  
  32. if game.lower() == 'p':
  33.  
  34. #Set up the board automatically
  35.  
  36.  
  37. #Players place their ships
  38.  
  39.  
  40. #Players choose co-ordinates to destroy the opponent's ships in order to win
  41. board[y] = input("Please enter the letter co-ordinate: ")
  42. board[x] = input("Please enter the number co-ordinate: ")
  43. if board[y][x] == "X":
  44. print("Hit!")
  45. #this part of the boat has now been sunk
  46. board[y][x] = "O"
  47.  
  48. #Every turn the module will space out so they cannot see the opponent's ships
  49. for n in range(50):
  50. print("")
  51.  
  52. #If a player destroys all the opponent's ships they win
Add Comment
Please, Sign In to add comment