Пример #1
0
            sys.exit("Thank you for playing.")

    game = playerorcomputer()
    l = inputlength()
    w = inputwidth()
    a = space_occupied(num_bs(), num_cru(), num_frig(), num_mine(), l, w)
    b, c, d, e = a[0], a[1], a[2], a[3]
    name1 = raw_input('Enter the name of player 1: ')
    name2 = raw_input('Enter the name of player 2: ')

    g = Board(l, w, a, b, c, d, game)

    if game == 'c':
        a = Player(l, w, b, c, d, e, name1)
        f = ComputerPlayer(l, w, b, c, d, e, name2)
        a.place_ships()
        a.draw_board()
        f.place_ships()
        a.opp_coord_copy(f.coordinates)
        f.opp_coord_copy(a.coordinates)
        g = Board(l, w, a, b, c, d, game)
        g.player_vs_computer(a, f, a.coordinates, f.coordinates)

    elif game == 'p':
        a = Player(l, w, b, c, d, e, name1)
        f = Player(l, w, b, c, d, e, name2)
        a.place_ships()
        a.draw_board()
        f.place_ships()
        f.draw_board()
        a.opp_coord_copy(f.coordinates)