예제 #1
0
from decodes.core import *
from decodes.core import dc_color, dc_base, dc_vec, dc_point, dc_cs, dc_line, dc_mesh, dc_pgon, dc_xform
import thesis
from thesis.ants.ants import Graph, History

from decodes.extensions.cellular_automata import CA
import random
import datetime

t = History()

t.add_gen()
t.add_gen()

r = Graph()
r.init_rectgrid(Interval(3, 3), include_corners=False, wrap=False, cellsize=1)
#r.init_rvals()
# r.to_file()
r.from_file()

prop_values = (0, 1, 2)
prop_colors = (Color(1, 1, 1), Color(1, 1, .5), Color(0))
state_list = ('undeveloped', 'access', 'built')
no_states = len(state_list)
color_dict = dict(zip(prop_values, prop_colors))
state_dict = dict(zip(prop_values, state_list))

sc = 1
#p = [1]
m = 10
n = 10
예제 #2
0
                     block_size=block_size,
                     no_vals=param[10],
                     increment=param[11])
    r.to_csv(f_name, path)
else:
    #    r.init_ppm(init_fname,base_path+'\\maps\\',color_dict)
    r.from_csv(init_fname, base_path)

p = r.parcel_list()

footprint = r.parcel_fp(p[0], len(state_dict))
floor_area = r.parcel_flr(p[0], len(state_dict))
if out_fname != "":
    r.to_csv(out_fname, base_path)

t = History(r)
t.set_dict(color_dict, state_dict)

t.set_rule(base_path + '\\rules\\' + rule_fname)
t.set_vis(base_path + '\\rules\\' + vis_fname)
t.set_params(param)

t.generate(no_gen)

if param[28] == 1: t.write_svgs(f_name, path, display_size)
t.hist[-1].neighbors(13, len(state_dict))
t.hist[-1].to_csv(f_name, path)
t.write_parcels(f_name, path)
t.write_parcels(f_name, path, len(t.hist) - 1)