Coding in python Please!!I need help please help me in the easiest way to do this coding question. Please do not post it's answer from chegg just use your own skills to write code in easyiest way possible. I will really appriciate your help. Coding language PYTHON : The purpose of this assignment is to help you get comfortable creating and using simple classes and objects. In this assignment, we wish to model a 2-D video game character’s movements.  In particular, suppose we are creating a tiny game, where the character can occupy one of 25 squares, like so:     The first thing we need to keep track of is the character’s name, so we can differentiate this character from other characters or enemies.  The other thing we need to keep track of is the character’s position, i.e., which square they are in.  In order to do this, we’ll use an X-Y coordinate system with the origin in the top left corner (the 0,0 square in the picture).  So, in the picture, the character occupies square 3, 2; that is, x=3 and y=2.  Your task is to create a class representing the Character.  Your class should have three attributes: name, x, and y.  Your class should have an __init__ method.  The __init__method should accept a name (required) as an argument, and should accept optional arguments for x and y.  If x and y are not supplied, they should default to 0, 0.  For the time being, we will not require any error checking to prevent invalid x and y values.  Your class should also have a __str__ method, which should return a string that looks like the following: Bob, x: 2, y: 3 Where Bob is whatever the Character’s name is.  Lastly, your class should have four methods: move_up(), move_left(), move_down(), move_right().  The methods should each check to make sure the move is possible, and if so, update the x or y value appropriately.  If the move isn’t legal, you should just print an error message (i.e., “cannot move up, already at the top!”), and not update any values.   An example of the program running is provided here: >>> bob = Character (“Bob”, 0, 1) >>> print(bob) Bob, x: 0, y: 1 >>> bob.move_up() >>> print(bob) Bob, x: 0, y: 0 >>> bob.move_right() >>> print(bob) Bob, x: 1, y: 0 >>> bob.move_up() Error: can’t move up, already at the top! >>> bob.move_down() >>> bob.move_down() >>> bob.move_down() >>> print(bob)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Coding in python

Please!!I need help please help me in the easiest way to do this coding question. Please do not post it's answer from chegg just use your own skills to write code in easyiest way possible. I will really appriciate your help.

Coding language PYTHON :

The purpose of this assignment is to help you get comfortable creating and using simple classes and objects.

In this assignment, we wish to model a 2-D video game character’s movements.  In particular, suppose we are creating a tiny game, where the character can occupy one of 25 squares, like so:

 

 

The first thing we need to keep track of is the character’s name, so we can differentiate this character from other characters or enemies.  The other thing we need to keep track of is the character’s position, i.e., which square they are in.  In order to do this, we’ll use an X-Y coordinate system with the origin in the top left corner (the 0,0 square in the picture).  So, in the picture, the character occupies square 3, 2; that is, x=3 and y=2. 

Your task is to create a class representing the Character.  Your class should have three attributes: name, x, and y.  Your class should have an __init__ method.  The __init__method should accept a name (required) as an argument, and should accept optional arguments for x and y.  If x and y are not supplied, they should default to 0, 0.  For the time being, we will not require any error checking to prevent invalid x and y values. 

Your class should also have a __str__ method, which should return a string that looks like the following:

Bob, x: 2, y: 3

Where Bob is whatever the Character’s name is. 

Lastly, your class should have four methods: move_up(), move_left(), move_down(), move_right().  The methods should each check to make sure the move is possible, and if so, update the x or y value appropriately.  If the move isn’t legal, you should just print an error message (i.e., “cannot move up, already at the top!”), and not update any values.

 

An example of the program running is provided here:

>>> bob = Character (“Bob”, 0, 1)

>>> print(bob)

Bob, x: 0, y: 1

>>> bob.move_up()

>>> print(bob)

Bob, x: 0, y: 0

>>> bob.move_right()

>>> print(bob)

Bob, x: 1, y: 0

>>> bob.move_up()

Error: can’t move up, already at the top!

>>> bob.move_down()

>>> bob.move_down()

>>> bob.move_down()

>>> print(bob)

Bob, x: 1, y: 3

0,0
1,0
2,0
3,0
4,0
0,1
0,2
0,3
0,4
Transcribed Image Text:0,0 1,0 2,0 3,0 4,0 0,1 0,2 0,3 0,4
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY