Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python coding: complete implementation of module class Room(object): A Room represents a rectangular grid containing clean or unclean tiles. A room has a width

python coding: complete implementation of module

class Room(object): """ A Room represents a rectangular grid containing clean or unclean tiles.

A room has a width and a height and contains (width * height) tiles. At any particular time, each of these tiles can be either clean or unclean. """ def __init__(self, width, height): """ Initializes a rectangular room with the specified width and height. Initially, all tiles in the room have cookies on them (unclean!).

width: an integer > 0 height: an integer > 0 """ # TODO: Your code goes here def mark_tile_clean(self, pos): """ Mark the tile at position `pos` as clean. Assumes that `pos` represents a valid position inside this room.

pos: a Position object """ # TODO: Your code goes here def is_tile_clean(self, m, n): """ Return True if the tile (m, n) is clean.

Assumes that (m, n) represents a valid tile inside the room.

m: an integer n: an integer Returns: True if (m, n) is clean, False otherwise """ # TODO: Your code goes here

def get_num_tiles(self): """ Return the total number of tiles in the room.

Returns: an integer """ # TODO: Your code goes here

def get_num_clean_tiles(self): """ Return the total number of clean tiles in the room.

Returns: an integer """ # TODO: Your code goes here def get_random_position(self): """ Return a random position inside the room.

Returns: a Position object. """ # TODO: Your code goes here def is_position_in_room(self, pos): """ Return True if `pos` is inside the room.

pos: a Position object. Returns: True if `pos` is in the room, False otherwise. """ # TODO: Your code goes here

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

responding to them.

Answered: 1 week ago

Question

Don't use AI & Answer fastly.. 1 5 3 .

Answered: 1 week ago