Python Forum

Full Version: Making a dozen houses
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm new to here and to python. I've till midnight tonight to finish this assignment to make a dozen houses of different shapes and sizes, but I cannot figure this out at all. I have the first house completed, but no matter what I try the second house always overlaps the first and ruins the whole thing. Can someone please shed some light on this situation? Here's the code I have so far.

c = makeEmptyPicture(700, 500)
#walls and door
addRect(c, 20*1+4, 40*1+3, 60*1, 59*1)
addRect(c, 45*1+4, 80*1+3, 10*1, 19*1)
#roof
addLine(c,0+4,40*1+3,50*1+4,0+3)
addLine(c,50*1+4,0+3,100*1+4,40*1+3)
addLine(c,0+4,40*1+3,100*1+4,40*1+3)
#windows
addRect(c, 25*1+4, 60*1+3, 9*1, 19*1)
addLine(c,25*1+4,70*1+3,34*1+4,70*1+3)
addLine(c,30*1+4,60*1+3,30*1+4,79*1+3)
addRect(c, 65*1+4,60*1+3, 9*1, 19*1)
addLine(c,65*1+4,70*1+3,74*1+4,70*1+3)
addLine(c,70*1+4,60*1+3,70*1+4,79*1+3)
show(c)
You would need to alter all the co-ordinates to create a house in a different place or possible you can shift the origin point.
How do I go about shifting the origin point? Thanks so much. I'm a super novice. We went from ''Hello World'' to this assignment in a week. A seemingly huge step forward in my eyes.
Don't know, your code does not show what package is being used to draw.
I'm using JES for all the assignments, python download for students.
Don't know what JES is or what can be done with it.
All i can suggest is to store the x, y coordinates in variables that can be shifted to create each house in a new place.