예제 #1
0
    inner_folder = 'sim_{}x{}'.format(height, width)

### Setting up Simulation
Particle.affinity = 0.5
Particle.aversion = 0.5
Particle.interaction_chance = 0.1
Particle.cramming_chance = 1
Partition.threshold = 2

shape = (height, width)
box = Box(shape)

particles_per_box = 4
particles_0 = int(particles_per_box * shape[0] * shape[1] / 2)
particles_1 = int(particles_per_box * shape[0] * shape[1] / 2)
box.add_new_particles(particles_0, particles_1)

### Initialize data dir
if not os.path.exists(outer_folder):
    os.makedirs(outer_folder)

partial_path = os.path.join(outer_folder, inner_folder)
if not os.path.exists(partial_path):
    os.makedirs(partial_path)

# Add the simulation properties to 'properties.txt'
properties_path = os.path.join(partial_path, 'properties.txt')
properties = open(properties_path, "w")
properties.write('Particle.affinity = {}\n'.format(Particle.affinity))
properties.write('Particle.aversion = {}\n'.format(Particle.aversion))
properties.write('Particle.interaction_chance = {}\n'.format(