Do My Homework / Homework Help Answers / Computer Science Homework Help / Help on python turtle & hare assignment

Help on python turtle & hare assignment

Need help with this question or any other Computer Science assignment help task?

I have an assignment for my CSCI 1301 class today. I need assistance with it by 3pm est today. We are using the Intro to Python book and the assignment covers chapters 1-3
Additional Instructions:
Make sure you read everything on this homework assignment. The difference between getting an A or a C can come down to paying attention to and implementing the details of the assignment. A couple important notes/requirements: · Name your file Assignment2.py · Make sure you include the proper white space. Each programming statement should be on its own line. · Include a docstring “header” comment block at the top of the file with the name of the file, an ample description of the assignment, your name and date created/modified. · Include a docstring “header” comment block above each of the three functions that you create. This function header should include a short description of the purpose of the function along with a list of the formal parameters(if any) and a short description of each. · Include a decent amount of comments inside the file for calculations and other notable code. You should have at least 6 good single line comments in the file in addition to the “header” comment block at the top of the program and the function headers · Make sure all variables have meaningful names. Do not create any variables that are single letters or abbreviations that are so short that they aren’t obvious what they represent. · You may work together on the assignment or ask for assistance. You are NOT allowed to copy someone else’s work or have someone do the assignment for you. · DO NOT: · Do not use anything not covered in the first four chapters in the book. · Do not use a break or continue statement · Do not use poor variable names (Yes, I know I already mentioned it) Assignment #2 Specifics- Solve the tortoise and the hare program (problem 4.12 on page 152), but with the following guidelines and modifications 1. The book requires that you create two functions. I want you to create three functions: a. One function will take no parameters and return a move value for the hare i. Give this function a meaningful name. For example: hare_move ii. The function should generate a random number and with an if statement should determine how big a move is to be made. iii. Return a numeric value that represents the size and direction of the move iv. The function shouldn’t do anything beyond this b. One function will take no parameters and return a move value for the tortoise i. Give this function a meaningful name. ii. The function should generate a random number and with an if statement should determine how big a move is to be made. iii. Return a numeric value that represents the size and direction of the move iv. The function shouldn’t do anything beyond this c. One function will take two parameters and will not return a value. This function will be responsible for printing the results of each second/movement. i. Give this function a meaningful name. ii. The function will use two parameters that are passed to it. One of the parameters will be the position of the hare and the other will be the position of the tortoise iii. The function must use a for loop to loop seventy times to mark each of seventy positions in a turn. Make sure you do it 70 times and not 69. 1. At each of the 70 positions you will determine whether to print a ‘T’, a ‘H’, an ‘Ouch’, or a period 2. Note: the book tells you to print nothing if the position is not a T, H, or Ouch. I want you to print a . (a period) so that it is easier to judge the distance. 3. The book is a bit confusing when it talks about a second. They are just trying to explain a single movement of both the hare and tortoise. 4. Each time this function is called, it will print a single line to output. On this line there should be either 68 or 69 periods along with a T and H or an Ouch respectively. iv. Example output of the text after finishing/exiting the loop ……………H…..T………………………………………… v. The function shouldn’t do anything beyond this 2. The main program will initialize the location of the hare and the tortoise at position #1. 3. Use a while loop to repeat until either the tortoise or the hare’s position is equal to or exceeds 70. a. Call the hare moving function and update the position of the hare. If that position causes the position to go below 1, reset the value to 1. For example, the hare cannot be placed in position 0 or lower. b. Call the tortoise moving function with the same requirements as with the hare. c. After the “movement”, call the function to print the hare and tortoise location for this “turn” d. After calling the print function, in the main program- print out the hare and tortoise’s numeric position. For example, Tortoise position: 7 Hare position: 1 This should be on the same line as the location of the two animals and the periods. But after this is printed, it should move down to the next line for the next “animal movement”. 4. Outside of the while loop, with an if statement, determine which of 3 possible outcome statements to print. Note: I solved this problem with 52 lines of code. This did not include any blank lines. It also didn’t include comments or header comments for the file or the functions. I give you this number just so you know approximately how many lines of code it takes to solve the problem. Your program may be shorter or longer than my amount and still be perfectly fine. Suggestions 1. Did you meet all the requirements? Go back and reread the requirements in the book and reread all the requirements/modifications I have made. 2. Fully test your code. Does it work for every scenario? a. Do you get three different results: The tortoise wins some/the hare wins some/there is a chance of a tie. Note: I had to run my program over 20 times before I got a tie. b. Does your program have both characters move both forward and backward? c. Does your program have the possibility that both the hare and tortoise end up on the same space? d. Have you traced your program to see that it is looping correctly and choosing the correct if options? 3. Give all your variables meaningful names. To you i might seem like a good variable name for a loop control variable, but counter would be better.
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other others

Get Help With a similar task to - Help on python turtle & hare assignment

Related Questions

Similar orders to Help on python turtle & hare assignment
Popular Services
Tutlance Experts offer help in a wide range of topics. Here are some of our top services: