Commit f5db65db authored by Ahmad Reza's avatar Ahmad Reza
Browse files

added the configuration possibility of a new random order of the particles after each round.

parent c386c04c
......@@ -6,10 +6,12 @@ seedvalue = 12
## Maximum round number in swarm-world, 0 = infinite
max_round = 0
## 1 = Call of particles in randmom order
## 0 = Call of particles in added order in scenario
## 1/True = Call of particles in randmom order
## 0/False = Call of particles in added order in scenario
particle_random_order = True
## 1/True = Call of particles in randmom order after each round
## 0/False = Call of particles in randmom order only once at the start of the simulator
particle_random_order_always = False
## Viewing window size in pixels
window_size_x = 1920
window_size_y = 1080
......@@ -71,7 +73,7 @@ cursor_color = (0.5, 0.5, 0.5, 0.5)
center_color = (1.0, 0.0, 0.0, 0.5)
# background (rgb)
background_color = (0.8, 0.8, 0.8)
background_color = (1.0, 1.0, 1.0)
# color of grid lines (rgba)
line_color = (0.0, 0.0, 0.0, 1.0)
# length/scaling of the grid lines (max should be 1,1,1)
......@@ -125,6 +127,27 @@ particle_mm_size = 2
tile_mm_size = 2
[File]
scenario = test_interfaces
solution = test_all_the_interfaces
##Examples##
##Moving
#scenario = lonely_particle
scenario = n_particle_in_line
solution = random_walk
#solution = triangular_round_walk
#solution = random_walk_with_take_and_drop
## Creating and Deleting
#scenario = lonely_particle
#solution = create_delete
## Take and Drop
#scenario=two_particles_tiles_locations
#solution= take_drop_aims
## Read and Write
#scenario = two_particles_tiles_markers
#solution = read_write
#scenario = test_interfaces
#solution = test_all_the_interfaces
......@@ -12,6 +12,7 @@ class ConfigData:
self.seed_value = config.getint("Simulator", "seedvalue")
self.max_round = config.getint("Simulator", "max_round")
self.particle_random_order = config.getboolean("Simulator", "particle_random_order")
self.particle_random_order_always = config.getboolean("Simulator", "particle_random_order_always")
self.window_size_x = config.getint("Simulator", "window_size_x")
self.window_size_y = config.getint("Simulator", "window_size_y")
......
......@@ -3,6 +3,6 @@ import random
def scenario(world):
amount = 10
amount = 5
direction = random.choice(world.grid.get_directions_list())
create_matter_in_line(world, world.grid.get_center(), direction, amount, 'location')
create_matter_in_line(world, world.grid.get_center(), direction, amount, 'particle')
......@@ -92,6 +92,8 @@ def create_direction_for_data(config_data):
def run_solution(swarm_sim_world):
if swarm_sim_world.config_data.particle_random_order_always:
random.shuffle(swarm_sim_world.particles)
mod = importlib.import_module('solution.' + swarm_sim_world.config_data.solution)
mod.solution(swarm_sim_world)
swarm_sim_world.csv_round.next_line(swarm_sim_world.get_actual_round())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment