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
469621a6
Commit
469621a6
authored
Sep 23, 2019
by
Ahmad Reza
Browse files
For the sake of clearity the name of some methods in world.py world have been changed.
parent
37d25ae3
Changes
4
Show whitespace changes
Inline
Side-by-side
lib/matter.py
View file @
469621a6
...
...
@@ -40,6 +40,7 @@ class Matter:
elif
alpha
>
1
:
self
.
__alpha
=
1
self
.
touch
()
def
get_alpha
(
self
):
"""
Returns the alpha value of the particle
...
...
lib/tile.py
View file @
469621a6
...
...
@@ -70,17 +70,6 @@ class Tile(matter.Matter):
self
.
set_alpha
(
1
)
self
.
touch
()
def
update_tile_coords
(
self
,
tile
,
new_coords
):
"""
Upadtes the tiles new coordinates
:param tile:
:param new_coords: new coorindation points
:return: None
"""
tile
.
coords
=
new_coords
self
.
tile_map_coords
[
tile
.
coords
]
=
tile
def
touch
(
self
):
"""Tells the visualization that something has been modified and that it shoud changed it"""
self
.
modified
=
True
...
...
lib/world.py
View file @
469621a6
...
...
@@ -76,7 +76,7 @@ class World:
particle_csv
.
write_particle
(
particle
)
particle_csv
.
csv_file
.
close
()
def
success
_termination
(
self
):
def
set_
success
ful_end
(
self
):
self
.
csv_round
.
success
()
self
.
set_end
()
...
...
@@ -104,7 +104,7 @@ class World:
"""
return
self
.
config_data
.
max_round
def
set_end
(
self
):
def
set_
unsuccessful_
end
(
self
):
"""
Allows to terminate before the max round is reached
"""
...
...
@@ -116,13 +116,13 @@ class World:
"""
return
self
.
__end
def
inc_round_counter
(
self
):
def
inc_round_counter
_by
(
self
,
number
=
1
):
"""
Increases the the round counter by
:return:
"""
self
.
__round_counter
+=
1
self
.
__round_counter
+=
number
def
get_solution
(
self
):
"""
...
...
swarm-sim.py
View file @
469621a6
...
...
@@ -89,7 +89,7 @@ def run_solution(swarm_sim_world):
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
())
swarm_sim_world
.
inc_round_counter
(
)
swarm_sim_world
.
inc_round_counter
_by
(
number
=
1
)
def
generate_data
(
config_data
,
swarm_sim_world
):
...
...
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