Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

What is the difference between a secured and an unsecured loan?

Answered: 1 week ago