Beispiel #1
0
    def ParseGirl(self, id, url, name, age):
        soup = self.GetSoup(url)
        profileData = soup.select("div.girlGalleryProfile-data")
        span = profileData[0].findAll("span")

        country = self.FindTextInTags(span, "Country:")
        city = self.FindTextInTags(span, "City:")
        marital_status = self.FindTextInTags(span, "Marital status:")
        children = self.FindTextInTags(span, "Children:")
        height = self.FindTextInTags(span, "Height:")
        weight = self.FindTextInTags(span, "Weight:")
        eyeColor = self.FindTextInTags(span, "Eye color:")
        hairColor = self.FindTextInTags(span, "Hair color:")
        bodyType = self.FindTextInTags(span, "Body type")
        religion = self.FindTextInTags(span, "Religion:")
        education = self.FindTextInTags(span, "Education:")
        smoke = self.FindTextInTags(span, "Smoke:")
        drink = self.FindTextInTags(span, "Drink:")
        englishLevel = self.FindTextInTags(span, "English level:")
        occupation = self.FindTextInTags(span, "Occupation:")

        rightCol = soup.select("div.right-col")
        titles = rightCol[0].select("div.title")
        aboutMyself = self.FindTextInTags(titles, "About myself")
        aboutMyPartner = self.FindTextInTags(titles, "About my partner")
        hobbies = self.FindTextInTags(titles, "Hobbies")
        ageCriteria = self.FindTextInTags(titles, "Age criteria")
        datingGoal = self.FindTextInTags(titles, "Dating goal")

        photoBlockSoup = soup.find(True,
                                   {'class': ['block-receptacle', 'photo']})
        photoMainURL = 'https://bridesbay.com' + photoBlockSoup.select(
            'a.photo-main')[0].get('href')

        photoList = photoBlockSoup.findAll(rel="girlGalleryProfile-photo")
        photoPholder = []
        for photo in photoList:
            photoPholder.append('https://bridesbay.com' +
                                photo.find('img').get('src'))

        girl = Girl(id, url, name, age, country, city, marital_status,
                    children, height, weight, eyeColor, hairColor, bodyType,
                    religion, education, smoke, drink, englishLevel,
                    occupation, aboutMyself, aboutMyPartner, hobbies,
                    ageCriteria, datingGoal, photoMainURL, photoPholder)
        girl.SaveToFolder(self.BridesbayFolder, self.max_workersPhoto)
        self.AddGirl(id, girl)

        print('Girl ' + girl.name + ' parsed')
def test():
    with open("./boys.csv", "r") as csvfile:
        fp1 = csv.reader(csvfile, delimiter=",")
        boy_lists = []
        for i in fp1:
            boy_lists += [
                Boy(i[0], int(i[1]), int(i[2]), int(i[3]), int(i[4]), i[5])
            ]
        csvfile.close()

    with open("./girls.csv", "r") as csvfile:
        fp2 = csv.reader(csvfile, delimiter=",")
        girl_lists = []
        for j in fp2:
            girl_lists += [Girl(j[0], int(j[1]), int(j[2]), int(j[3]), j[4])]
        csvfile.close()

    Couple_list = []

    logging.warning("\n\nGirls are looking for Boys.\n")
    for g in girl_lists:
        for b in boy_lists:
            log_maker(g.name + " is looking for " + b.name)
            if b.status == "Single" and g.status == "Single" and (
                    g.is_elligible(b)) and (b.is_elligible(g)):
                g.status = "Committed"
                b.status = "Committed"
                g.boyfriend = b
                b.girlfriend = g
                log_maker(g.name + " is in relationship with " + b.name)
                Couple_list = Couple_list + [(b, g)]
                break

    print(color.BLUE + "\n\nCouples in Relationship are :\n" + color.END)

    for g in girl_lists:
        if g.status != "Single":
            print(color.GREEN + g.name + " is in relationship with " +
                  g.boyfriend.name + "\n" + color.END)
        else:
            print(color.RED + g.name +
                  " is still single. Not commited with any boy.\n" + color.END)

    H = []
    for i in Couple_list:
        H += [Couple(i[0], i[1])]
    calc_happiness(H)
Beispiel #3
0
	def __init__(self):
		Scene.__init__(self)
		self.screne = pygame.display.set_mode((450, 480))
		self.background.fill( (210,210,210) )
		
		background = Grass()
		self.girl = Girl()
		self.girl.setImage("girl.png")
		self.girl.x = 20
		self.girl.y = 25
		
		self.buford = Buford()
		self.buford.setImage("buford.gif")
		self.buford.x = self.girl.x + self.girl.width + 20
		self.buford.y = self.girl.y + self.girl.height + 28
		
		self.girl.setFollowingSprite(self.buford)
		
		self.sprites = [background, self.girl, self.buford]                               
		neebCount = 4
		self.neebSprites = []
		
		change= 50
		for x in range(neebCount):
			print("Making a neeb", change)
			self.neebSprites.append( ChasingNeeb() )
			self.neebSprites[x].setImage("neeb_still.gif")
			self.neebSprites[x].x = 0 + change
			self.neebSprites[x].y = 0
			self.sprites.append(self.neebSprites[x])
			change += 10
			
		self.neebGroup = Scene.makeSpriteGroup( self, self.neebSprites )
		
		#print( gameShared.distance(self.girl.x, self.girl.y, self.neebSprites[0].x, self.neebSprites[0].y) )
	
		self.girlScareDistance = 190
		self.neebScareDistance = 100
