diff --git a/dana/programs-erroneous/invalid_parser/assign_error.dana b/dana/programs-erroneous/invalid_parser/assign_error.dana new file mode 100644 index 0000000..58a44c6 --- /dev/null +++ b/dana/programs-erroneous/invalid_parser/assign_error.dana @@ -0,0 +1,2 @@ +def main + x = 1 diff --git a/dana/programs-erroneous/invalid_parser/elif_without_if.dana b/dana/programs-erroneous/invalid_parser/elif_without_if.dana new file mode 100644 index 0000000..dccb8e3 --- /dev/null +++ b/dana/programs-erroneous/invalid_parser/elif_without_if.dana @@ -0,0 +1,7 @@ +# Error: 'elif' used without a preceding 'if' + +def main + begin + elif condition + writeString: "This should never be reached" + end diff --git a/dana/programs-erroneous/invalid_parser/grammar_error.dana b/dana/programs-erroneous/invalid_parser/grammar_error.dana new file mode 100644 index 0000000..337fee5 --- /dev/null +++ b/dana/programs-erroneous/invalid_parser/grammar_error.dana @@ -0,0 +1,2 @@ +def hello (writeInteger) + writeString: "Hello world!\n" diff --git a/dana/programs-erroneous/invalid_parser/missing_colon_in_call.dana b/dana/programs-erroneous/invalid_parser/missing_colon_in_call.dana new file mode 100644 index 0000000..0958869 --- /dev/null +++ b/dana/programs-erroneous/invalid_parser/missing_colon_in_call.dana @@ -0,0 +1,4 @@ +# Error: missing ':' in function call syntax + +def main + writeString "Hello without a colon" diff --git a/dana/programs-erroneous/invalid_parser/missing_end_for_begin.dana b/dana/programs-erroneous/invalid_parser/missing_end_for_begin.dana new file mode 100644 index 0000000..828c3d3 --- /dev/null +++ b/dana/programs-erroneous/invalid_parser/missing_end_for_begin.dana @@ -0,0 +1,5 @@ +# Error: 'begin' block is never closed with 'end' + +def main + begin + writeString: "Hello from an unclosed block" diff --git a/dana/programs-erroneous/invalid_semantic/call_to_undefined_function.dana b/dana/programs-erroneous/invalid_semantic/call_to_undefined_function.dana new file mode 100644 index 0000000..08dcfad --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/call_to_undefined_function.dana @@ -0,0 +1,6 @@ +# Error: call to undefined function 'printInt' + +def main + begin + printInt: 42 + end diff --git a/dana/programs-erroneous/invalid_semantic/invalid_break_use.dana b/dana/programs-erroneous/invalid_semantic/invalid_break_use.dana new file mode 100644 index 0000000..47f4a1e --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/invalid_break_use.dana @@ -0,0 +1,3 @@ +def main + break # Error: break outside loop + return: 42 diff --git a/dana/programs-erroneous/invalid_semantic/invalid_continue_use.dana b/dana/programs-erroneous/invalid_semantic/invalid_continue_use.dana new file mode 100644 index 0000000..067f584 --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/invalid_continue_use.dana @@ -0,0 +1,3 @@ +def main + continue # Error: continue outside loop + return: 42 diff --git a/dana/programs-erroneous/invalid_semantic/non_boolean_if_condition.dana b/dana/programs-erroneous/invalid_semantic/non_boolean_if_condition.dana new file mode 100644 index 0000000..c41ff37 --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/non_boolean_if_condition.dana @@ -0,0 +1,5 @@ +# Error: 'if' condition is not boolean (string used as condition) + +def main + if "not a boolean": + writeString: "erroneous" diff --git a/dana/programs-erroneous/invalid_semantic/scope_error.dana b/dana/programs-erroneous/invalid_semantic/scope_error.dana new file mode 100644 index 0000000..98f249a --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/scope_error.dana @@ -0,0 +1,9 @@ +# Error: use of variable 'x' outside its scope (declared inside nested def 'inner') + +def main + var y is int + + def inner + var x is int + x := 42 + y := x diff --git a/dana/programs-erroneous/invalid_semantic/string_array_lvalue.dana b/dana/programs-erroneous/invalid_semantic/string_array_lvalue.dana new file mode 100644 index 0000000..6b0f699 --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/string_array_lvalue.dana @@ -0,0 +1,4 @@ +def main + var s is byte [16] + s := "hello" # should've written: strcpy: s, "hello\n" + writeString: s diff --git a/dana/programs-erroneous/invalid_semantic/strwrite_err.dana b/dana/programs-erroneous/invalid_semantic/strwrite_err.dana new file mode 100644 index 0000000..ca72f8d --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/strwrite_err.dana @@ -0,0 +1,43 @@ +(* + This is the powint program containing a semantic error in a call to + the writeString function. This function expects a byte[] argunment, + not an int type (variable temp below). +*) + +def main + + def powint: base as int, exp as int, mod as int, result as ref int + + var temp is int + + if exp < 1: + result := 1 + elif exp = 0: + result := 1 + else: + powint: base, exp / 2, mod, temp + + if exp % 2 = 0: + result := (temp * temp) % mod + else: + result := (base * temp * temp) % mod + + writeString: temp # SEMANTIC ERROR on this line + + var b is int + var e is int + var m is int + var res is int + + writeString: "Enter base: " + b := readInteger() + writeString: "Enter exponent: " + e := readInteger() + writeString: "Enter modulus: " + m := readInteger() + + powint: b, e, m, res + + writeString: "Result: " + writeInteger: res + writeString: "\n" diff --git a/dana/programs-erroneous/invalid_semantic/type_err.dana b/dana/programs-erroneous/invalid_semantic/type_err.dana new file mode 100644 index 0000000..60f8067 --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/type_err.dana @@ -0,0 +1,5 @@ +def main + var x is int + var s is byte[10] + + return: x + s # Error: cannot add int and byte[] diff --git a/dana/programs-erroneous/invalid_semantic/type_mismatch.dana b/dana/programs-erroneous/invalid_semantic/type_mismatch.dana new file mode 100644 index 0000000..289491f --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/type_mismatch.dana @@ -0,0 +1,54 @@ +(* This is the bsort.dana program with a type error *) + +def main + + def bsort: n as int, x as int [] + + def swap: x y as ref int + var t is int + t := x + x := y + y := t + + var changed is byte + var i is int + + loop: + changed := false + i := 0 + loop: + if i < n-1: + if x[i] > x[i+1]: + swap: x[i], x[i+1] + changed := true + i := i+1 + else: break + if not changed: break + + def writeArray: msg as byte [], n as int, x as int [] + var i is int + + writeString: msg + i := 0 + loop: + if i < n: + if i > 0: writeString: ", " + writeInteger: x[i] + i := i+1 + else: break + writeString: "\n" + + var seed i is int + var x is int [16] + + seed := 65 + i := 0 + loop: + if i < 16: + seed := (seed * 137 + 221 + i) % 101 + x[i] := seed + i := i+1 + else: break + writeArray: "Initial array: ", 16, x + bsort: 16, x[0] # ERROR: Type mismatch + writeArray: "Sorted array: ", 16, x diff --git a/dana/programs-erroneous/invalid_semantic/type_mismatch_in_expression.dana b/dana/programs-erroneous/invalid_semantic/type_mismatch_in_expression.dana new file mode 100644 index 0000000..399b92f --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/type_mismatch_in_expression.dana @@ -0,0 +1,6 @@ +# Error: type mismatch in '+' expression (string + number) + +def main + begin + writeString: "Count: " + 1 + end diff --git a/dana/programs-erroneous/invalid_semantic/undeclared_func.dana b/dana/programs-erroneous/invalid_semantic/undeclared_func.dana new file mode 100644 index 0000000..4eca9ef --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/undeclared_func.dana @@ -0,0 +1,5 @@ +def main + var x is int + + callMe: 42 # Error: callMe is not declared + return: x diff --git a/dana/programs-erroneous/invalid_semantic/undeclared_func_2.dana b/dana/programs-erroneous/invalid_semantic/undeclared_func_2.dana new file mode 100644 index 0000000..b757f1e --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/undeclared_func_2.dana @@ -0,0 +1,4 @@ +def main + var x is int + + return: foo(x, 42) # Error: foo is not defined diff --git a/dana/programs-erroneous/invalid_semantic/undeclared_id.dana b/dana/programs-erroneous/invalid_semantic/undeclared_id.dana new file mode 100644 index 0000000..486ad2c --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/undeclared_id.dana @@ -0,0 +1,6 @@ +def main + var x y is int + var s is byte[10] + + x := z # Error: z is not declared + return: 42 diff --git a/dana/programs-erroneous/invalid_semantic/undefined_identifier_arg.dana b/dana/programs-erroneous/invalid_semantic/undefined_identifier_arg.dana new file mode 100644 index 0000000..a7d2b85 --- /dev/null +++ b/dana/programs-erroneous/invalid_semantic/undefined_identifier_arg.dana @@ -0,0 +1,6 @@ +# Error: use of undefined identifier 'msg' as an argument + +def main + begin + writeString: msg + end diff --git a/dana/programs/def_scopes.dana b/dana/programs/def_scopes.dana new file mode 100644 index 0000000..08fba53 --- /dev/null +++ b/dana/programs/def_scopes.dana @@ -0,0 +1,103 @@ +def main + var counter is int + + # Top-level (within main) f + def f + writeString: "main.f\n" + + # ---- A: nesting + shadowing + sibling call inside a nested scope + def a + + + # f in a + def f + writeString: "a.f\n" + + # b inside a, with its own f and an inner that calls sibling f + def b + + def f + writeString: "a.b.f\n" + + def callf + # should resolve to a.b.f (closest scope) + f + + writeString: "enter a.b\n" + callf + writeString: "leave a.b\n" + + # c inside a, with its own f and an inner that calls it + def c + + def f + writeString: "a.c.f\n" + + def inner + # should resolve to a.c.f + f + + writeString: "enter a.c\n" + inner + writeString: "leave a.c\n" + + writeString: "enter a\n" + b # prints "enter a.b", "a.b.f", "leave a.b" + f # should resolve to a.f + c + writeString: "leave a\n" + + # ---- B: sibling resolution: inner calls sibling helper, then parent's f + def runner + + def f + writeString: "runner.f\n" + + def helper + writeString: "runner.helper\n" + + def inner + # 'helper' must resolve to sibling under 'runner', not deeper + helper + # 'f' must resolve to runner.f (parent scope), not main.f + f + + writeString: "enter runner\n" + inner + writeString: "leave runner\n" + + # ---- C: recursion inside a nested function (fact) + def outer + def fact is int: n as int + if n <= 1: + return: 1 + else: + return: n * fact(n - 1) + + writeInteger: fact(5) + writeChar: '\n' + + # ---- D: captured local through multiple levels + def useCounter + def inc + counter := counter + 1 + writeInteger: counter + writeChar: '\n' + + def callTwice + inc + inc + + callTwice + + + + writeString: "BEGIN\n" + counter := 0 + # Execute the plan + a + runner + outer + useCounter + f # should resolve to main.f + writeString: "END\n" diff --git a/dana/programs/def_scopes.result b/dana/programs/def_scopes.result new file mode 100644 index 0000000..9e372ef --- /dev/null +++ b/dana/programs/def_scopes.result @@ -0,0 +1,19 @@ +BEGIN +enter a +enter a.b +a.b.f +leave a.b +a.f +enter a.c +a.c.f +leave a.c +leave a +enter runner +runner.helper +runner.f +leave runner +120 +1 +2 +main.f +END diff --git a/dana/programs/matrix_mul.dana b/dana/programs/matrix_mul.dana new file mode 100644 index 0000000..3691e23 --- /dev/null +++ b/dana/programs/matrix_mul.dana @@ -0,0 +1,76 @@ +# Matrix multiplication: C(n×p) = A(n×m) × B(m×p) +def main + + # Read an n×m matrix into M + def readMatrix: rows cols as int, M as int[][20] + var i j x is int + i := 0 + loop: + if i >= rows: break + j := 0 + loop: + if j >= cols: break + x := readInteger() + M[i][j] := x + j := j + 1 + i := i + 1 + + # Write an n×m matrix M + def writeMatrix: rows cols as int, M as int[][20] + var i j is int + i := 0 + loop: + if i >= rows: break + j := 0 + loop: + if j >= cols: break + if j > 0: writeString: " " + writeInteger: M[i][j] + j := j + 1 + writeString: "\n" + i := i + 1 + + # C(n×p) = A(n×m) × B(m×p) + def matmul: n m p as int, A B C as int[][20] + var i j k sum is int + i := 0 + loop: + if i >= n: break + j := 0 + loop: + if j >= p: break + sum := 0 + k := 0 + loop: + if k >= m: break + sum := sum + A[i][k] * B[k][j] + k := k + 1 + C[i][j] := sum + j := j + 1 + i := i + 1 + + var n m p is int + var A B C is int[20][20] + + # writeString: "Enter n m p (max 20): " + n := readInteger() + m := readInteger() + p := readInteger() + + if n < 1 or m < 1 or p < 1: + writeString: "Invalid (non-positive) sizes of n m p.\n" + exit + if n > 20: n := 20 + if m > 20: m := 20 + if p > 20: p := 20 + + # writeString: "Enter A (n x m) elements row-wise:\n" + readMatrix: n, m, A + + # writeString: "Enter B (m x p) elements row-wise:\n" + readMatrix: m, p, B + + matmul: n, m, p, A, B, C + + writeString: "Result C (n x p):\n" + writeMatrix: n, p, C diff --git a/dana/programs/matrix_mul.input b/dana/programs/matrix_mul.input new file mode 100644 index 0000000..a433e6d --- /dev/null +++ b/dana/programs/matrix_mul.input @@ -0,0 +1,6 @@ +2 3 2 +1 2 3 +4 5 6 +7 8 +9 10 +11 12 diff --git a/dana/programs/matrix_mul.result b/dana/programs/matrix_mul.result new file mode 100644 index 0000000..59428b2 --- /dev/null +++ b/dana/programs/matrix_mul.result @@ -0,0 +1,3 @@ +Result C (n x p): +58 64 +139 154 diff --git a/dana/programs/nextRand.dana b/dana/programs/nextRand.dana new file mode 100644 index 0000000..4a15dca --- /dev/null +++ b/dana/programs/nextRand.dana @@ -0,0 +1,26 @@ +# +# Random integer generator +# +def main + var seed iter is int + + def nextRand is int + var a b c is int + + a := 1664525 + b := 1013904223 + c := 2147483647 + seed := (a * seed + b) % c + if seed < 0: + seed := -seed + return: seed + + seed := 123456 + iter := 0 + loop: + if iter < 10: + writeInteger: (nextRand() % 100) + writeChar: '\n' + iter := iter + 1 + else: + break diff --git a/dana/programs/nextRand.result b/dana/programs/nextRand.result new file mode 100644 index 0000000..13ea838 --- /dev/null +++ b/dana/programs/nextRand.result @@ -0,0 +1,10 @@ +15 +34 +97 +96 +53 +40 +43 +66 +51 +14 diff --git a/dana/programs/tsp.dana b/dana/programs/tsp.dana new file mode 100644 index 0000000..f2e8402 --- /dev/null +++ b/dana/programs/tsp.dana @@ -0,0 +1,295 @@ +# +# Genetic Algorithm for the Travelling Salesman Problem +# +def main + var NUM_CITIES POP_SIZE MAX_GEN is int + var distance is int[8][8] + + # Dimensions should be [POP_SIZE][NUM_CITIES] + var population new_population is int[100][8] + + var seed is int + def nextRand is int + var a b c is int + + a := 1664525 + b := 1013904223 + c := 2147483647 + seed := (a * seed + b) % c + if seed < 0: + seed := -seed + + return: seed + + def fitness is int: chromosome as int[] + var total i is int + + total := 0 + i := 0 + + loop: + if i < NUM_CITIES-1: + total := total + distance[chromosome[i]][chromosome[i+1]] + i := i + 1 + else: + break + # Add the distance to return to the starting city + total := total + distance[chromosome[NUM_CITIES-1]][chromosome[0]] + return: total + + def select_parent is int + var a b is int + + a := nextRand() % POP_SIZE + b := nextRand() % POP_SIZE + + if fitness(population[a]) < fitness(population[b]): + return: b + else: + return: a + + def crossover: p1 p2 child as int[] + var start final_idx tmp i idx is int + var city found j is int + + start := nextRand() % NUM_CITIES + final_idx := nextRand() % NUM_CITIES + if start > final_idx: + tmp := start + start := final_idx + final_idx := tmp + + # Take a slice from the first parent + i := start + loop: + if i <= final_idx: + child[i] := p1[i] + i := i + 1 + else: + break + + # Fill the remaining positions from the second parent + idx := (final_idx + 1) % NUM_CITIES + i := 0 + loop: + if i < NUM_CITIES: + + city := p2[i] + found := 0 + j := start + loop: + if j <= final_idx: + if child[j] = city: + found := 1 + j := j + 1 + else: + break + + if found = 0: + child[idx] := city + idx := (idx + 1) % NUM_CITIES + + i := i + 1 + else: + break + + def mutate: chromosome as int[], chance_per_gene as int + var i j tmp r is int + + i := 0 + loop: + if i < NUM_CITIES: + + r := nextRand() % 100 + if r < chance_per_gene: + # swap current gene with a random gene(may be the same) + j := nextRand() % NUM_CITIES + tmp := chromosome[i] + chromosome[i] := chromosome[j] + chromosome[j] := tmp + + i := i + 1 + else: + break + + def init_distance + var i j is int + + i := 0 + loop: + if i < NUM_CITIES: + + j := 0 + loop: + if j < NUM_CITIES: + if i = j: + distance[i][j] := 0 + else: + distance[i][j] := (nextRand() % 20) + 1 + j := j + 1 + else: + break + + i := i + 1 + else: + break + + def init_population + var i j k tmp rand_idx is int + + i := 0 + loop: + if i < POP_SIZE: + + # Fill chromosome with 0..NUM_CITIES-1 + j := 0 + loop: + if j < NUM_CITIES: + population[i][j] := j + j := j + 1 + else: + break + + # Shuffle using Fisher-Yates + k := NUM_CITIES-1 + loop: + if k > 0: + rand_idx := nextRand() % (k+1) + tmp := population[i][k] + population[i][k] := population[i][rand_idx] + population[i][rand_idx] := tmp + k := k - 1 + else: + break + + i := i + 1 + else: + break + + def print_path: path as int[], len as int + var i is int + + i := 0 + loop: + if i < len: + writeInteger: path[i] + writeString: ", " + i := i + 1 + else: + break + writeChar: '\n' + + def assign_1d: src target as int[], len as int + var i is int + + i := 0 + loop: + if i < len: + target[i] := src[i] + i := i + 1 + else: + break + + def assign_2d: src target as int[][8], dim1 dim2 as int + var i j is int + + i := 0 + loop: + if i < dim1: + + j := 0 + loop: + if j < dim2: + target[i][j] := src[i][j] + j := j + 1 + else: + break + + i := i + 1 + else: + break + + var gen k p1 p2 i d is int + var child1 child2 is int[8] + + var best_path is int[8] + var best_distance is int + + NUM_CITIES := 8 + POP_SIZE := 100 + MAX_GEN := 50 + + #seed := 123456 + seed := 12345678 + best_distance := 1000 + + init_distance + init_population + + gen := 0 + loop gen_loop: + if gen < MAX_GEN: + + # Check best solution this generation + i := 0 + loop i_loop: + if i < POP_SIZE: + + d := fitness(population[i]) + if d < best_distance: + best_distance := d + assign_1d: population[i], best_path, NUM_CITIES + + i := i + 1 + else: + break: i_loop + writeString: "Generation " + writeInteger: gen + writeString: " best distance = " + writeInteger: best_distance + writeString: " with best path: " + print_path: best_path, NUM_CITIES + + k := 0 + loop k_loop: + (* + writeString: "k = " + writeInteger: k + writeString: ", gen = " + writeInteger: gen + writeChar: '\n' + *) + if k < POP_SIZE/2: + p1 := select_parent() + p2 := select_parent() + + crossover: population[p1], population[p2], child1 + crossover: population[p2], population[p1], child2 + + mutate: child1, 5 + mutate: child2, 5 + + assign_1d: child1, new_population[2*k], NUM_CITIES + assign_1d: child2, new_population[2*k+1], NUM_CITIES + + #writeString: "Made new generation...\n" + + k := k + 1 + else: + break: k_loop + + # pick the current best one and put it in the new population + assign_1d: best_path, new_population[0], NUM_CITIES + + assign_2d: new_population, population, POP_SIZE, NUM_CITIES + + gen := gen + 1 + else: + break: gen_loop + + # Print best solution + writeString: "Best distance: " + writeInteger: best_distance + writeChar: '\n' + writeString: "Best path: " + print_path: best_path, NUM_CITIES diff --git a/dana/programs/tsp.result b/dana/programs/tsp.result new file mode 100644 index 0000000..21da8fb --- /dev/null +++ b/dana/programs/tsp.result @@ -0,0 +1,52 @@ +Generation 0 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 1 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 2 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 3 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 4 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 5 best distance = 45 with best path: 6, 0, 7, 5, 3, 2, 1, 4, +Generation 6 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 7 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 8 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 9 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 10 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 11 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 12 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 13 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 14 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 15 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 16 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 17 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 18 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 19 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 20 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 21 best distance = 41 with best path: 5, 2, 6, 0, 7, 1, 3, 4, +Generation 22 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 23 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 24 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 25 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 26 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 27 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 28 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 29 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 30 best distance = 36 with best path: 1, 3, 4, 6, 0, 7, 5, 2, +Generation 31 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 32 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 33 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 34 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 35 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 36 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 37 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 38 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 39 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 40 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 41 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 42 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 43 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 44 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 45 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 46 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 47 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 48 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Generation 49 best distance = 35 with best path: 2, 5, 0, 7, 1, 3, 4, 6, +Best distance: 35 +Best path: 2, 5, 0, 7, 1, 3, 4, 6,