Answered step by step
Verified Expert Solution
Question
1 Approved Answer
help with this in python? (disregard the GUI) Part 1: Creating the Board We will use a two dimensional list to represent the game board.
help with this in python? (disregard the GUI)
Part 1: Creating the Board We will use a two dimensional list to represent the game board. Each element in the list will be an integer that indicates what type of game piece currently resides at that location. The integers 0 though to (and including) 5 are used to denote standard game pieces bearing the labels 'print', 'if', 'while', 'for', 'def' and 'list'. Empty spaces are denoted by - 1 while the special game piece that clears all of the game pieces of a particular type is denoted by 6. A game board is shown below, along with the list that represents it. print for for def listlist if if for print if list der if list def if while for print def det dei print print til det def for if for) for] while list while def while print def whilelist [[0, 3, 3, 4, 5, 5, 1], [1, 3, , 1, 5, 4, 1], [5, 4, 1, 2, 3, 0, 4], [4, 4, 0, 0, 1, 4, 1], [4, 3, 1, 3, 3, 2, 5), [2, 4, 2, 0, 4, 2, 5]] Create a function named createBoard (notice the use of a lowercase c and an uppercase B). The function will take 3 integer parameters: the number of rows in the board, the number of columns in the board, and the number of unique game pieces that can appear on the board. Your function must return a two-dimensional list with the indicated number of rows and columns. Every value in the twodimensional list must be a random integer r where r is greater than or equal to 0 and less than the number of unique symbols provided as a parameter to the function. The code that I have provided has already imported the randrange function, which you can use to generate a random integer within a range. The game board above was constructed by calling createBoard with parameters indicating 6 rows, 7 columns and 6 unique symbols. Because createBoard returns a random result, you will likely see different integers when you call createBoard with those same parameters, but the structure of the two-dimensional list you create should match what is shown above
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