Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ahmad Reza Cheraghi
swarm-sim
Commits
f5db65db
Commit
f5db65db
authored
Dec 17, 2019
by
Ahmad Reza
Browse files
added the configuration possibility of a new random order of the particles after each round.
parent
c386c04c
Changes
4
Show whitespace changes
Inline
Side-by-side
config.ini
View file @
f5db65db
...
@@ -6,10 +6,12 @@ seedvalue = 12
...
@@ -6,10 +6,12 @@ seedvalue = 12
## Maximum round number in swarm-world, 0 = infinite
## Maximum round number in swarm-world, 0 = infinite
max_round
=
0
max_round
=
0
## 1 = Call of particles in randmom order
## 1
/True
= Call of particles in randmom order
## 0 = Call of particles in added order in scenario
## 0
/False
= Call of particles in added order in scenario
particle_random_order
=
True
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
## Viewing window size in pixels
window_size_x
=
1920
window_size_x
=
1920
window_size_y
=
1080
window_size_y
=
1080
...
@@ -71,7 +73,7 @@ cursor_color = (0.5, 0.5, 0.5, 0.5)
...
@@ -71,7 +73,7 @@ cursor_color = (0.5, 0.5, 0.5, 0.5)
center_color
=
(1.0, 0.0, 0.0, 0.5)
center_color
=
(1.0, 0.0, 0.0, 0.5)
# background (rgb)
# background (rgb)
background_color
=
(
0.8, 0.8, 0.8
)
background_color
=
(
1.0, 1.0, 1.0
)
# color of grid lines (rgba)
# color of grid lines (rgba)
line_color
=
(0.0, 0.0, 0.0, 1.0)
line_color
=
(0.0, 0.0, 0.0, 1.0)
# length/scaling of the grid lines (max should be 1,1,1)
# length/scaling of the grid lines (max should be 1,1,1)
...
@@ -125,6 +127,27 @@ particle_mm_size = 2
...
@@ -125,6 +127,27 @@ particle_mm_size = 2
tile_mm_size
=
2
tile_mm_size
=
2
[File]
[File]
scenario
=
test_interfaces
##Examples##
solution
=
test_all_the_interfaces
##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
lib/config.py
View file @
f5db65db
...
@@ -12,6 +12,7 @@ class ConfigData:
...
@@ -12,6 +12,7 @@ class ConfigData:
self
.
seed_value
=
config
.
getint
(
"Simulator"
,
"seedvalue"
)
self
.
seed_value
=
config
.
getint
(
"Simulator"
,
"seedvalue"
)
self
.
max_round
=
config
.
getint
(
"Simulator"
,
"max_round"
)
self
.
max_round
=
config
.
getint
(
"Simulator"
,
"max_round"
)
self
.
particle_random_order
=
config
.
getboolean
(
"Simulator"
,
"particle_random_order"
)
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_x
=
config
.
getint
(
"Simulator"
,
"window_size_x"
)
self
.
window_size_y
=
config
.
getint
(
"Simulator"
,
"window_size_y"
)
self
.
window_size_y
=
config
.
getint
(
"Simulator"
,
"window_size_y"
)
...
...
scenario/n_particle_in_line.py
View file @
f5db65db
...
@@ -3,6 +3,6 @@ import random
...
@@ -3,6 +3,6 @@ import random
def
scenario
(
world
):
def
scenario
(
world
):
amount
=
10
amount
=
5
direction
=
random
.
choice
(
world
.
grid
.
get_directions_list
())
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
'
)
swarm-sim.py
View file @
f5db65db
...
@@ -92,6 +92,8 @@ def create_direction_for_data(config_data):
...
@@ -92,6 +92,8 @@ def create_direction_for_data(config_data):
def
run_solution
(
swarm_sim_world
):
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
=
importlib
.
import_module
(
'solution.'
+
swarm_sim_world
.
config_data
.
solution
)
mod
.
solution
(
swarm_sim_world
)
mod
.
solution
(
swarm_sim_world
)
swarm_sim_world
.
csv_round
.
next_line
(
swarm_sim_world
.
get_actual_round
())
swarm_sim_world
.
csv_round
.
next_line
(
swarm_sim_world
.
get_actual_round
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment