Created
April 1, 2018 17:39
-
-
Save dilanshah/4d0adba69db10f1d7239f2619123199c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# users can layout rect, text, and images | |
# explore data structures | |
# want to be able to given a completed mock up which is a collection of | |
# rectangles, text, and images | |
# Document class – How would you render a whole Document to JSON? | |
# Document has an array of [rectangles, text, images] | |
# Rectangle , Text , Images all have —> .renderToJSON() function | |
def Rectangle(): | |
xval | |
yval | |
width | |
height | |
pass | |
def Text(): | |
pass | |
def Img(): | |
pass | |
import json | |
def main(): | |
n = map(int, input()) # I'm given the number of files the user | |
for i in xrange(n): | |
print( Rectangle.renderToJSON() ) | |
# each x, y, width, and height | |
______ | |
| _|_____ | |
|___|_| | | |
|_______| | |
https://awwapp.com/b/uuctpgrsp/ | |
______ | |
_____|_ | | |
| |_|___| | |
|_______| | |
# 0, 0 | |
# y increases downward | |
# x increase | |
def func(rect1, rect2): | |
# type(rect1) = rectangle | |
# type(rect2) = rectangle | |
# rtype is bool | |
# print(rect1) would look like [[0,1],2, 1] | |
rect1 = [0,2], 3, 4 | |
rect2 = [2,5], 3, 4 | |
return if rect2.xval is <= (rect1.xval+rect1.length) and rect2.yval <= (rect1.yval+rect1.height): True else: False | |
# Talk more, work on generating test cases, | |
# turn an integer number | |
# "I'm thinking I'd do it this way but I'm not sure that it will be optimal" | |
# Let's say you're working on the test case where one square has eaten up the other square you can put that part of the soln' on the shelf and come back to it | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment