Commit 2dac129b authored by Ahmad Reza's avatar Ahmad Reza
Browse files

Changes in header.py new color.

In  scenario std_lib the method add_tiles_as_hexagon got a new
attribute color for setting the color of the tiles.
parent 1ea3ec5e
......@@ -44,9 +44,9 @@ tile_mm_size = 2
##Examples##
##Moving
#scenario = lonely_particle
scenario = lonely_particle
#scenario = n_particle_in_line
#solution = random_walk
solution = random_walk
#solution = round_walk
## Creating and Deleting
......@@ -66,7 +66,7 @@ tile_mm_size = 2
#solution= scanning_for_all_aims
## All interfaces
scenario = test_interfaces
#scenario = test_interfaces
#scenario = hexagon_border
solution = test_all_the_interfaces
#solution = test_all_the_interfaces
......@@ -23,6 +23,7 @@ yellow = 6
orange = 7
cyan = 8
violett = 9
dark_green = 10
color_map = {
......@@ -30,6 +31,7 @@ color_map = {
gray: [0.3, 0.3, 0.3],
red: [0.8, 0.0, 0.0],
green: [0.0, 0.8, 0.0],
dark_green: [0.2, 1, 0.6],
blue: [0.0, 0.0, 0.8],
yellow: [0.8, 0.8, 0.0],
orange: [0.8, 0.3, 0.0],
......
import scenario.std_lib as std
import lib.header as header
def scenario(world):
world.add_particle(0, 0)
world.add_particle(0,0)
std.add_tiles_as_hexagon(world, 10, color=header.dark_green)
import random
import lib.header as header
def generating_random_spraded_particles (world, max_size_particle):
for _ in range(0, max_size_particle):
......@@ -39,18 +39,47 @@ def create_particle_in_square(world, max_size_particle, start_coords):
world.add_particle(-x, - 2 * y)
def create_particle_in_hexagons(world, radius):
radius = 3
world.add_particle(0, 0)
def add_particles_as_hexagon(world, radius, color=header.black):
world.add_particle(0, 0, color)
displacement = - radius + 0.5
iteration = 0
for i in range(1, radius + 1):
world.add_particle(i, 0, color)
world.add_particle(-i, 0, color)
for i in range(1, radius + 1):
for j in range(0, (2 * radius) - iteration):
world.add_particle(displacement + j, i, color)
world.add_particle(displacement + j, -i, color)
iteration = iteration + 1
displacement = displacement + 0.5
def add_tiles_as_hexagon(world, radius, color=header.black):
world.add_tile(0, 0, color)
displacement = - radius + 0.5
iteration = 0
for i in range(1, radius + 1):
world.add_tile(i, 0, color)
world.add_tile(-i, 0, color)
for i in range(1, radius + 1):
for j in range(0, (2 * radius) - iteration):
world.add_tile(displacement + j, i, color)
world.add_tile(displacement + j, -i, color)
iteration = iteration + 1
displacement = displacement + 0.5
def add_markers_as_hexagon(world, radius, color=header.black):
world.add_marker(0, 0, color)
displacement = - radius + 0.5
iteration = 0
for i in range(1, radius + 1):
world.add_particle(i, 0)
world.add_particle(-i, 0)
world.add_marker(i, 0, color)
world.add_marker(-i, 0, color)
for i in range(1, radius + 1):
for j in range(0, (2 * radius) - iteration):
world.add_particle(displacement + j, i)
world.add_particle(displacement + j, -i)
world.add_marker(displacement + j, i, color)
world.add_marker(displacement + j, -i, color)
iteration = iteration + 1
displacement = displacement + 0.5
......
Supports Markdown
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