Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python The turtle can not double back to where it was before and the program should stop before jr crosses the line. my idea was

Python image text in transcribed

The turtle can not double back to where it was before and the program should stop before jr crosses the line.

image text in transcribed

image text in transcribed

my idea was to use a tuple to keep track of where the turtle has already been and stop it if it tries to revisit. I am have trouble visualizing what needs to be done.

Random walk, like we showed in class today. BUT... you can't go to any place you've already been. If the path crosses itself anywhere, it's wrong. Example at right: (The little circle is the origin) The path ends at the arrowhead, because it's totally blocked, it can't go up, down, left or right. FYI, attached is what we did in class.. pyjny import turtle import random draw = turtle. Turtle() postion = () #keep track of where it went|| box = [(0,50), (50,0),(-50,0), (0,-50)] #stay in box x, y = random.choice(box) position = set() currentposition = turtle.xcor(), turtle.ycor() dx, dy = random.choice (box) #where to go X+=dx y+=dy draw.goto(x,y) Ln: 6 Col: 41

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_2

Step: 3

blur-text-image_3

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 Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago