Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE PYTHON 3 : Write a Tom and Jerry game using the turtle module. The rules of the game are given as follows: A

PLEASE USE PYTHON 3 :

Write a "Tom and Jerry" game using the turtle module. The rules of the game are given as follows: A room is designed with a grid. Both Jerry and Tom can only move on the grid within the room. Jerry will start from the center of the room, and for every step he can randomly pick one out of four directions to go. Tom will also start from the center of the room, but k steps after Jerry. For every step Tom will move towards Jerry along the closest path. If there are more than one closest path, then Tom will randomly pick one path to go. The game will end when Tom meets Jerry, i.e., both of them appear at the same position.

  1. Write three classes: Room, Tom, Jerry. Provide the necessary attributes and methods for each of them.
  2. Write a function __main__() to simulate the game on a turtle screen.

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

Students also viewed these Databases questions