Last active
October 22, 2020 20:21
-
-
Save 7ranceaddic7/c852fe81b4186679a60780c18fef23e2 to your computer and use it in GitHub Desktop.
Character Rendering Problems
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
# coding=UTF-8 | |
class Art: | |
def __init__(self, artist, title, year, medium, owner): | |
self.artist = artist | |
self.title = title | |
self.medium = medium | |
self.year = year | |
self.owner = owner | |
def __repr__(self): | |
return "{artist}. {title}. {year}, {medium}. {owner}, {location}.\n".format(artist=self.artist, title=self.title, year=self.year, medium=self.medium, owner=self.owner.ownername, location=self.owner.location) | |
class MarketPlace: | |
def __init__(self): | |
self.listings = [] | |
def add_listing(self, new_listing): | |
self.listings.append(new_listing) | |
def remove_listing(self, old_listing): | |
self.listings.remove(old_listing) | |
def show_listings(self): | |
for listing in self.listings: | |
print(listing, end="\r\n") | |
class Client: | |
def __init__(self, ownername, location="Private Collection", is_museum=False): | |
self.ownername = ownername | |
self.location = location | |
self.is_museum = is_museum | |
def list_artwork(self, artwork, price): | |
if artwork.owner.ownername == self.ownername: | |
new_listing = Listing(artwork, price) | |
veneer.add_listing(new_listing) | |
else: | |
print("Waring: That's not your's to sell.") | |
def buy_artwork(self, artwork): | |
if artwork.owner.ownername != self: | |
art_listing = [] | |
for listing in veneer.listings: | |
if listing.artwork.title == artwork.title: | |
art_listing = listing | |
break | |
if art_listing != None and art_listing.artwork.owner == self: | |
veneer.remove_listing(art_listing) | |
class Listing: | |
def __init__(self, artwork, price): | |
self.artwork = artwork | |
self.price = price | |
def __repr__(self): | |
return "Title: {title}. {price}".format(title=self.artwork.title, price=self.price) | |
veneer = MarketPlace() | |
edytta = Client("Edytta Halpirt") | |
girl_with_mandolin = Art("Picasso, Pablo", | |
"Girl with a Mandolin (Fanny Tellier)", | |
1910, | |
"Oil on Canvas", | |
edytta) | |
print(girl_with_mandolin) | |
moma_ny = Client("New York MOMA", "New York", True) | |
vetheuil_in_fog = Art("Monet, Claude", | |
"Vétheuil in the Fog", | |
1879, | |
"Oil on Canvas", | |
moma_ny) | |
print(vetheuil_in_fog) | |
moma_ny.list_artwork(vetheuil_in_fog, None) | |
edytta.list_artwork(girl_with_mandolin, "$6M (USD)") | |
# edytta.list_artwork(vetheuil_in_fog, None) | |
veneer.show_listings() | |
moma_ny.buy_artwork(girl_with_mandolin) | |
veneer.show_listings() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment