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
011efaeb
Commit
011efaeb
authored
Apr 24, 2019
by
Ahmad Reza
Browse files
deleted some bugs based on the previous commit
parent
8b0d639a
Changes
4
Hide whitespace changes
Inline
Side-by-side
config.ini
View file @
011efaeb
...
...
@@ -43,28 +43,28 @@ tile_mm_size = 2
##Examples##
##Moving
scenario
=
lonely_particle
solution
=
random_walk
#solution = round_walk
.py
#
scenario = lonely_particle
#
solution = random_walk
#solution = round_walk
## Creating and Deleting
#
scenario = lonely_particle
.py
#
solution = create_delete
.py
scenario
=
lonely_particle
solution
=
create_delete
## Take and Drop
#scenario = between_particle_one_tile_particle
.py
#solution= take_drop_aims
.py
#scenario = between_particle_one_tile_particle
#solution= take_drop_aims
## Read and Write
#scenario = two_particles_tiles_locations
.py
#solution = read_write
.py
#scenario = two_particles_tiles_locations
#solution = read_write
## Scanning for matters
#scenario = particles_tiles_locations_ring
.py
#solution= scanning_for_all_aims
.py
#scenario = particles_tiles_locations_ring
#solution= scanning_for_all_aims
## All interfaces
#scenario = test_interfaces
.py
#solution = test_all_the_interfaces
.py
#scenario = test_interfaces
#solution = test_all_the_interfaces
lib/particle.py
View file @
011efaeb
...
...
@@ -31,7 +31,7 @@ read = 0
write
=
1
particle_counter
=
0
class
Particle
(
matter
.
m
atter
):
class
Particle
(
matter
.
M
atter
):
"""In the classe location all the methods for the characterstic of a location is included"""
def
__init__
(
self
,
sim
,
x
,
y
,
color
=
black
,
alpha
=
1
,
mm_limit
=
0
,
mm_size
=
0
):
...
...
lib/sim.py
View file @
011efaeb
...
...
@@ -348,7 +348,7 @@ class Sim:
def
sim_to_coords
(
self
,
x
,
y
):
return
x
,
round
(
y
/
math
.
sqrt
(
3
/
4
),
0
)
def
add_particle
(
self
,
x
,
y
,
color
=
black
,
alpha
=
1
):
def
add_particle
(
self
,
x
,
y
,
color
=
black
,
alpha
=
1
):
"""
Add a particle to the sim database
...
...
@@ -443,7 +443,7 @@ class Sim:
:param y: the y coordinates on which the tile should be added
:return: Successful added matter; False: Unsuccsessful
"""
if
alpha
<
0
or
alpha
>
1
:
if
alpha
<
0
or
alpha
>
1
:
alpha
=
1
if
self
.
check_coords
(
x
,
y
)
==
True
:
if
(
x
,
y
)
not
in
self
.
tile_map_coords
:
...
...
run.py
View file @
011efaeb
...
...
@@ -37,6 +37,7 @@ class ConfigData():
self
.
tile_mm_size
=
config
.
getint
(
"Matter"
,
"tile_mm_size"
)
self
.
location_mm_size
=
config
.
getint
(
"Matter"
,
"location_mm_size"
)
self
.
dir_name
=
None
def
swarm_sim
(
argv
):
"""In the main function first the config is getting parsed and than
the simulator and the sim object is created. Afterwards the run method of the simulator
...
...
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