pixel_friends
1from cs110_p1 import pixel_art 2 3__docformat__ = "google" 4 5_GOOMBA_COLORS = [None, "saddle brown", "black", "tan", "white"] 6# goomba 7_GOOMBA = [ 8 (0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0), 9 (0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0), 10 (0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0), 11 (0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0), 12 (0, 0, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 0, 0), 13 (0, 1, 1, 1, 4, 2, 1, 1, 1, 1, 2, 4, 1, 1, 1, 0), 14 (0, 1, 1, 1, 4, 2, 2, 2, 2, 2, 2, 4, 1, 1, 1, 0), 15 (1, 1, 1, 1, 4, 2, 4, 1, 1, 4, 2, 4, 1, 1, 1, 1), 16 (1, 1, 1, 1, 4, 4, 4, 1, 1, 4, 4, 4, 1, 1, 1, 1), 17 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 18 (0, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0), 19 (0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0), 20 (0, 0, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 0, 0), 21 (0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 0), 22 (0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0), 23 (0, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 0, 0) 24] 25 26_HEART_COLORS = [None, "#E0607E", "black", "white"] 27_HEART = ( 28 (0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0), 29 (0, 1, 1, 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157def mario(top_left, version=0, colors=[], size=10, tag=""): 158 """ 159 A function that draws mario! 160 Args: 161 top_left (`tuple`): (x, y) coordinate to locate the mario 162 version (`int`): 0, 1, 2, or 3 to designate which mario you"d like to draw 163 colors (`List`): A list of colors to designate for each grid square (length of 7). 164 tag (`str`): The tag to assign to the mario drawn. 165 size (`int`): The size of each square. 166 167 """ 168 169 if len(colors) == 0 170 colors = _MARIO_COLORS 171 172 if version == 0 173 art = _MARIO_0 174 175 elif version == 1 176 art = _MARIO_1 177 178 elif version == 2 179 art = _MARIO_2 180 181 elif version == 3 182 art = _MARIO_3 183 184 else 185 raise Exception("Uh oh, we don"t have that Mario version.") 186 187 pixel_art(top_left, art, palette=colors, pixel=size, tag=tag) 188 189def goomba(top_left, colors=[], size=10, tag=""): 190 """ 191 A function that draws a goomba! 192 Args: 193 top_left (`tuple`): (x, y) coordinate to locate the goomba 194 colors (`List`): A list of colors to designate for each grid square (length of 5). 195 tag (`str`): The tag to assign to the goomba drawn. 196 size (`int`): The size of each square. 197 198 """ 199 if len(colors) == 0 200 colors = _GOOMBA_COLORS 201 202 pixel_art(top_left, _GOOMBA, palette=colors, pixel=size, tag=tag) 203 204def heart(top_left, colors=[], size=10, tag=""): 205 """ 206 A function that draws a heart! 207 Args: 208 top_left (`tuple`): (x, y) coordinate to locate the heart 209 colors (`List`): A list of colors to designate for each grid square (length of 4). 210 tag (`str`): The tag to assign to the heart drawn. 211 size (`int`): The size of each square. 212 213 """ 214 if len(colors) == 0 215 colors = _HEART_COLORS 216 217 pixel_art(top_left, _HEART, palette=colors, pixel=size, tag=tag) 218 219def frank(top_left, colors=[], size=10, tag=""): 220 """ 221 A function that draws FRANK! 222 Args: 223 top_left (`tuple`): (x, y) coordinate to locate frank. 224 colors (`List`): A list of colors to designate for each grid square (length of 4). 225 tag (`str`): The tag to assign to the frank drawn. 226 size (`int`): The size of each square. 227 228 """ 229 if len(colors) == 0 230 colors = _FRANK_COLORS 231 232 pixel_art(top_left, _FRANK, palette=colors, pixel=size, tag=tag) 233 234 235def link(top_left, colors=[], size=10, tag=""): 236 """ 237 A function that draws Link! 238 Args: 239 top_left (`tuple`): (x, y) coordinate to locate the mario 240 colors (`List`): A list of colors to designate for each grid square (length of 7). 241 tag (`str`): The tag to assign to the mario drawn. 242 size (`int`): The size of each square. 243 244 """ 245 246 if len(colors) == 0 247 colors = _LINK_COLORS 248 249 pixel_art(top_left, _LINK, palette=colors, pixel=size, tag=tag)
def
mario(top_left, version=0, colors=[], size=10, tag=""):
158def mario(top_left, version=0, colors=[], size=10, tag=""): 159 """ 160 A function that draws mario! 161 Args: 162 top_left (`tuple`): (x, y) coordinate to locate the mario 163 version (`int`): 0, 1, 2, or 3 to designate which mario you"d like to draw 164 colors (`List`): A list of colors to designate for each grid square (length of 7). 165 tag (`str`): The tag to assign to the mario drawn. 166 size (`int`): The size of each square. 167 168 """ 169 170 if len(colors) == 0 171 colors = _MARIO_COLORS 172 173 if version == 0 174 art = _MARIO_0 175 176 elif version == 1 177 art = _MARIO_1 178 179 elif version == 2 180 art = _MARIO_2 181 182 elif version == 3 183 art = _MARIO_3 184 185 else 186 raise Exception("Uh oh, we don"t have that Mario version.") 187 188 pixel_art(top_left, art, palette=colors, pixel=size, tag=tag)
A function that draws mario!
Arguments:
- top_left (
tuple
): (x, y) coordinate to locate the mario - version (
int
): 0, 1, 2, or 3 to designate which mario you'd like to draw - colors (
List
): A list of colors to designate for each grid square (length of 7). - tag (
str
): The tag to assign to the mario drawn. - size (
int
): The size of each square.
def
goomba(top_left, colors=[], size=10, tag=""):
190def goomba(top_left, colors=[], size=10, tag=""): 191 """ 192 A function that draws a goomba! 193 Args: 194 top_left (`tuple`): (x, y) coordinate to locate the goomba 195 colors (`List`): A list of colors to designate for each grid square (length of 5). 196 tag (`str`): The tag to assign to the goomba drawn. 197 size (`int`): The size of each square. 198 199 """ 200 if len(colors) == 0 201 colors = _GOOMBA_COLORS 202 203 pixel_art(top_left, _GOOMBA, palette=colors, pixel=size, tag=tag)
A function that draws a goomba!
Arguments:
- top_left (
tuple
): (x, y) coordinate to locate the goomba - colors (
List
): A list of colors to designate for each grid square (length of 5). - tag (
str
): The tag to assign to the goomba drawn. - size (
int
): The size of each square.
def
heart(top_left, colors=[], size=10, tag=""):
205def heart(top_left, colors=[], size=10, tag=""): 206 """ 207 A function that draws a heart! 208 Args: 209 top_left (`tuple`): (x, y) coordinate to locate the heart 210 colors (`List`): A list of colors to designate for each grid square (length of 4). 211 tag (`str`): The tag to assign to the heart drawn. 212 size (`int`): The size of each square. 213 214 """ 215 if len(colors) == 0 216 colors = _HEART_COLORS 217 218 pixel_art(top_left, _HEART, palette=colors, pixel=size, tag=tag)
A function that draws a heart!
Arguments:
- top_left (
tuple
): (x, y) coordinate to locate the heart - colors (
List
): A list of colors to designate for each grid square (length of 4). - tag (
str
): The tag to assign to the heart drawn. - size (
int
): The size of each square.
def
frank(top_left, colors=[], size=10, tag=""):
220def frank(top_left, colors=[], size=10, tag=""): 221 """ 222 A function that draws FRANK! 223 Args: 224 top_left (`tuple`): (x, y) coordinate to locate frank. 225 colors (`List`): A list of colors to designate for each grid square (length of 4). 226 tag (`str`): The tag to assign to the frank drawn. 227 size (`int`): The size of each square. 228 229 """ 230 if len(colors) == 0 231 colors = _FRANK_COLORS 232 233 pixel_art(top_left, _FRANK, palette=colors, pixel=size, tag=tag)
A function that draws FRANK!
Arguments:
- top_left (
tuple
): (x, y) coordinate to locate frank. - colors (
List
): A list of colors to designate for each grid square (length of 4). - tag (
str
): The tag to assign to the frank drawn. - size (
int
): The size of each square.
def
link(top_left, colors=[], size=10, tag=""):
236def link(top_left, colors=[], size=10, tag=""): 237 """ 238 A function that draws Link! 239 Args: 240 top_left (`tuple`): (x, y) coordinate to locate the mario 241 colors (`List`): A list of colors to designate for each grid square (length of 7). 242 tag (`str`): The tag to assign to the mario drawn. 243 size (`int`): The size of each square. 244 245 """ 246 247 if len(colors) == 0 248 colors = _LINK_COLORS 249 250 pixel_art(top_left, _LINK, palette=colors, pixel=size, tag=tag)
A function that draws Link!
Arguments:
- top_left (
tuple
): (x, y) coordinate to locate the mario - colors (
List
): A list of colors to designate for each grid square (length of 7). - tag (
str
): The tag to assign to the mario drawn. - size (
int
): The size of each square.