subject

Create a class called WanderBot that inherits from Bot WanderBot is a bot that will wander around randomly. . In the init it should simply call the init from super (and adds no extra instance attributes)
. Note that to do this, the init should take a character input with the same default (8982)
. This value will need to be passed into the super's init
Add two methods to WanderBot Method: wander
This method will choose a random move from the possibilities, making sure that move is valid on the current grid
Procedure
. Initialize a boolean variable has_new_pos as False
. Use a while loop, with the condition not has_new_pos
Set a variable move as the output of calling random. choice on self. moves
Add move to self. position, using add_lists (a function we created earlier), and assign the output to a new variable new_pos
Call check_bounds on new_pos, also passing self. grid_size into check_bounds
Assign the output of check_bounds to has_new_pos
This will lead to exiting the loop when a valid new position has been assigned
Return new_pos
Method: move
No inputs (other than self ) or outputs, just sets self position to be the output of calling self. wander()
Multiple Bots
a) List of bots
Create a list bots_list that contains three distinct WanderBot instances.
Each WanderBot in bots_list will have a different shape, specified with the value passed into the character attribute.
The first WanderBot in bots_list should take the character input value 1078. The second: 1127. The third: 1279.
b) Create grid and play_board
Step 1: Assign two variables
grid_n should be assigned the integer 15
iter_n should be assigned the integer 25
Step 2: Call play_board
Call play_board() with the following inputs for the parameters in play_board:
bots | input should be bots_list
grid_size | input should be grid_n
n_iter | input sould be iter_n
Upon executing the cell, you should see a a 15x15 grid, with three bots (of different shapes), wandering around the grid for 25 iterations.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
Which of these is an example of an integrated presentation? a. a table created in powerpoint b. an image pasted into powerpoint c. a caption created in powerpoint d. an excel chart pasted into powerpoint
Answers: 1
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
You know the right answer?
Create a class called WanderBot that inherits from Bot WanderBot is a bot that will wander around ra...
Questions
question
Business, 15.04.2020 23:43