Hi, could someone take a look and see what the problem is, please.
The problem is with the equation in f_sizeAngle(). I am trying to get an app to draw a geometric shape defined by the number I enter for sides. For example, I enter 3 to draw a triangle.
f_sizeAngle() assumes a regular polygon. According to that equation, for a triangle, it should send 60 for angle size to f_draw(). However, the angles that get drawn are closer to 100 degrees.
I will post it next post:
MIT 6.001 Structure and Interpretation of Computer Programs, Spring 2005
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
## create a program where the user can request a turtle to draw the object of choice.
## the object will be selected by entering the number of sides the object contains.
## the program will use the sides to calculate the size of the angle and will forward this
## information to a function that will draw the object
from swampy.TurtleWorld import *
world = TurtleWorld()
bob = Turtle()
t = Turtle()
sides = int()
## careful since raw_input is a string value it must be converted to integer before being
## passed on to f_sizeAngle() or there will be a type error
x = raw_input("Please enter the number of sides of the object: " )
int_x = int(x)
## compute size of angle from number of sides
n = int(sides)
sizeAngle = (n - 2) * 180 / n ## with sides/n = 3, sizeAngle should = 60. however, it doesn't
f_draw(sizeAngle, n, t)
## draw object
def f_draw(sizeAngle, sides, t):
for i in range (sides):
my guess would be that the swampy module must define angle as external, and my equation is internal....
... when I enter 4 for sides (iow, a square) it works. the angles are drawn corrently. but anything smaller or larger than 90 degrees is off.