Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import random from typing import Tuple, Optional def make_grid(w: int, h: int, player_coord: Tuple[int, int], gold_coord: Tuple[int, int]) -> List[List[str]]: Given two integers width w
import random from typing import Tuple, Optional def make_grid(w: int, h: int, player_coord: Tuple[int, int], gold_coord: Tuple[int, int]) -> List[List[str]]: Given two integers width w and height h, create a list of lists to represent a grid of the given width and height. The coordinates for the player and the gold is also given as two two-element tuples. For each tuple, the first element has the x-coordinate and the second element has the y-coordinate. The player and the gold should be included in the grid in the positions specified by these tuples. The player is represented with the string '(x)' The gold is represented with the string '(o)' All other spaces are represented with the string '(_)' Return this list. >>> make_grid(2, 3, (0, 0), (1, 2)) [['(x)', '()'], ['()','()'], ['(_)', '(0)']] pass
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started