def setUp(self): self.s = board(10) self.s.make_the_board() self.t = board(10) self.t.make_the_board() self.b = boats({2:1,3:1,4:1,5:1},10)
def setUp(self): self.s = board(10) self.s.make_the_board() self.t = board(10) self.t.make_the_board() self.b = boats({2: 1, 3: 1, 4: 1, 5: 1}, 10)
#media.play(snd) # if it's 1, it's player vs player if b == 1: #create the boards for both player one and player 2 board_size = working_class.set_board_size() # ask how many ships of each kinds is wanted the_boat_numbers = working_class.kinds_of_boats([2, 3, 4, 5], \ board_size) player_one_board = board(board_size) player_one_board.make_the_board() player_two_board = board(board_size) player_two_board.make_the_board() # make a list of permutations for each boat and save it to the # corresponding list the_list = player_one_board.make_full_number_list() b = boats(board_size, the_boat_numbers) permutation_list5 = b.permutation_list(the_list, 5) permutation_list4 = b.permutation_list(the_list, 4) permutation_list3 = b.permutation_list(the_list, 3) permutation_list2 = b.permutation_list(the_list, 2) #randomly choose the coordinates for the wanted ships for player one # and player two. NOTE that they will NOT be the same. boat_list_1 = \ working_class.random_choosing_of_boats(permutation_list2, permutation_list3, permutation_list4,\ permutation_list5, the_boat_numbers) #Converted_lists converts the boat_lists into a coordinate system that # is used by the game board converted_list_1 = \ working_class.converted_perm(boat_list_1, board_size) boat_list_2 = \