Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a flowchart based on the pseudocode given below: First we need to create our turtles, and assign each one to a different color and

Create a flowchart based on the pseudocode given below:

image text in transcribed
First we need to create our turtles, and assign each one to a different color and position on the starting line. Each turtle is a different instance of a Turtle , so we Set up game. can do this ! Create a few turtles, each with its own color and position on the We're going to let the race run until a turtle wins by starting line. crossing the finish line. But we need a way to know if a turtle has won. Let's create a variable called winner that is initially set to False, and then set it to True 2 Start the race. when a turtle crosses the line. Set a variable winner to False. While winner is false: Now we're just going to cycle over each A For each turtle: turtle, over and over, letting it make a move - that is , until one of them wins. Pick a random amount to move forward, say between 0 and 2 pixels. To make a move, we'll generate a random Move forward. number between O and 2 and move the turtle by that amount-and we'll do this ii Check to see if turtle's position is across finish line. for each turtle. If so: a Set winner to True. Each time we move we need to check to see if the turtle crossed the 3 Game finishes. finish line . And if so , we'll set winner to True. Announce the winner's name! Once winner is set to True, the loop stops and we'll announce a winner

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

Step: 3

blur-text-image

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. What type of good (e.g., convenience, shop- ping) is a Harley?

Answered: 1 week ago