Exemplo n.º 1
0
        #If exit is inputed
        if command == "exit":
            if variable == "battleships":
                sys.exit()
            else:
                print(
                    "Invalid exit command, Please input a valid exit command\n"
                )

        #If show is inputed
        if command == "show":
            if variable == "ships":
                player1.show_ships(number_of_ships, grid_player1)

            if variable == "coordinates":
                coordinate_map.show_coordinates(grid_size, grid_coordinates)

            if variable != "ships" and variable != "coordinates":
                print(
                    "Invalid show command, Please input a valid show command\n"
                )

        #If place is inputed
        if command == "place":
            try:
                #Breaking down the variable into 3 parts with , as the seperators and assigning them to orientation, x_coordinate_string and y_coordinate_string respectively
                orientation, x_coordinate_string, y_coordinate_string = variable.split(
                    ',')

                #Catching to see if x and y coordinates are ints
                try: