-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterface.py
More file actions
31 lines (22 loc) · 813 Bytes
/
Copy pathinterface.py
File metadata and controls
31 lines (22 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import random
class IndividualGene:
def __init__(self, configuration):
self.configuration = configuration
self._fitness = random.randint(0, 100)
def mutate(self):
self._fitness = random.randint(0, 100)
def crossover(self, other):
self._fitness = random.randint(0, 100)
def fitness(self):
return self._fitness
def path(self):
return [(2,2), (1,4), (3,3), (4,1)]
def __repr__(self):
return repr((self.fitness()))
class Configuration:
"""board_Size is the side length of the square chess board"""
def __init__(self, board_size, start_row, start_col, generation_max):
self.board_size = board_size
self.start_row = start_row
self.start_col = start_col
self.generation_max = generation_max