def generate_goals(num_goals: int) -> List[Goal]: """Return a randomly generated list of goals with length num_goals. All elements of the list must be the same type of goal, but each goal must have a different randomly generated colour from COLOUR_LIST. No two goals can have the same colour. Precondition: - num_goals <= len(COLOUR_LIST) """ x = COLOUR_LIST n = random.randint(0, 1) temp = [] colour = [] if n == 1: while len(temp) < num_goals: color = COLOUR_LIST[random.randint(0, len(x) - 1)] if not colour.__contains__(color): colour.append(colour_name(color)) temp.append(PerimeterGoal(color)) while len(temp) < num_goals: color = COLOUR_LIST[random.randint(0, len(x) - 1)] if not colour.__contains__(colour_name(color)): colour.append(colour_name(color)) temp.append(BlobGoal(color)) return temp
def description(self) -> str: """Return a description of this goal. """ description = "The player must aim to put the most possible units " + \ "of " + colour_name(self.colour) + " on the outer" +\ " perimeter." return description
def description(self) -> str: """ returns the description of the goal """ color = colour_name(self.colour) return 'Player must aim to put the most possible units {} on the outer'\ 'perimeter'.format(color)
def description(self) -> str: """Return a precise string description of the perimeter goal and the target colour """ target = colour_name(self.colour) description = f'Perimeter Goal:Put the most possible units of ' \ f'{target} cells on outer perimeter' return 'DESCRIPTION: ' + description
def description(self) -> str: """Return a precise string description of blob goal and the target colour """ target = colour_name(self.colour) description = f'Blob Goal: Aim for the largest group of connected ' \ f'{target} blocks' return 'DESCRIPTION: ' + description
def _print_colours(x: int, y: int, text_height: int, font: pygame.font.Font, image: pygame.Surface)\ -> int: _print_to_image('Colours', x, y, font, image) # Indent the next item x += 10 y += text_height + Y_FONT_PADDING for c in COLOUR_LIST: _print_to_image(colour_name(c), x, y, font, image, c) y += text_height + Y_FONT_PADDING return y
def __str__(self) -> str: """Return this Block in a string format. """ if len(self.children) == 0: indents = '\t' * self.level colour = colour_name(self.colour) return f'{indents}Leaf: colour={colour}, pos={self.position}, ' \ f'size={self.size}, level={self.level}\n' else: indents = '\t' * self.level result = f'{indents}Parent: pos={self.position},' \ f'size={self.size}, level={self.level}\n' for child in self.children: result += str(child) return result
def __str__(self) -> str: """Return this Block in a string format. >>> block = Block((0, 0), 750, (0, 0, 0), 0, 1) >>> str(block) 'Leaf: colour=Black, pos=(0, 0), size=750, level=0\\n' """ if len(self.children) == 0: indents = '\t' * self.level colour = colour_name(self.colour) return f'{indents}Leaf: colour={colour}, pos={self.position}, ' \ f'size={self.size}, level={self.level}\n' else: indents = '\t' * self.level result = f'{indents}Parent: pos={self.position},' \ f'size={self.size}, level={self.level}\n' for child in self.children: result += str(child) return result
def description(self) -> str: """ Returns the goal of the player on the bottom right section of the game screen. This goal is for BlobGoal. """ colour = colour_name(self.colour) return 'Goal: Create the largest blob with {0}.'.format(colour)
def description(self) -> str: return 'Create a largest “blob” of ' + colour_name(self.colour)
def description(self) -> str: """ Returns the goal of the player on the bottom right section of the game screen. This goal is for PerimeterGoal. """ colour = colour_name(self.colour) return 'Goal: Fill the perimeter with {0}.'.format(colour)
def description(self) -> str: return 'Make the largest \'blob\' (area) of' + colour_name(self.colour)
def description(self) -> str: return 'Most unit cells of ' + \ colour_name(self.colour) + ' on the perimeter'
def description(self) -> str: return 'Blob Goal: Create the largest “blob” of ' \ + colour_name(self.colour) + '.'
def description(self) -> str: # Reviewed 17/03/2020 colour = colour_name(self.colour) return 'Connect as many {0} units together!'.format(colour)
def description(self) -> str: """Return a description of the goal, including the target colour.""" return 'Create the largest connected blob of {}.'.format( colour_name(self.colour))
def description(self) -> str: return 'Make the largest ' + colour_name(self.colour) + \ ' border around the board'
def description(self) -> str: """this tells the user what there goal is """ return 'Get ' + colour_name(self.colour) + 'blocks on' \ ' the sides of the board. Corners are worth double'
def description(self) -> str: """this tells the user what there goal is """ return 'Connect as many blocks of ' + colour_name(self.colour) + \ ' as possible'
def description(self) -> str: statement = 'Biggest group of blobs of' + colour_name(self.colour) return statement
def description(self) -> str: statement = 'Achieve squares of' + colour_name(self.colour) + \ 'to touch the perimeter of the board.' return statement
def description(self) -> str: description = "The player must aim for the largest group of " +\ "connected blocks of " + colour_name(self.colour) + "." return description
def description(self) -> str: colour = colour_name(self.colour) return f'PerimeterGoal: Surround the perimeter of the board with {colour}.'
def description(self) -> str: colour = colour_name(self.colour) return f'BlobGoal: Make the biggest {colour} blob.'
def description(self) -> str: return 'Perimeter Goal: Put most unit cell ' \ 'of ' + colour_name(self.colour) + \ ' on the outer perimeter.'
def description(self) -> str: # TODO: Implement me return 'Most unit cells of ' + colour_name(self.colour) + \ ' on the perimeter'
def description(self) -> str: # Reviewed 17/03/2020 colour = colour_name(self.colour) return 'Place as many {0} units on the perimeter!'.format(colour)
def description(self) -> str: # TODO: Implement me return 'Largest group of connected blocks of ' + \ colour_name(self.colour)
def description(self) -> str: """Return a description of the goal, including the target colour.""" return 'Create the most {} on the perimeter.'.format( colour_name(self.colour))
def description(self) -> str: """ returns the description of the goal """ color = colour_name(self.colour) return 'Player must aim for the largest "blob" of {}'.format(color)