Beispiel #4
0
	def __animateUp(self):
		#print("ANIMATING UP")
		print("CurrentIndex: ", self.currentFrameIndex, " TotalFrames:  ", len( self.frames ) )
		if (self.currentFrameIndex < len( self.frames ) - 1 ):
			self.currentFrameIndex += 1
			print("New Index", self.currentFrameIndex)
	
	def __animateDown(self):
		#print("ANIMATING DOwn")
		if (self.currentFrameIndex > 0 ):
			self.currentFrameIndex -=1
			
	def __updateAnimationState(self):
		#print("UPDATE ANIMATION STATE")
		if( self.currentFrameIndex == 0 ):
			self.status = self.INACTIVE
		elif( self.currentFrameIndex >= len( self.frames )-1 ):
			self.status = self.GOING_DOWN

if __name__ == "__main__":
	import scene 
	from scene import Scene
	from Girl import Girl
	game = Scene()
	buford = Buford()
	buford.setImage("buford.gif")
	girl = Girl()
	girl.setImage("girl.png");
	game.sprites = [buford, girl]
	game.start()
    END = "\033[0m"


utility()
boys = open('./boys.csv')
girls = open('./girls.csv')
getboy = csv.reader(boys, delimiter=',')
getgirl = csv.reader(girls, delimiter=',')
boy_list = []
girl_list = []

for i in getboy:
    boy_list += [Boy(i[0], int(i[1]), int(i[2]), int(i[3]), int(i[4]), i[5])]

for j in getgirl:
    girl_list += [Girl(j[0], int(j[1]), int(j[2]), int(j[3]), j[4])]

for g in girl_list:
    for b in boy_list:
        log_maker(g.name + '  is looking for  ' + b.name)
        if b.is_elligible(g) and g.is_elligible(
                b) and g.status == 'Single' and b.status == 'Single':
            g.status = 'Commited'
            b.status = 'Commited'
            g.set_boyfriend(b)
            b.set_girlfriend(g)
            print(color.BLUE + g.name + color.END + color.YELLOW +
                  '  is in relationship with ' + color.END + color.BLUE +
                  b.name + color.END)
            log_maker(g.name + '  is in relationship with ' + b.name)
            break
Beispiel #6
0
class BufordSave(Scene):
	def __init__(self):
		Scene.__init__(self)
		self.screne = pygame.display.set_mode((450, 480))
		self.background.fill( (210,210,210) )
		
		background = Grass()
		self.girl = Girl()
		self.girl.setImage("girl.png")
		self.girl.x = 20
		self.girl.y = 25
		
		self.buford = Buford()
		self.buford.setImage("buford.gif")
		self.buford.x = self.girl.x + self.girl.width + 20
		self.buford.y = self.girl.y + self.girl.height + 28
		
		self.girl.setFollowingSprite(self.buford)
		
		self.sprites = [background, self.girl, self.buford]                               
		neebCount = 4
		self.neebSprites = []
		
		change= 50
		for x in range(neebCount):
			print("Making a neeb", change)
			self.neebSprites.append( ChasingNeeb() )
			self.neebSprites[x].setImage("neeb_still.gif")
			self.neebSprites[x].x = 0 + change
			self.neebSprites[x].y = 0
			self.sprites.append(self.neebSprites[x])
			change += 10
			
		self.neebGroup = Scene.makeSpriteGroup( self, self.neebSprites )
		
		#print( gameShared.distance(self.girl.x, self.girl.y, self.neebSprites[0].x, self.neebSprites[0].y) )
	
		self.girlScareDistance = 190
		self.neebScareDistance = 100
	
	def update(self):
		#print("UPDATING")
		isScared = False
		
		for neebSprite in self.neebSprites:
			# Handles the neeb walking towards the girl
			neebSprite.walkTimer+= 1
			if neebSprite.walkTimer >= neebSprite.walkSpeed_:
				neebSprite.walkTowardsGirl(self.girl)
				neebSprite.walkTimer = 0
			
			# Upadtes the girl if the neebs get too close
			if( self.isNeebNearGirl(neebSprite) ):
				isScared = True
			
			# Handles the case when buford gets close to a neeb
			isBufordClose = self.isNeebCloseToBufford(neebSprite)
			neebSprite.setIsBufordClose(isBufordClose)
			if isBufordClose:
				print("HE IS CLOSE!!!!")
				self.buford.status = self.buford.CHASING
				neebSprite.runAwayFromBuford(self.buford)
		
		#Update the girl if she is scared
		self.girl.setScared(isScared)
		
	def isNeebNearGirl(self, neeb):
		distance = shared.distance(self.girl.x, self.girl.y, neeb.x, neeb.y)
		#print("Current Distance: ", distance)
		return ( distance < self.girlScareDistance )
		
	def isNeebCloseToBufford(self, neeb):
		distance = shared.distance(self.buford.x, self.buford.y, neeb.x, neeb.y)
		return ( distance < self.neebScareDistance )