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

All the dir abbrevation have been changed to direction.

The direction enum/list has been renamed to direction_list.

All the contents of str_lib of solution and scenario and the header in lib are moved to one file called swarm_sim_header.py

Some bugs has been fixed!
parent 370907ab
This diff is collapsed.
......@@ -201,7 +201,7 @@ def create_particle_in_square(world, max_size_particle, start_coords):
world.add_particle(-x, - 2 * y)
def add_particles_as_hexagon(world, radius, color=header.black):
def add_particles_as_hexagon(world, radius, color=black):
world.add_particle(0, 0, color)
displacement = - radius + 0.5
iteration = 0
......@@ -216,7 +216,7 @@ def add_particles_as_hexagon(world, radius, color=header.black):
displacement = displacement + 0.5
def add_tiles_as_hexagon(world, radius, color=header.black):
def add_tiles_as_hexagon(world, radius, color=black):
world.add_tile(0, 0, color)
displacement = - radius + 0.5
iteration = 0
......@@ -231,7 +231,7 @@ def add_tiles_as_hexagon(world, radius, color=header.black):
displacement = displacement + 0.5
def add_markers_as_hexagon(world, radius, color=header.black):
def add_markers_as_hexagon(world, radius, color=black):
world.add_marker(0, 0, color)
displacement = - radius + 0.5
iteration = 0
......
import scenario.std_lib as std
import lib.swarm_sim_header as header
def scenario(world):
world.add_particle(0,0)
from scenario.std_lib import *
from lib.swarm_sim_header import *
def scenario(world):
......
......@@ -2,7 +2,7 @@
This solution is an example for creating and deleting, particles, tiles or markers
"""
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
if world.get_actual_round() == 1:
......
import random
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
......
......@@ -3,7 +3,7 @@ The particles are moving infront each other but in the different direction but w
the start either to write to each other and then they give out the what it they received from each other.
"""
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
"""
......
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
......
......@@ -3,7 +3,7 @@ This solution just scans for particles that are within 5 hops range and prints t
"""
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_headerimport import *
def solution(world):
......
......@@ -3,7 +3,7 @@ This solution just scans for particles that are within 5 hops range and prints t
"""
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
if world.get_actual_round() == 1 :
......
......@@ -3,10 +3,9 @@ This solution tests all the interfaces that are provided from swarm-world MAX Ro
"""
import logging
import random
#Standard Lib that has to be in each solution
from solution.std_lib import *
from lib.swarm_sim_header import *
def solution(world):
......@@ -90,7 +89,7 @@ def solution(world):
elif world.get_actual_round() > 20:
for particle in world.get_particle_list():
particle.move_to(random.choice(direction))
particle.move_to(random.choice(direction_list))
if particle.coords in world.get_tile_map_coords():
print("Found Tile")
particle.take_tile()
......
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