Python Forum
Making a dozen houses
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a dozen houses
#1
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)
Reply
#2
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.
Reply
#3
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.
Reply
#4
Don't know, your code does not show what package is being used to draw.
Reply
#5
I'm using JES for all the assignments, python download for students.
Reply
#6
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.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020