Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3 treasure hunt Turtle graphics Utilizing data printed in the format of [

ID: 3742634 • Letter: P

Question

Python 3 treasure hunt
Turtle graphics
Utilizing data printed in the format of


['Start', 'Top left', 0]
['South', 3, 2]
['East', 2, 0]...

Create a program that will
1) go to the starting position
('Top left', 'Top right', 'Centre', 'Bottom left', 'Bottom right')

2) Draw a token (1 to 5)
(Token_0, token_1, Token_2, Token_3, Token_ 4)

3) Set direction
(north, south, east, west)

4) Move forward
(1, 2 , 3 , 4 , 5 etc.)

5) draw next token

and do steps 3-5 an inditerminate amount of times as specified by a randi generation the list input is 'random_path'.
I have already written functions to
1) draw the tokens (ie. token_1(x,y) will draw token 1 at coordinates input, (pos([0]), pos([1]))) and
2) written a function to change heading into seth() depending on the heading,
3) turned movement squares into movement in pixels (ie... def movement(x): forward(x*250)
4) turned the number into an input to select the token (ie.. def token_selector(toke): if toke == 0: token_0)


Need help with getting this to work

# Follow the path as per the provided dataset
something = random_path
counter = len('something')
count = 0
def follow_path(random_path):
start_pos([random_path[1]])
toke = random_path[2]
token_selector(toke)
count = 2

for r in (counter - 2):
#Set heading
heading(random_path[count])
count = count + 1
#Move forward
movement(random_path[count])
count = count + 1
#draw toke
token_selector(random_path[count])
count = count + 1

pass

More information is available at
https://www.chegg.com/homework-help/questions-and-answers/task-description-treasure-map-assignment-tests-skills-processing-data-stored-lists-creatin-q30672407?trackid=67fa614a&strackid=715f3586&ii=3
Someone else has a similar issue

Explanation / Answer

import random
import turtle
from turtle import Turtle, Screen

# Program to go to the starting position
TURTLE_Size=20
directions= turtle. Turtle() #Print the steps
screen= turtle.Screen() #Screen creation
yertle = Turtle ( shape="turtle", visible=False)
yertle.showturtle()
yertle.penup()
yertle.goto(TURTLE_SIZE/2 - screen.window_width()/2, screen.window_height()/2 - TURTLE_Size/2)
yertle.pendown()
screen.mainloop()

# Draw tokens
a_turtle.seth(random_360)
a_turtle.penup()
a_turtle.goto(0,0)
a_turtle.speed(10)
for i in range(50):
   random_360= random. randint(0,360)
   random_xy= randpm.randint(-200,200), random.randint(-200,200))
   a_turtle.stamp()
#Set direction
screen.onkey(south,'down)
screen.onkey(north, 'up')
screen.onkey(east, 'left')
screen.onkey(west, 'right')
screen.listen()

#move forward
path=['1','2','3','4','5'] #all the forwarding steps
def south():
   k.setheading(270)
   k.forward(unit)

def north():
   k.setheading(90)
   k.forward(unit)

def east():
   k.setheading(180)
   k.forward(unit)

def west():
   k.setheading(0)
    k.forward(unit)

def enter():
next_step = True
z=0
while len(path)!=0:
   l=len(path)
   directions.write(path.pop(randon.randint(0,1,-1)))
   while not next_step:
       z=z+1;
       print z
       print next_step