def dredgeRiverSingle(nature,direction,CX,CY):
	rivert=[]

	# This is the start coordinate of the river, perpendicular to the
	# axis of the river.  N/S rivers choose positions on the E/W axis, 
	# and vice-versa
	axis_size = CX if direction else CY
	line_pos=random.randint(0, axis_size)

	#river width, no more than half the map
	river_size=min(random.randint(3,120), axis_size//2) 

	for i in range(0,axis_size):
		if direction:
			element=Rect(Point(i,line_pos),Point(i,line_pos+river_size))
		else:
			element=Rect(Point(line_pos,i),Point(line_pos+river_size,i))

		element.set_name('RIVER')
		rivert.append(element)

	prev=0;
	for f in rivert:
		prev=prev+random.randint(-1,1)
		f.move(direction+2,prev) # in rect, 1=up, 2=right
	nature.extend(rivert)
Beispiel #2
0
def dredgeRiverSingle(nature, direction, CX, CY):
    rivert = []

    # This is the start coordinate of the river, perpendicular to the
    # axis of the river.  N/S rivers choose positions on the E/W axis,
    # and vice-versa
    axis_size = CX if direction else CY
    line_pos = random.randint(0, axis_size)

    #river width, no more than half the map
    river_size = min(random.randint(3, 120), axis_size // 2)

    for i in range(0, axis_size):
        if direction:
            element = Rect(Point(i, line_pos), Point(i, line_pos + river_size))
        else:
            element = Rect(Point(line_pos, i), Point(line_pos + river_size, i))

        element.set_name('RIVER')
        rivert.append(element)

    prev = 0
    for f in rivert:
        prev = prev + random.randint(-1, 1)
        f.move(direction + 2, prev)  # in rect, 1=up, 2=right
    nature.extend(rivert)
def digCave(nature):
	caves = RESOURCES.count('CAVE')
	print('Digging %d cave%s' % ( caves, 's' if caves > 1 else ''))
	for p in range(0,RESOURCES.count('CAVE')):
		CX  = config['CITY_SIZE_X']
		CY  = config['CITY_SIZE_Y']
		CX2 = config['CITY_SIZE_X']//2
		CY2 = config['CITY_SIZE_Y']//2
		CX3 = config['CITY_SIZE_X']//3
		CY3 = config['CITY_SIZE_Y']//3
		p=Point(CX2,CY2)
		MPS=200
		mps=30
		if(random.randint(0,1)==0):
			p1=Point(random.randint(0,CX3),random.randint(0,CY))
		else:
			p1=Point(random.randint(0,CX),random.randint(0,CY3))

		p2=Point(random.randint(p1.x+mps,p1.x+MPS), random.randint(p1.y+mps,p1.y+MPS))
		place=Rect(p1,p2)
		place.set_name('CAVE')
		nature.append(place)
Beispiel #4
0
def digCave(nature):
    caves = RESOURCES.count('CAVE')
    print('Digging %d cave%s' % (caves, 's' if caves > 1 else ''))
    for p in range(0, RESOURCES.count('CAVE')):
        CX = config['CITY_SIZE_X']
        CY = config['CITY_SIZE_Y']
        CX2 = config['CITY_SIZE_X'] // 2
        CY2 = config['CITY_SIZE_Y'] // 2
        CX3 = config['CITY_SIZE_X'] // 3
        CY3 = config['CITY_SIZE_Y'] // 3
        p = Point(CX2, CY2)
        MPS = 200
        mps = 30
        if (random.randint(0, 1) == 0):
            p1 = Point(random.randint(0, CX3), random.randint(0, CY))
        else:
            p1 = Point(random.randint(0, CX), random.randint(0, CY3))

        p2 = Point(random.randint(p1.x + mps, p1.x + MPS),
                   random.randint(p1.y + mps, p1.y + MPS))
        place = Rect(p1, p2)
        place.set_name('CAVE')
        nature.append(place)
Beispiel #5
0
        print('*'),
        for place in nature:        
            for place2 in nature:
                if(not (id(place)==id(place2))):
                    if(place.overlaps(place2)):
                        place.move(random.randint(0,4),random.randint(20,30))   
print('[10/10]')
print('Building river')

for p in range(0,RESOURCES.count('RIVERX')):
    rivert=[]
    liney=random.randint(0,CITY_SIZE_Y)
    river_size=random.randint(3,120)
    for i in range(0,CITY_SIZE_X):
        element=Rect(Point(i,liney),Point(i,liney+river_size))
        element.set_name('RIVER')
        rivert.append(element)
    
    prev=0;
    for f in rivert:
        prev=prev+random.randint(-1,1)
        f.move(1,prev)
    nature.extend(rivert)

for p in range(0,RESOURCES.count('RIVERY')):
    rivert=[]
    linex=random.randint(0,CITY_SIZE_X)
    river_size=random.randint(3,120)
    for i in range(0,CITY_SIZE_Y):
        element=Rect(Point(linex,i),Point(linex+river_size,i))
        element.set_name('RIVER')
Beispiel #6
0
        for place in nature:
            for place2 in nature:
                if (not (id(place) == id(place2))):
                    if (place.overlaps(place2)):
                        place.move(random.randint(0, 4),
                                   random.randint(20, 30))
print('[10/10]')
print('Building river')

for p in range(0, RESOURCES.count('RIVERX')):
    rivert = []
    liney = random.randint(0, CITY_SIZE_Y)
    river_size = random.randint(3, 120)
    for i in range(0, CITY_SIZE_X):
        element = Rect(Point(i, liney), Point(i, liney + river_size))
        element.set_name('RIVER')
        rivert.append(element)

    prev = 0
    for f in rivert:
        prev = prev + random.randint(-1, 1)
        f.move(1, prev)
    nature.extend(rivert)

for p in range(0, RESOURCES.count('RIVERY')):
    rivert = []
    linex = random.randint(0, CITY_SIZE_X)
    river_size = random.randint(3, 120)
    for i in range(0, CITY_SIZE_Y):
        element = Rect(Point(linex, i), Point(linex + river_size, i))
        element.set_name('RIVER')