
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


Step by stepSolved in 4 steps with 2 images

- Draw Design Layout References Mailings Review View Help Create a Java program and name your file: FIRSTNAME. java (for example, lohn.java). Work on the following: Create three interfaces with the names "InterfaceOne," "IrnterfaceTwo," and "Interfacelhree" In the first interface, declare a method (signature only) with a name "updateGear()." In the second interface, dedare a method (signature only) with a name "accelerate()." In the third interface, dedare a method (signature only) with a name "pusherake()." Create two classes Car and Truck that implement these three interfaces at one time. Define a new method "currentSpeed()" in both the classes to find the current speed after the brake. • Define all the three methods inside each class. The data to these methods will be provided during the object creation. Invoke the two objects with a name c1 of class Car and t1 of class Truck. • After creating the objects, call all the three methods defined above in both the classes. Pass any of the…arrow_forwardPythonarrow_forwardPlease help me with the following below using java. Instructions is in the image below. Please show me the image of the two fractals you chose from the image below.arrow_forward
- Please help me with this using java. create a trivia game menu. Include the following: 1. Background (using fractals and recursion) (I would like a black brick wall as as the fractal for the background of the game menu 2. include the three clickable buttons ( play, settings, and instructions) 3. Include a title (Quiz time) (Image show below)arrow_forwardPlease help me with thisarrow_forwardCreate a calculator that only supports division and multiplication operations using Java and a graphical user interface (GUI). Clear, ON, and OFF buttons must all be present.arrow_forward
- NEED HELP PYTHON ONLY PLZZarrow_forwardIn JAVA PROGRAMMING please read details on pictures thank you. (You will need to read in the student data first and then read in the scores) You will open each file and read the information into their respective classes/arrays For each student, you will calculate their lowest score, their highest score, their average, and their grade. For each quiz, you will calculate the lowest score, the highest score, and the average You will create and print an Honor Role. The Honor Role comprises students who received an ‘A’ grade. REPORT WILL LOOK LIKE THIS LastName FirstName StudentID Score 1 Score 2 Score 3 Score 4 Score 5 High Low Average Grade High…arrow_forwardCan you use Python programming language to wirte this code? Thank you very much!arrow_forward
- Write a code using C# for the following images.arrow_forwardusing java (Use the Date class) Write a program that creates a Date object, sets its elapsedtime to 10000, 100000, 1000000, 10000000, 100000000, 1000000000,10000000000, and 100000000000, and displays the date and time using thetoString() method, respectively.arrow_forwardPython code and output screenshot is mustarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





