final without genetics

This commit is contained in:
Sebastian Smołuch 2022-06-09 20:25:18 +02:00 committed by Juundi
parent b7402c8e49
commit 1510a81f35
9 changed files with 64 additions and 9 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,13 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E305" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/SI-projekt-smieciarka4.iml" filepath="$PROJECT_DIR$/.idea/SI-projekt-smieciarka4.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,5 +1,7 @@
from pathlib import Path
import time
import numpy as np
import astar
@ -30,19 +32,19 @@ truck_working = 0
weightsMap = ([1, 2, 1, 4, 5, 2, 7, 8, 5, 4, 15, 3, 4, 5, 8],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 5, 1],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 5, 3],
[1, 20, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 5, 3],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 3, 3, 8, 5, 4],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 9, 5, 2],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 12, 4, 5, 6],
[1, 2, 1, 4, 5, 2, 7, 20, 1, 4, 20, 3, 9, 5, 2],
[1, 2, 1, 4, 20, 2, 7, 8, 1, 4, 1, 12, 4, 5, 6],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 7, 3, 4, 5, 7],
[5, 2, 1, 4, 5, 2, 7, 8, 1, 4, 17, 14, 4, 5, 1],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 14, 3],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 14, 2],
[5, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 14, 6],
[1, 2, 1, 4, 5, 2, 20, 8, 1, 4, 1, 3, 4, 14, 2],
[5, 2, 1, 20, 5, 2, 7, 8, 20, 4, 30, 3, 4, 14, 6],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 13, 14, 15, 7],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 14, 4, 14, 1],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 15, 2],
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 15, 2])
[1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 1, 3, 4, 20, 2])
class Position:
def __init__(self, x, y):
@ -175,7 +177,7 @@ def draw(square_num, objectArr):
def kb_listen(objectArray, gridLength, path):
agent = objectArray[0]
#agent.move(gridLength, path)
agent.move(path)
if __name__ == '__main__':
@ -184,7 +186,7 @@ if __name__ == '__main__':
# Tworzymy nowego playera, czy tam agenta
agent = Agent("smieciarka", Position(0, 0))
junkyard = Junkyard("wysypisko", Position(10, 10))
junkyard = Junkyard("wysypisko", Position(14, 14))
houses = [House(f'dom-{i}', pos) for i, pos in enumerate([Position(x, y) for x, y in [
(7, 4), (3, 10), (8, 10), (4, 5), (1, 2), (10, 4), (13, 14), (6, 9)
]])]
@ -286,6 +288,6 @@ if __name__ == '__main__':
draw(gridSize, objectArray)
kb_listen(objectArray, gridSize, astarPath)
pygame.display.update() # by krata pojawiła się w okienku - update powierzc
pygame.time.wait(100)
pygame.time.wait(150)