(self, size, range, symmetric=False)
return numpy.array(ret)
Creates a procedural terrain map

           Starts with corner points [[a, b], [c, d]] and converts it into [[a, e, b], [f, g, h], [c, i, d]]
           where:
           e = (a+b)/2 + (random change)
           f = (a+c)/2 + (random change)
           g = (a+b+c+d)/4 + (random change)
           h = (b+d)/2 + (random change)
           i = (c+d)/2 + (random change)

           Repeat untill size is greater than required and truncate
Creates a procedural terrain map
Creates a procedural terrain map
def create_simple(self, size, range, symmetric=False):
        """Creates a procedural terrain map

           Starts with corner points [[a, b], [c, d]] and converts it into [[a, e, b], [f, g, h], [c, i, d]]
           where:
           e = (a+b)/2 + (random change)
           f = (a+c)/2 + (random change)
           g = (a+b+c+d)/4 + (random change)
           h = (b+d)/2 + (random change)
           i = (c+d)/2 + (random change)

           Repeat untill size is greater than required and truncate"""
        add_random_range = self.add_random_range

        ret = [[add_random_range(0, 0, range), add_random_range(0, 0, range)], [add_random_range(0, 0, range), add_random_range(0, 0, range)]]

        while len(ret) <= size[0]:
            new_ret = []

            for key_x, x in enumerate(ret):
                new_ret.append(x)

                if key_x != len(ret) - 1:
                    next_row = []
                    for key_y, pos_south in enumerate(x):
                        pos_north = ret[key_x+1][key_y]
                        pos_avg = (pos_north + pos_south)/2
                        if pos_avg <= 0:
                            next_row.append(add_random_range(pos_avg, 0, 1))
                        elif pos_avg >= range:
                            next_row.append(add_random_range(pos_avg, -1, 0))
                        else:
                            next_row.append(add_random_range(pos_avg, -1, 1))
                    new_ret.append(next_row)
            ret = new_ret

            new_ret = []
            for key_x, x in enumerate(ret):
                next_row = [x[0]]
                for key_y, pos_east in enumerate(x[1:]):
                    pos_west = next_row[-1]
                    if key_x % 2 and not key_y % 2:
                        pos_north = ret[key_x-1][key_y+1]
                        pos_south = ret[key_x+1][key_y+1]
                        pos_avg = (pos_north + pos_south + pos_east + pos_west)/4
                        if pos_avg <= 0:
                            next_row.append(add_random_range(pos_avg, 0, 1))
                        elif pos_avg >= range:
                            next_row.append(add_random_range(pos_avg, -1, 0))
                        else:
                            next_row.append(add_random_range(pos_avg, -1, 1))
                    else:
                        pos_avg = (pos_east + pos_west)/2
                        if pos_avg <= 0:
                            next_row.append(add_random_range(pos_avg, 0, 1))
                        elif pos_avg >= range:
                            next_row.append(add_random_range(pos_avg, -1, 0))
                        else:
                            next_row.append(add_random_range(pos_avg, -1, 1))
                    next_row.append(pos_east)
                new_ret.append(next_row)
            ret = new_ret

        ret = [x[:size[0]] for x in ret][:size[0]]

        if symmetric:
            ret = self.make_symmetric(ret)
        return numpy.array(ret)
def create_simple ( self , size , range , symmetric = False ) : add_random_range = self . add_random_range ret = [ [ add_random_range ( 0 , 0 , range ) , add_random_range ( 0 , 0 , range ) ] , [ add_random_range ( 0 , 0 , range ) , add_random_range ( 0 , 0 , range ) ] ] while len ( ret ) <= size [ 0 ] : new_ret = [ ] for key_x , x in enumerate ( ret ) : new_ret . append ( x ) if key_x != len ( ret ) - 1 : next_row = [ ] for key_y , pos_south in enumerate ( x ) : pos_north = ret [ key_x + 1 ] [ key_y ] pos_avg = ( pos_north + pos_south ) / 2 if pos_avg <= 0 : next_row . append ( add_random_range ( pos_avg , 0 , 1 ) ) elif pos_avg >= range : next_row . append ( add_random_range ( pos_avg , - 1 , 0 ) ) else : next_row . append ( add_random_range ( pos_avg , - 1 , 1 ) ) new_ret . append ( next_row ) ret = new_ret new_ret = [ ] for key_x , x in enumerate ( ret ) : next_row = [ x [ 0 ] ] for key_y , pos_east in enumerate ( x [ 1 : ] ) : pos_west = next_row [ - 1 ] if key_x % 2 and not key_y % 2 : pos_north = ret [ key_x - 1 ] [ key_y + 1 ] pos_south = ret [ key_x + 1 ] [ key_y + 1 ] pos_avg = ( pos_north + pos_south + pos_east + pos_west ) / 4 if pos_avg <= 0 : next_row . append ( add_random_range ( pos_avg , 0 , 1 ) ) elif pos_avg >= range : next_row . append ( add_random_range ( pos_avg , - 1 , 0 ) ) else : next_row . append ( add_random_range ( pos_avg , - 1 , 1 ) ) else : pos_avg = ( pos_east + pos_west ) / 2 if pos_avg <= 0 : next_row . append ( add_random_range ( pos_avg , 0 , 1 ) ) elif pos_avg >= range : next_row . append ( add_random_range ( pos_avg , - 1 , 0 ) ) else : next_row . append ( add_random_range ( pos_avg , - 1 , 1 ) ) next_row . append ( pos_east ) new_ret . append ( next_row ) ret = new_ret ret = [ x [ : size [ 0 ] ] for x in ret ] [ : size [ 0 ] ] if symmetric : ret = self . make_symmetric ( ret ) return numpy . array ( ret )