From 5b4a069b18a18e99c58decea88bec9815a3d3ff1 Mon Sep 17 00:00:00 2001 From: jgeslin42 Date: Wed, 29 Nov 2017 14:55:17 +0100 Subject: [PATCH 1/9] first commit --- test/verify.py | 68 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/test/verify.py b/test/verify.py index de51473..f611ca5 100755 --- a/test/verify.py +++ b/test/verify.py @@ -39,18 +39,21 @@ def test_size(test_name, tree_in, tree_out): in_width = len(tree_in[0]) if (in_height != len(tree_out)): + LOG.write("FAILED: %s | height\n"%(test_name)) return FAILED(test_name) for line in tree_out: if (in_width != len(line)): + LOG.write("FAILED: %s | width\n"%(test_name)) return FAILED(test_name) return SUCCESS(test_name) def test_aliens(test_name, tree_in, tree_out): - for line in tree_out: - for c in line: + for nl, line in enumerate(tree_out): + for nc, c in enumerate(line): if c not in ELEMENTS: + LOG.write("FAILED: %s | alien (%s) at y: %d, x: %d\n"%(test_name, c, ln, nc)) return FAILED(test_name) return SUCCESS(test_name) @@ -60,6 +63,7 @@ def test_desert(test_name, tree_in, tree_out): green_count_out = count_elements(tree_out, TREE_ELEMENTS) if (green_count_in == 0 and green_count_out != 0): + LOG.write("FAILED: %s | Green count not equal tree_in: %d, tree_out: %d\n"%(test_name, green_count_in, green_count_out)) return FAILED(test_name) return SUCCESS(test_name) @@ -78,6 +82,7 @@ def test_light(test_name, tree_in, tree_out): for y in range(len(tree_out)): for x in range(len(tree_out[0])): if (tree_out[y][x] in "fFtT" and not light[y][x]): + LOG.write("FAILED: %s | light not good at x: %d, y: %d\n"%(test_name, x, y)) return FAILED(test_name) return SUCCESS(test_name) @@ -85,7 +90,12 @@ def test_light(test_name, tree_in, tree_out): def test_root(test_name, tree_in, tree_out): for y in range(len(tree_out)): for x in range(len(tree_out[0])): - if (tree_out[y][x] is "r" and tree_in[y][x] not in "r-"): + try: + if (tree_out[y][x] is "r" and tree_in[y][x] not in "r-"): + LOG.write("FAILED: %s | root at x: %d, y: %d\n"%(test_name, x, y)) + return FAILED(test_name) + except IndexError: + LOG.write("FAILED: %s | root IndexError\n"%(test_name)) return FAILED(test_name) return SUCCESS(test_name) @@ -94,6 +104,7 @@ def test_old_trunk(test_name, tree_in, tree_out): for y in range(len(tree_in)): for x in range(len(tree_in[0])): if (tree_in[y][x] is "T" and tree_out[y][x] is not "T" ): + LOG.write("FAILED: %s | trunk at x: %d, y: %d\n"%(test_name, x, y)) return FAILED(test_name) return SUCCESS(test_name) @@ -102,6 +113,7 @@ def test_young_trunk(test_name, tree_in, tree_out): for y in range(len(tree_in)): for x in range(len(tree_in[0])): if (tree_in[y][x] is "t" and tree_out[y][x] not in "tT" ): + LOG.write("FAILED: %s | young trunk at x: %d, y: %d\n"%(test_name, x, y)) return FAILED(test_name) return SUCCESS(test_name) @@ -109,17 +121,32 @@ def test_young_trunk(test_name, tree_in, tree_out): def test_ground_solidity(test_name, tree_in, tree_out): for y in range(len(tree_in)): for x in range(len(tree_in[0])): - if (tree_in[y][x] is "-" and tree_out[y][x] not in "-r" ): + try: + if (tree_in[y][x] is "-" and tree_out[y][x] not in "-r" ): + LOG.write("FAILED: %s | ground solidity (tree_in for roots) at x: %d, y: %d\n"%(test_name, x, y)) + return FAILED(test_name) + except IndexError: + LOG.write("FAILED: %s | ground solidity (tree_in for roots) IndexError\n"%(test_name)) return FAILED(test_name) for y in range(len(tree_in)): for x in range(len(tree_in[0])): - if (tree_in[y][x] is "o" and tree_out[y][x] is not "o" ): + try: + if (tree_in[y][x] is "o" and tree_out[y][x] is not "o" ): + LOG.write("FAILED: %s | ground solidity (tree_in for rocks) at x: %d, y: %d\n"%(test_name, x, y)) + return FAILED(test_name) + except IndexError: + LOG.write("FAILED: %s | ground solidity (tree_in for rocks) IndexError\n"%(test_name)) return FAILED(test_name) for y in range(len(tree_out)): for x in range(len(tree_out[0])): - if (tree_out[y][x] in "o-" and tree_out[y][x] is not tree_in[y][x] ): + try: + if (tree_out[y][x] in "o-" and tree_out[y][x] is not tree_in[y][x] ): + LOG.write("FAILED: %s | ground solidity (tree_out) at x: %d, y: %d\n"%(test_name, x, y)) + return FAILED(test_name) + except IndexError: + LOG.write("FAILED: %s | ground solidity (tree_out) IndexError\n"%(test_name)) return FAILED(test_name) return SUCCESS(test_name) @@ -128,17 +155,24 @@ def test_ground_solidity(test_name, tree_in, tree_out): # MAIN ############################################################################### +import os +try: + os.remove('./results/log_error.txt') +except: + pass +LOG = open("./results/log_error.txt", "w") def main(): - tree_in = create_string_list_from_file(sys.argv[1]) - tree_out = create_string_list_from_file(sys.argv[2]) - - test_size("TEST1", tree_in, tree_out) - test_aliens("TEST2", tree_in, tree_out) - test_desert("TEST3", tree_in, tree_out) - test_light("TEST4", tree_in, tree_out) - test_root("TEST5", tree_in, tree_out) - test_old_trunk("TEST6", tree_in, tree_out) - test_young_trunk("TEST7", tree_in, tree_out) - test_ground_solidity("TEST8", tree_in, tree_out) + tree_in = create_string_list_from_file(sys.argv[1]) + tree_out = create_string_list_from_file(sys.argv[2]) + + test_size("TEST1", tree_in, tree_out) + test_aliens("TEST2", tree_in, tree_out) + test_desert("TEST3", tree_in, tree_out) + test_light("TEST4", tree_in, tree_out) + test_root("TEST5", tree_in, tree_out) + test_old_trunk("TEST6", tree_in, tree_out) + test_young_trunk("TEST7", tree_in, tree_out) + test_ground_solidity("TEST8", tree_in, tree_out) main() +LOG.close() From fdc3d8e5f5452e2cbe17af2f620c83d02486494a Mon Sep 17 00:00:00 2001 From: jgeslin42 Date: Wed, 29 Nov 2017 15:06:45 +0100 Subject: [PATCH 2/9] Add fix tester and tester logger --- test/verify.py | 52 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/test/verify.py b/test/verify.py index f611ca5..2bfceee 100755 --- a/test/verify.py +++ b/test/verify.py @@ -53,7 +53,9 @@ def test_aliens(test_name, tree_in, tree_out): for nl, line in enumerate(tree_out): for nc, c in enumerate(line): if c not in ELEMENTS: - LOG.write("FAILED: %s | alien (%s) at y: %d, x: %d\n"%(test_name, c, ln, nc)) + log = "FAILED: %s | alien (%s) at y: %d, x: %d\n"%(test_name, c, ln, nc) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -63,7 +65,9 @@ def test_desert(test_name, tree_in, tree_out): green_count_out = count_elements(tree_out, TREE_ELEMENTS) if (green_count_in == 0 and green_count_out != 0): - LOG.write("FAILED: %s | Green count not equal tree_in: %d, tree_out: %d\n"%(test_name, green_count_in, green_count_out)) + log = "FAILED: %s | Green count not equal tree_in: %d, tree_out: %d\n"%(test_name, green_count_in, green_count_out) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -82,7 +86,9 @@ def test_light(test_name, tree_in, tree_out): for y in range(len(tree_out)): for x in range(len(tree_out[0])): if (tree_out[y][x] in "fFtT" and not light[y][x]): - LOG.write("FAILED: %s | light not good at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | light not good at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -92,10 +98,14 @@ def test_root(test_name, tree_in, tree_out): for x in range(len(tree_out[0])): try: if (tree_out[y][x] is "r" and tree_in[y][x] not in "r-"): - LOG.write("FAILED: %s | root at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | root at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) except IndexError: - LOG.write("FAILED: %s | root IndexError\n"%(test_name)) + log = "FAILED: %s | root IndexError\n"%(test_name) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -104,7 +114,9 @@ def test_old_trunk(test_name, tree_in, tree_out): for y in range(len(tree_in)): for x in range(len(tree_in[0])): if (tree_in[y][x] is "T" and tree_out[y][x] is not "T" ): - LOG.write("FAILED: %s | trunk at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | trunk at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -113,7 +125,9 @@ def test_young_trunk(test_name, tree_in, tree_out): for y in range(len(tree_in)): for x in range(len(tree_in[0])): if (tree_in[y][x] is "t" and tree_out[y][x] not in "tT" ): - LOG.write("FAILED: %s | young trunk at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | young trunk at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) @@ -123,30 +137,42 @@ def test_ground_solidity(test_name, tree_in, tree_out): for x in range(len(tree_in[0])): try: if (tree_in[y][x] is "-" and tree_out[y][x] not in "-r" ): - LOG.write("FAILED: %s | ground solidity (tree_in for roots) at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | ground solidity (tree_in for roots) at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) except IndexError: - LOG.write("FAILED: %s | ground solidity (tree_in for roots) IndexError\n"%(test_name)) + log = "FAILED: %s | ground solidity (tree_in for roots) IndexError\n"%(test_name) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) for y in range(len(tree_in)): for x in range(len(tree_in[0])): try: if (tree_in[y][x] is "o" and tree_out[y][x] is not "o" ): - LOG.write("FAILED: %s | ground solidity (tree_in for rocks) at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | ground solidity (tree_in for rocks) at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) except IndexError: - LOG.write("FAILED: %s | ground solidity (tree_in for rocks) IndexError\n"%(test_name)) + log = "FAILED: %s | ground solidity (tree_in for rocks) IndexError\n"%(test_name) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) for y in range(len(tree_out)): for x in range(len(tree_out[0])): try: if (tree_out[y][x] in "o-" and tree_out[y][x] is not tree_in[y][x] ): - LOG.write("FAILED: %s | ground solidity (tree_out) at x: %d, y: %d\n"%(test_name, x, y)) + log = "FAILED: %s | ground solidity (tree_out) at x: %d, y: %d\n"%(test_name, x, y) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) except IndexError: - LOG.write("FAILED: %s | ground solidity (tree_out) IndexError\n"%(test_name)) + log = "FAILED: %s | ground solidity (tree_out) IndexError\n"%(test_name) + LOG.write(log) + sys.stderr.write(log) return FAILED(test_name) return SUCCESS(test_name) From 6e4c8904bae1b84a0fd6f096ff0bf2b7227c3f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Statkus?= Date: Wed, 29 Nov 2017 13:31:14 +0100 Subject: [PATCH 3/9] First implementation of the SogiTree : age trees but do not grow them. --- Makefile | 2 +- SogiTree.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 SogiTree.py diff --git a/Makefile b/Makefile index c289f8e..f53a83b 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ RST=results NOTE=$(RST)/test_result TESTER=./test/verify.py -SOGITREE=./SogiTree +SOGITREE=./SogiTree.py TREE2PNG=./tree2png .PRECIOUS : %.ppm diff --git a/SogiTree.py b/SogiTree.py new file mode 100755 index 0000000..42ec347 --- /dev/null +++ b/SogiTree.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 + +import fileinput + +matrix = [] + +############# +# Read file # +############# +for line in fileinput.input(): + line = line[0:-1] + matrix.append(list(line)) + +for i in range(0, 10): + #################### + # Grow the trees ! # + #################### + for l in range(0, len(matrix)): + for c in range(0, len(matrix[l])): + if matrix[l][c] == 't': + matrix[l][c] = 'T' + elif matrix[l][c] == 'F': + matrix[l][c] = 't' + elif matrix[l][c] == 'f': + matrix[l][c] = 'F' + +####################### +# Write modified file # +####################### +for line in matrix: + for character in line: + print(character, end = '') + + print('') From 51a3a4a1c816d0ae72716dc10dc6f2943dd0a14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Statkus?= Date: Wed, 29 Nov 2017 13:37:32 +0100 Subject: [PATCH 4/9] [FIX] We do not need to iterate ourselve, make video do the job for us. --- SogiTree.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/SogiTree.py b/SogiTree.py index 42ec347..bd6be33 100755 --- a/SogiTree.py +++ b/SogiTree.py @@ -11,18 +11,17 @@ line = line[0:-1] matrix.append(list(line)) -for i in range(0, 10): - #################### - # Grow the trees ! # - #################### - for l in range(0, len(matrix)): - for c in range(0, len(matrix[l])): - if matrix[l][c] == 't': - matrix[l][c] = 'T' - elif matrix[l][c] == 'F': - matrix[l][c] = 't' - elif matrix[l][c] == 'f': - matrix[l][c] = 'F' +#################### +# Grow the trees ! # +#################### +for l in range(0, len(matrix)): + for c in range(0, len(matrix[l])): + if matrix[l][c] == 't': + matrix[l][c] = 'T' + elif matrix[l][c] == 'F': + matrix[l][c] = 't' + elif matrix[l][c] == 'f': + matrix[l][c] = 'F' ####################### # Write modified file # From 2fd8bfbd0735de0e7e7f6cde875e11fb1854d98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Statkus?= Date: Wed, 29 Nov 2017 14:49:30 +0100 Subject: [PATCH 5/9] [DEV] Now trees can grow ! --- SogiTree.py | 100 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 6 deletions(-) diff --git a/SogiTree.py b/SogiTree.py index bd6be33..ec67f08 100755 --- a/SogiTree.py +++ b/SogiTree.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import fileinput +import random matrix = [] @@ -14,14 +15,101 @@ #################### # Grow the trees ! # #################### -for l in range(0, len(matrix)): - for c in range(0, len(matrix[l])): - if matrix[l][c] == 't': - matrix[l][c] = 'T' +for l in range(1, len(matrix)-2): + for c in range(1, len(matrix[l])-1): + if matrix[l][c] == 'r': + # Grow the root + # R : new leaf + growing_chance = 0.15 + n_of_new = 0 + n_of_new_allowed = 1 + if matrix[l+1][c-1] == '-': + if random.random() < growing_chance - 0.1: + matrix[l+1][c-1] = 'R' + n_of_new += 1 + if matrix[l+1][c] == '-': + if random.random() < growing_chance - 0.1: + matrix[l+1][c] = 'R' + n_of_new += 1 + if matrix[l+1][c+1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l+1][c+1] = 'R' + n_of_new += 1 + if matrix[l][c-1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.0: + matrix[l][c-1] = 'R' + n_of_new += 1 + if matrix[l][c+1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.0: + matrix[l][c+1] = 'R' + n_of_new += 1 + + elif matrix[l][c] == 'T': + if random.random() < 0.07: + # N : new trunc + if matrix[l][c-1] == ' ': + matrix[l][c-1] = 'N' + if matrix[l][c+1] == ' ': + matrix[l][c+1] = 'N' + + elif matrix[l][c] == 't': + if random.random() < 0.15: + matrix[l][c] = 'T' + elif matrix[l][c] == 'F': - matrix[l][c] = 't' + if random.random() < 0.2: + matrix[l][c] = 't' + elif matrix[l][c] == 'f': - matrix[l][c] = 'F' + if random.random() < 0.3: + matrix[l][c] = 'F' + + # Grow the tree around the leaf + # n : new leaf + growing_chance = 0.3 + n_of_new = 0 + n_of_new_allowed = 2 + if matrix[l-1][c-1] == ' ': + if random.random() < growing_chance: + matrix[l-1][c-1] = 'n' + n_of_new += 1 + if matrix[l-1][c] == ' ': + if random.random() < growing_chance: + matrix[l-1][c] = 'n' + n_of_new += 1 + if matrix[l-1][c+1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance: + matrix[l-1][c+1] = 'n' + n_of_new += 1 + if matrix[l][c-1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l][c-1] = 'n' + n_of_new += 1 + if matrix[l][c+1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l][c+1] = 'n' + n_of_new += 1 + #if matrix[l+1][c-1] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c-1] = 'n' + # n_of_new += 1 + #if matrix[l+1][c] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c] = 'n' + # n_of_new += 1 + #if matrix[l+1][c+1] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c+1] = 'n' + +# Replace the new leaf (n) by leaf (f) and the new trunc (N) by trunc (T) and the new root "R" +for l in range(1, len(matrix)-1): + for c in range(1, len(matrix[l])-1): + if matrix[l][c] == 'n': + matrix[l][c] = 'f' + elif matrix[l][c] == 'N': + matrix[l][c] = 'T' + elif matrix[l][c] == 'R': + matrix[l][c] = 'r' ####################### # Write modified file # From a4791ec343708104ee7f4a8718697f0b6c5b4095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Statkus?= Date: Wed, 29 Nov 2017 15:06:46 +0100 Subject: [PATCH 6/9] [BUID] CHange the name of the executable to have the same Makefile as the msater branch. --- Makefile | 2 +- SogiTree | 135 ++++++++++++++++++++++++++++++++++++++++++++-------- SogiTree.py | 121 ---------------------------------------------- 3 files changed, 115 insertions(+), 143 deletions(-) delete mode 100755 SogiTree.py diff --git a/Makefile b/Makefile index f53a83b..c289f8e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ RST=results NOTE=$(RST)/test_result TESTER=./test/verify.py -SOGITREE=./SogiTree.py +SOGITREE=./SogiTree TREE2PNG=./tree2png .PRECIOUS : %.ppm diff --git a/SogiTree b/SogiTree index 30e6fe0..ec67f08 100755 --- a/SogiTree +++ b/SogiTree @@ -1,28 +1,121 @@ -#! /bin/bash +#!/usr/bin/python3 -IFS='' -COUNT=0 +import fileinput +import random -TMP_FILE=.${0#./}.tmp +matrix = [] -rm -f $TMP_FILE +############# +# Read file # +############# +for line in fileinput.input(): + line = line[0:-1] + matrix.append(list(line)) -#sed -e 's/[^- fFtTor]/ /g' | -while read LINE; -do - echo $LINE | grep -qi '-' +#################### +# Grow the trees ! # +#################### +for l in range(1, len(matrix)-2): + for c in range(1, len(matrix[l])-1): + if matrix[l][c] == 'r': + # Grow the root + # R : new leaf + growing_chance = 0.15 + n_of_new = 0 + n_of_new_allowed = 1 + if matrix[l+1][c-1] == '-': + if random.random() < growing_chance - 0.1: + matrix[l+1][c-1] = 'R' + n_of_new += 1 + if matrix[l+1][c] == '-': + if random.random() < growing_chance - 0.1: + matrix[l+1][c] = 'R' + n_of_new += 1 + if matrix[l+1][c+1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l+1][c+1] = 'R' + n_of_new += 1 + if matrix[l][c-1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.0: + matrix[l][c-1] = 'R' + n_of_new += 1 + if matrix[l][c+1] == '-' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.0: + matrix[l][c+1] = 'R' + n_of_new += 1 - if [ "$?" = "0" ] - then - echo $LINE | grep -qi 'r' - if [ "$?" = "0" ] - then - echo $LINE | sed -e 's/[-]/ /g' | sed -e 's/[rR]/T/g' >> $TMP_FILE - fi - fi - echo $LINE >> $TMP_FILE -done + elif matrix[l][c] == 'T': + if random.random() < 0.07: + # N : new trunc + if matrix[l][c-1] == ' ': + matrix[l][c-1] = 'N' + if matrix[l][c+1] == ' ': + matrix[l][c+1] = 'N' -cat $TMP_FILE | tail -n+2 -rm -f $TMP_FILE + elif matrix[l][c] == 't': + if random.random() < 0.15: + matrix[l][c] = 'T' + elif matrix[l][c] == 'F': + if random.random() < 0.2: + matrix[l][c] = 't' + + elif matrix[l][c] == 'f': + if random.random() < 0.3: + matrix[l][c] = 'F' + + # Grow the tree around the leaf + # n : new leaf + growing_chance = 0.3 + n_of_new = 0 + n_of_new_allowed = 2 + if matrix[l-1][c-1] == ' ': + if random.random() < growing_chance: + matrix[l-1][c-1] = 'n' + n_of_new += 1 + if matrix[l-1][c] == ' ': + if random.random() < growing_chance: + matrix[l-1][c] = 'n' + n_of_new += 1 + if matrix[l-1][c+1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance: + matrix[l-1][c+1] = 'n' + n_of_new += 1 + if matrix[l][c-1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l][c-1] = 'n' + n_of_new += 1 + if matrix[l][c+1] == ' ' and n_of_new < n_of_new_allowed: + if random.random() < growing_chance - 0.1: + matrix[l][c+1] = 'n' + n_of_new += 1 + #if matrix[l+1][c-1] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c-1] = 'n' + # n_of_new += 1 + #if matrix[l+1][c] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c] = 'n' + # n_of_new += 1 + #if matrix[l+1][c+1] == ' ' and n_of_new < n_of_new_allowed: + # if random.random() < growing_chance - 0.2: + # matrix[l+1][c+1] = 'n' + +# Replace the new leaf (n) by leaf (f) and the new trunc (N) by trunc (T) and the new root "R" +for l in range(1, len(matrix)-1): + for c in range(1, len(matrix[l])-1): + if matrix[l][c] == 'n': + matrix[l][c] = 'f' + elif matrix[l][c] == 'N': + matrix[l][c] = 'T' + elif matrix[l][c] == 'R': + matrix[l][c] = 'r' + +####################### +# Write modified file # +####################### +for line in matrix: + for character in line: + print(character, end = '') + + print('') diff --git a/SogiTree.py b/SogiTree.py deleted file mode 100755 index ec67f08..0000000 --- a/SogiTree.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/python3 - -import fileinput -import random - -matrix = [] - -############# -# Read file # -############# -for line in fileinput.input(): - line = line[0:-1] - matrix.append(list(line)) - -#################### -# Grow the trees ! # -#################### -for l in range(1, len(matrix)-2): - for c in range(1, len(matrix[l])-1): - if matrix[l][c] == 'r': - # Grow the root - # R : new leaf - growing_chance = 0.15 - n_of_new = 0 - n_of_new_allowed = 1 - if matrix[l+1][c-1] == '-': - if random.random() < growing_chance - 0.1: - matrix[l+1][c-1] = 'R' - n_of_new += 1 - if matrix[l+1][c] == '-': - if random.random() < growing_chance - 0.1: - matrix[l+1][c] = 'R' - n_of_new += 1 - if matrix[l+1][c+1] == '-' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance - 0.1: - matrix[l+1][c+1] = 'R' - n_of_new += 1 - if matrix[l][c-1] == '-' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance - 0.0: - matrix[l][c-1] = 'R' - n_of_new += 1 - if matrix[l][c+1] == '-' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance - 0.0: - matrix[l][c+1] = 'R' - n_of_new += 1 - - elif matrix[l][c] == 'T': - if random.random() < 0.07: - # N : new trunc - if matrix[l][c-1] == ' ': - matrix[l][c-1] = 'N' - if matrix[l][c+1] == ' ': - matrix[l][c+1] = 'N' - - elif matrix[l][c] == 't': - if random.random() < 0.15: - matrix[l][c] = 'T' - - elif matrix[l][c] == 'F': - if random.random() < 0.2: - matrix[l][c] = 't' - - elif matrix[l][c] == 'f': - if random.random() < 0.3: - matrix[l][c] = 'F' - - # Grow the tree around the leaf - # n : new leaf - growing_chance = 0.3 - n_of_new = 0 - n_of_new_allowed = 2 - if matrix[l-1][c-1] == ' ': - if random.random() < growing_chance: - matrix[l-1][c-1] = 'n' - n_of_new += 1 - if matrix[l-1][c] == ' ': - if random.random() < growing_chance: - matrix[l-1][c] = 'n' - n_of_new += 1 - if matrix[l-1][c+1] == ' ' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance: - matrix[l-1][c+1] = 'n' - n_of_new += 1 - if matrix[l][c-1] == ' ' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance - 0.1: - matrix[l][c-1] = 'n' - n_of_new += 1 - if matrix[l][c+1] == ' ' and n_of_new < n_of_new_allowed: - if random.random() < growing_chance - 0.1: - matrix[l][c+1] = 'n' - n_of_new += 1 - #if matrix[l+1][c-1] == ' ' and n_of_new < n_of_new_allowed: - # if random.random() < growing_chance - 0.2: - # matrix[l+1][c-1] = 'n' - # n_of_new += 1 - #if matrix[l+1][c] == ' ' and n_of_new < n_of_new_allowed: - # if random.random() < growing_chance - 0.2: - # matrix[l+1][c] = 'n' - # n_of_new += 1 - #if matrix[l+1][c+1] == ' ' and n_of_new < n_of_new_allowed: - # if random.random() < growing_chance - 0.2: - # matrix[l+1][c+1] = 'n' - -# Replace the new leaf (n) by leaf (f) and the new trunc (N) by trunc (T) and the new root "R" -for l in range(1, len(matrix)-1): - for c in range(1, len(matrix[l])-1): - if matrix[l][c] == 'n': - matrix[l][c] = 'f' - elif matrix[l][c] == 'N': - matrix[l][c] = 'T' - elif matrix[l][c] == 'R': - matrix[l][c] = 'r' - -####################### -# Write modified file # -####################### -for line in matrix: - for character in line: - print(character, end = '') - - print('') From eab20a539f544bc7205a3b1327ce8e66f431be49 Mon Sep 17 00:00:00 2001 From: Adrien Hamraoui Date: Wed, 29 Nov 2017 15:09:39 +0100 Subject: [PATCH 7/9] Add a script to generate randomly a new world Wow --- Makefile | 8 ++-- scripts/terraform.py | 100 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 3 deletions(-) create mode 100755 scripts/terraform.py diff --git a/Makefile b/Makefile index c289f8e..d6dee85 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,8 @@ note: @echo "ERREURS = " $$(cat $(NOTE) | sort | uniq | grep "FAILED" | wc -l) @echo "TESTS OK= " $$(cat $(NOTE) | sort | uniq | grep "SUCCESS" | wc -l) - - - +generate: + ./scripts/terraform.py > new_world.tree + cat new_world.tree | ./SogiTree > new_world.processed + ./tree2png new_world.processed new_world.png + eog new_world.png diff --git a/scripts/terraform.py b/scripts/terraform.py new file mode 100755 index 0000000..cc4f5b6 --- /dev/null +++ b/scripts/terraform.py @@ -0,0 +1,100 @@ +#!/bin/env python3 + +import random +import sys + +width = 640 +height = 480 +sky_height = height - 100 + +def base_world(): + world = [ [ '-' for w in range(width) ] for h in range(height) ] + for h in range(sky_height): + world[h] = [ ' ' for w in range(width) ] + return world + +def living_tree(box_width, box_height, roots_height): + trunk_height = (box_height - roots_height) / 3 + leaves_height = box_height - roots_height - trunk_height + + trunk_width = int(box_width / 2); + trunk_w_start = int((box_width - trunk_width) / 2) + + tree = [ [ ' ' for w in range(box_width) ] for h in range(box_height) ] + + for h in range(box_height - roots_height): + for w in range(trunk_w_start, trunk_width): + tree[h][w] = 't' + + for h in range(box_height - roots_height, box_height): + for w in range(box_width): + tree[h][w] = '-' + for w in range(trunk_w_start, trunk_width): + tree[h][w] = 'T' # r doesnt work, T is also dark brown + + for h in range(random.randint(50, box_height - roots_height)): + for w in range(box_width): + tree[h][w] = 'f' + + return tree + +def dead_tree(box_width, box_height): + tree = [ [ 'T' for w in range(box_width) ] for h in range(box_height) ] + return tree + +def rock(box_width, box_height): + rock = [ [ 'o' for w in range(box_width) ] for h in range(box_height) ] + return rock + +def put_object(world, origin_h, origin_w, obj): + height = len(obj) + width = len(obj[0]) + + #print('putting object [%s %s]' % (height, width)) + #print('starting at [%s %s]' % (origin_h, origin_w)) + for h in range(height): + for w in range(width): + #print('Putting at [%s %s]' % (origin_h - h, origin_w - w)) + #print('From [%s %s]' % (height - h - 1, width - w - 1)) + #print(obj) + world[origin_h - h][origin_w - w] = obj[height - h - 1][width - w - 1] + return world + +def print_world(world): + for h in range(height): + for w in range(width): + print(world[h][w], end='') + print('\n', end='') + +def randomize_world(world): + plant_head = 0 + for x in range(width - 3): + obj_type = random.randint(1, 11) + next_space = random.randint(10, 50) + + plant_line = sky_height - 1 + if 1 <= obj_type <= 3 : + obj_width = random.randint(20, 100) + obj_height = random.randint(20, 40) + obj = rock(obj_width, obj_height) + elif 4 <= obj_type <= 5: + obj_width = random.randint(3, 5) + obj_height = random.randint(3, int(sky_height / 2)) + obj = dead_tree(obj_width, obj_height) + else: + roots_height = random.randint(5, height - sky_height - 20) + obj_width = random.randint(30, 40) + obj_height = random.randint(3, sky_height - 50) + roots_height + plant_line += roots_height + obj = living_tree(obj_width, obj_height, roots_height) + + world = put_object(world, plant_line, plant_head, obj) + plant_head += obj_width + next_space + + if plant_head > width - next_space: + break + return world + +world = base_world() +world = randomize_world(world) +print_world(world) From ab99ed12af0acf7e95e03789f3a0f44430359c6a Mon Sep 17 00:00:00 2001 From: Erwan Guyader Date: Wed, 29 Nov 2017 14:31:41 +0100 Subject: [PATCH 8/9] Less ground more sky! --- datas/castle.tree | 482 +++++++++++++++++++++++----------------------- 1 file changed, 241 insertions(+), 241 deletions(-) diff --git a/datas/castle.tree b/datas/castle.tree index 1cb08af..8f673b2 100644 --- a/datas/castle.tree +++ b/datas/castle.tree @@ -106,6 +106,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooo ooooooo ooooooooooooooooooooooooooooooooooooo @@ -237,244 +478,3 @@ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- From 62b73a829783592dba910772ebe96c6c12b13bf6 Mon Sep 17 00:00:00 2001 From: Erwan Guyader Date: Wed, 29 Nov 2017 14:23:32 +0100 Subject: [PATCH 9/9] Web rendering --- Makefile | 6 ++++- scripts/tree2html.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++ tree.css | 42 ++++++++++++++++++++++++++++++++ tree2html | 17 +++++++++++++ 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100755 scripts/tree2html.sh create mode 100644 tree.css create mode 100755 tree2html diff --git a/Makefile b/Makefile index d6dee85..310b419 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,10 @@ TESTER=./test/verify.py SOGITREE=./SogiTree TREE2PNG=./tree2png +TREE2HTML=./tree2html .PRECIOUS : %.ppm -.PHONY : all note clean view +.PHONY : all note clean view web all : $(TARGET) @@ -43,6 +44,9 @@ $(RST)/%.mp4 : datas/%.tree ffmpeg -r 10 -i $$DIR/%0$${#I}d.tree.png -r 10 $@ ;\ convert -delay 10 -loop 0 $$DIR/*.png $$DIR.gif +$(RST)/%.html : $(DATA)/%.tree + $(TREE2HTML) $< $@ tree.css + README.pdf : README.md pandoc -t beamer $< --highlight-style=zenburn -o $@ diff --git a/scripts/tree2html.sh b/scripts/tree2html.sh new file mode 100755 index 0000000..ffb3e39 --- /dev/null +++ b/scripts/tree2html.sh @@ -0,0 +1,58 @@ +#! /bin/bash + +IN=$1 +OUT=$2 +STYLE=$3 + +WIDTH=$(wc -L $IN | cut -d' ' -f 1) +HEIGHT=$(wc -l $IN | cut -d' ' -f 1) + +LEAF="
<\/div>" +FOLIAGE="
<\/div>" +BRANCH="
<\/div>" +TRUNK="
<\/div>" +SKY="
<\/div>" +LIGHT_ROCK="
<\/div>" +DARK_ROCK="
<\/div>" + +echo " + + + + + + +
+" >> $OUT + +cat $IN | +sed -e "s/[^-orTtfFT]/@z/g" | +sed -e "s/f/@f/g" | +sed -e "s/F/@F/g" | +sed -e "s/t/@t/g" | +sed -e "s/[rT]/@T/g" | +sed -e "s/-/@-/g" | +sed -e "s/o/@o/g" | +sed -e "s/@z/${SKY}/g" | +sed -e "s/@f/${LEAF}/g" | +sed -e "s/@F/${FOLIAGE}/g" | +sed -e "s/@t/${BRANCH}/g" | +sed -e "s/@T/${TRUNK}/g" | +sed -e "s/@-/${LIGHT_ROCK}/g" | +sed -e "s/@o/${DARK_ROCK}/g" >> $OUT +echo >> $OUT + +echo " +
+ + +" >> $OUT + diff --git a/tree.css b/tree.css new file mode 100644 index 0000000..4ff3d90 --- /dev/null +++ b/tree.css @@ -0,0 +1,42 @@ +body { + margin: 0; + background-color: #00bfb9; + background-image: url("https://www.transparenttextures.com/patterns/diagmonds-light.png"); +} + +.world { + position: fixed; + width: 100vw; + height: 100vh; + display: grid; +} +.pixel { + display: block; +} + +.leaf { + background-color: #4e8500; + background-image: url("https://www.transparenttextures.com/patterns/gray-floral.png"); +} +.foliage { + background-color: #417000; + background-image: url("https://www.transparenttextures.com/patterns/wild-flowers.png"); +} +.trunk, .branch { + background-image: url("https://www.transparenttextures.com/patterns/shley-tree-2.png"); +} +.trunk { + background-color: #543700; +} +.branch { + background-color: #7a4f00; +} +.rock { + background-image: url("https://www.transparenttextures.com/patterns/gravel.png"); +} +.rock.light { + background-color: #cce1ed; +} +.rock.dark { + background-color: #5a7585; +} diff --git a/tree2html b/tree2html new file mode 100755 index 0000000..5fd08e6 --- /dev/null +++ b/tree2html @@ -0,0 +1,17 @@ +#! /bin/bash + +TREE_FILENAME=$1 +HTML_FILENAME=$2 +CSS_FILENAME=$3 + +if [ $# -ne 3 ] +then + echo "usage : $0 tree_file html_file css_file" + exit 42 +fi + +echo $TREE_FILENAME +echo $HTML_FILENAME +echo $CSS_FILENAME + +scripts/tree2html.sh $TREE_FILENAME $HTML_FILENAME $CSS_FILENAME