liczenie roślinek
@ -6,18 +6,18 @@
|
||||
<change beforePath="$PROJECT_DIR$/cart.py" beforeDir="false" afterPath="$PROJECT_DIR$/cart.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/definitions.py" beforeDir="false" afterPath="$PROJECT_DIR$/definitions.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/map.py" beforeDir="false" afterPath="$PROJECT_DIR$/map.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/plant.py" beforeDir="false" afterPath="$PROJECT_DIR$/plant.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/py.py" beforeDir="false" afterPath="$PROJECT_DIR$/py.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/screen.jpg" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_01.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_01.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_02.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_02.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_03.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_03.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_04.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_04.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_05.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_05.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_06.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_06.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_08.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_08.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_07.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_04_07.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_01.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_01.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_02.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_02.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_03.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_03.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_04.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_04.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_05.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_05.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_06.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_06.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_07.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_05_07.png" afterDir="false" />
|
||||
@ -41,7 +41,6 @@
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_08.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_08.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_09.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_09.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_10.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_07_10.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_01.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_01.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_02.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_02.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_03.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_03.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_04.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_04.png" afterDir="false" />
|
||||
@ -51,10 +50,16 @@
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_08.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_08.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_09.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_09.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_10.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_08_10.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_07.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_07.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_08.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_08.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_09.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_09.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_10.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_09_10.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_01.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_01.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_02.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_02.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_03.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_03.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_04.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_04.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_05.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_05.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_06.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_06.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_07.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_07.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_08.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_08.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_09.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_09.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_10.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/neural_network/tiles/tile_10_10.png" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -222,6 +227,7 @@
|
||||
<workItem from="1622548476938" duration="57000" />
|
||||
<workItem from="1622755977663" duration="282000" />
|
||||
<workItem from="1622801431771" duration="6572000" />
|
||||
<workItem from="1622897294680" duration="6272000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -243,55 +249,55 @@
|
||||
</state>
|
||||
<state x="690" y="287" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622802726751" />
|
||||
<state x="690" y="287" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1621429221570" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1622808063144">
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.bottom" timestamp="1622903620068">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622808063144" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.bottom/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620068" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1621429389327" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1622808063144">
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.center" timestamp="1622903620067">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622808063144" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.center/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620067" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1621429389327" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1622808063144">
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.left" timestamp="1622903620067">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622808063144" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.left/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620067" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1621429389326" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1622808063144">
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.right" timestamp="1622903620067">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622808063144" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.0.right/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620067" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1621429389327" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1622538962724">
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1622903620068">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622538962724" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620068" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1619289752045" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.center" timestamp="1622538962724">
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.center" timestamp="1622903620068">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.center/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622538962724" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.center/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620068" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.center/0.0.1920.1080@0.0.1920.1080" timestamp="1619289752045" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.left" timestamp="1622538962724">
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.left" timestamp="1622903620068">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.left/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622538962724" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.left/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620068" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.left/0.0.1920.1080@0.0.1920.1080" timestamp="1619289752045" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right" timestamp="1622538962724">
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right" timestamp="1622903620068">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622538962724" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622903620068" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1619289752045" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1622801461112">
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1622897293911">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622801461112" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622897293911" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1621439087317" />
|
||||
<state x="623" y="235" width="672" height="678" key="search.everywhere.popup" timestamp="1622494466933">
|
||||
<state x="623" y="235" width="672" height="678" key="search.everywhere.popup" timestamp="1622900746217">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="623" y="235" width="672" height="678" key="search.everywhere.popup/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622494466933" />
|
||||
<state x="623" y="235" width="672" height="678" key="search.everywhere.popup/0.0.1920.1080/-1920.0.1920.1080@0.0.1920.1080" timestamp="1622900746217" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
@ -308,6 +314,6 @@
|
||||
<SUITE FILE_PATH="coverage/SmartCart$copy.coverage" NAME="copy Coverage Results" MODIFIED="1622503170538" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/SmartCart$glue.coverage" NAME="glue Coverage Results" MODIFIED="1622501306368" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/SmartTractor$py.coverage" NAME="py Coverage Results" MODIFIED="1622469837941" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/SmartCart$py.coverage" NAME="py Coverage Results" MODIFIED="1622808023419" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/SmartCart$py.coverage" NAME="py Coverage Results" MODIFIED="1622903575704" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
8
cart.py
@ -162,11 +162,11 @@ class Cart:
|
||||
loop = False
|
||||
self.set_fuel(self.get_fuel() - 1)
|
||||
def is_move_allowed(self, cart_rect): #sprawdza czy dany ruch, który chce wykonać wózek jest możliwy, zwraca prawdę lub fałsz
|
||||
if self.direction == definitions.CART_DIRECTION_EAST and cart_rect.x + definitions.BLOCK_SIZE < definitions.WIDTH:
|
||||
if self.direction == definitions.CART_DIRECTION_EAST and cart_rect.x + definitions.BLOCK_SIZE < definitions.WIDTH_MAP:
|
||||
return True
|
||||
elif self.direction == definitions.CART_DIRECTION_NORTH and cart_rect.y - definitions.BLOCK_SIZE >= 0:
|
||||
return True
|
||||
elif self.direction == definitions.CART_DIRECTION_SOUTH and cart_rect.y + definitions.BLOCK_SIZE < definitions.HEIGHT:
|
||||
elif self.direction == definitions.CART_DIRECTION_SOUTH and cart_rect.y + definitions.BLOCK_SIZE < definitions.HEIGHT_MAP:
|
||||
return True
|
||||
elif self.direction == definitions.CART_DIRECTION_WEST and cart_rect.x - definitions.BLOCK_SIZE >= 0:
|
||||
return True
|
||||
@ -174,11 +174,11 @@ class Cart:
|
||||
return False
|
||||
@staticmethod
|
||||
def is_move_allowed_succ(node): #sprawdza czy dany ruch, który chce wykonać wózek jest możliwy, zwraca pozycje po wykonaniu ruchu, wersja node
|
||||
if node.get_direction() == definitions.CART_DIRECTION_EAST and node.get_x() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.WIDTH:
|
||||
if node.get_direction() == definitions.CART_DIRECTION_EAST and node.get_x() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.WIDTH_MAP:
|
||||
return "x + 1"
|
||||
elif node.get_direction() == definitions.CART_DIRECTION_NORTH and node.get_y() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE >= 0:
|
||||
return "y - 1"
|
||||
elif node.get_direction() == definitions.CART_DIRECTION_SOUTH and node.get_y() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.HEIGHT:
|
||||
elif node.get_direction() == definitions.CART_DIRECTION_SOUTH and node.get_y() * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE < definitions.HEIGHT_MAP:
|
||||
return "y + 1"
|
||||
elif node.get_direction() == definitions.CART_DIRECTION_WEST and node.get_x() * definitions.BLOCK_SIZE - definitions.BLOCK_SIZE >= 0:
|
||||
return "x - 1"
|
||||
|
@ -1,7 +1,10 @@
|
||||
#definicje
|
||||
import os
|
||||
import pygame
|
||||
pygame.init()
|
||||
BLOCK_SIZE = 60
|
||||
BEETROOT = pygame.image.load(os.path.join('resources/images', 'beetroot.png'))
|
||||
BEETROOT = pygame.transform.scale(BEETROOT, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
BEETROOTS_ADULT_COST = 4
|
||||
BEETROOTS_GROW_COST = 10
|
||||
BEETROOTS_GROW_TIME = 5
|
||||
@ -14,6 +17,8 @@ BEETROOTS_STAGE_2 = pygame.image.load(os.path.join('resources/images', 'beetroot
|
||||
BEETROOTS_STAGE_2 = pygame.transform.scale(BEETROOTS_STAGE_2, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
BEETROOTS_STAGE_3 = pygame.image.load(os.path.join('resources/images', 'beetroots_stage_3.png'))
|
||||
BEETROOTS_STAGE_3 = pygame.transform.scale(BEETROOTS_STAGE_3, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
CARROT = pygame.image.load(os.path.join('resources/images', 'carrot.png'))
|
||||
CARROT = pygame.transform.scale(CARROT, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
CARROTS_ADULT_COST = 4
|
||||
CARROTS_GROW_COST = 10
|
||||
CARROTS_GROW_TIME = 5
|
||||
@ -57,10 +62,16 @@ FLOWER_DANDELION = pygame.transform.scale(FLOWER_DANDELION, (BLOCK_SIZE, BLOCK_S
|
||||
FLOWER_DANDELION_COST = 5
|
||||
FLOWER_DANDELION_GROW_PROBABILITY = 0.01
|
||||
FLOWER_DANDELION_MAXIMUM_STATE = 1
|
||||
FONT_COLOR = (255, 255, 255)
|
||||
FONT_SIZE = 23
|
||||
FONT = pygame.font.Font(os.path.join('resources/font', 'Minecraft.ttf'), FONT_SIZE)
|
||||
FPS = 1
|
||||
HEIGHT_AMOUNT, WIDTH_AMOUNT = 10, 10
|
||||
HEIGHT, WIDTH = BLOCK_SIZE * HEIGHT_AMOUNT, BLOCK_SIZE * WIDTH_AMOUNT
|
||||
HEIGHT_MAP, WIDTH_MAP = BLOCK_SIZE * HEIGHT_AMOUNT, BLOCK_SIZE * WIDTH_AMOUNT
|
||||
HEIGHT, WIDTH = HEIGHT_MAP + BLOCK_SIZE, WIDTH_MAP
|
||||
IMAGE_SIZE_NEURAL_NETWORK = 16
|
||||
POTATO = pygame.image.load(os.path.join('resources/images', 'potato.png'))
|
||||
POTATO = pygame.transform.scale(POTATO, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
POTATOES_ADULT_COST = 4
|
||||
POTATOES_GROW_COST = 10
|
||||
POTATOES_GROW_TIME = 5
|
||||
@ -75,9 +86,13 @@ POTATOES_STAGE_3 = pygame.image.load(os.path.join('resources/images', 'potatoes_
|
||||
POTATOES_STAGE_3 = pygame.transform.scale(POTATOES_STAGE_3, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
SPONGE = pygame.image.load(os.path.join('resources/images', 'sponge.png'))
|
||||
SPONGE = pygame.transform.scale(SPONGE, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
SPONGE_WET = pygame.image.load(os.path.join('resources/images', 'sponge_wet.png'))
|
||||
SPONGE_WET = pygame.transform.scale(SPONGE_WET, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
STATION = pygame.image.load(os.path.join('resources/images', 'rail_normal.png'))
|
||||
STATION = pygame.transform.scale(STATION, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
STATION_COST = 6
|
||||
WHEAT = pygame.image.load(os.path.join('resources/images', 'wheat.png'))
|
||||
WHEAT = pygame.transform.scale(WHEAT, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
WHEAT_ADULT_COST = 4
|
||||
WHEAT_GROW_COST = 10
|
||||
WHEAT_GROW_TIME = 5
|
||||
|
41
map.py
@ -23,8 +23,8 @@ class Map:
|
||||
temp_field = field.Field(temp_plant, temp_rect, temp_soil)
|
||||
temp_map_field.append(temp_field)
|
||||
self.fields.append(temp_map_field)
|
||||
def draw_window(self, cart, cart_rect): #rysuje mapę
|
||||
self.fill_map()
|
||||
def draw_window(self, cart, cart_rect, station): #rysuje mapę
|
||||
self.fill_map(station)
|
||||
if cart.get_direction() == definitions.CART_DIRECTION_EAST:
|
||||
definitions.WINDOW.blit(definitions.CART_DIRECTION_EAST_TEXTURE, (cart_rect.x, cart_rect.y))
|
||||
elif cart.get_direction() == definitions.CART_DIRECTION_NORTH:
|
||||
@ -34,7 +34,7 @@ class Map:
|
||||
elif cart.get_direction() == definitions.CART_DIRECTION_WEST:
|
||||
definitions.WINDOW.blit(definitions.CART_DIRECTION_WEST_TEXTURE, (cart_rect.x, cart_rect.y))
|
||||
pygame.display.update()
|
||||
def fill_map(self): #wypełnia mapę teksturami na podstawie logicznego stanu pól
|
||||
def fill_map(self, station): #wypełnia mapę teksturami na podstawie logicznego stanu pól
|
||||
for i in range(definitions.WIDTH_AMOUNT):
|
||||
for j in range(definitions.HEIGHT_AMOUNT):
|
||||
field = self.fields[i][j]
|
||||
@ -101,6 +101,41 @@ class Map:
|
||||
elif block != definitions.DIRT or block != definitions.FARMLAND_DRY or block != definitions.FARMLAND_WET:
|
||||
definitions.WINDOW.blit(definitions.FARMLAND_WET, (rect.x, rect.y))
|
||||
definitions.WINDOW.blit(block, (rect.x, rect.y))
|
||||
for i in range(definitions.WIDTH_AMOUNT):
|
||||
block = definitions.SPONGE_WET
|
||||
definitions.WINDOW.blit(block, (i * definitions.BLOCK_SIZE, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE))
|
||||
if i == 1:
|
||||
block = definitions.BEETROOT
|
||||
definitions.WINDOW.blit(block, (i * definitions.BLOCK_SIZE, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE))
|
||||
elif i == 2:
|
||||
text = definitions.FONT.render(str(station.get_collected_plants("beetroot")), True, definitions.FONT_COLOR)
|
||||
text_rect = text.get_rect()
|
||||
text_rect.center = (i * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2)
|
||||
definitions.WINDOW.blit(text, text_rect)
|
||||
elif i == 3:
|
||||
block = definitions.CARROT
|
||||
definitions.WINDOW.blit(block, (i * definitions.BLOCK_SIZE, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE))
|
||||
elif i == 4:
|
||||
text = definitions.FONT.render(str(station.get_collected_plants("carrot")), True, definitions.FONT_COLOR)
|
||||
text_rect = text.get_rect()
|
||||
text_rect.center = (i * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2)
|
||||
definitions.WINDOW.blit(text, text_rect)
|
||||
elif i == 5:
|
||||
block = definitions.POTATO
|
||||
definitions.WINDOW.blit(block, (i * definitions.BLOCK_SIZE, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE))
|
||||
elif i == 6:
|
||||
text = definitions.FONT.render(str(station.get_collected_plants("potato")), True, definitions.FONT_COLOR)
|
||||
text_rect = text.get_rect()
|
||||
text_rect.center = (i * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2)
|
||||
definitions.WINDOW.blit(text, text_rect)
|
||||
elif i == 7:
|
||||
block = definitions.WHEAT
|
||||
definitions.WINDOW.blit(block, (i * definitions.BLOCK_SIZE, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE))
|
||||
elif i == 8:
|
||||
text = definitions.FONT.render(str(station.get_collected_plants("wheat")), True, definitions.FONT_COLOR)
|
||||
text_rect = text.get_rect()
|
||||
text_rect.center = (i * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2, definitions.HEIGHT_AMOUNT * definitions.BLOCK_SIZE + definitions.BLOCK_SIZE / 2)
|
||||
definitions.WINDOW.blit(text, text_rect)
|
||||
def get_field_cost(self, x, y): #zwraca koszt danego pola
|
||||
field = self.fields[x][y]
|
||||
if field.get_plant().get_name() == "station" and field.get_plant().get_state() == -1:
|
||||
|
20
py.py
@ -10,17 +10,20 @@ import plant
|
||||
import pygame
|
||||
import station
|
||||
import treelearn
|
||||
pygame.display.set_caption("Smart Cart")
|
||||
def main():
|
||||
#inicjowanie pygame'a
|
||||
pygame.init()
|
||||
pygame.display.set_caption("Smart Cart")
|
||||
#tworzenie podstawowych obiektów
|
||||
map1 = map.Map([])
|
||||
map1.create_base_map()
|
||||
move_list = ["rotate_left", "move", "move", "move", "move", "move", "move", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "move", "move", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "rotate_left", "move", "rotate_left", "rotate_left", "rotate_left", "move"] #początkowe ruchy
|
||||
amount_of_seeds_dict = {"beetroot": definitions.CART_AMOUNT_OF_SEEDS_EACH_TYPE, "carrot": definitions.CART_AMOUNT_OF_SEEDS_EACH_TYPE, "potato": definitions.CART_AMOUNT_OF_SEEDS_EACH_TYPE, "wheat": definitions.CART_AMOUNT_OF_SEEDS_EACH_TYPE}
|
||||
collected_plants_dict = {"beetroot": 0, "carrot": 0, "potato": 0, "wheat": 0}
|
||||
collected_plants_dict_cart = {"beetroot": 0, "carrot": 0, "potato": 0, "wheat": 0}
|
||||
collected_plants_dict_station = {"beetroot": 0, "carrot": 0, "potato": 0, "wheat": 0}
|
||||
fertilizer_dict = {"beetroot": definitions.CART_FERTILIZER, "carrot": definitions.CART_FERTILIZER, "potato": definitions.CART_FERTILIZER, "wheat": definitions.CART_FERTILIZER}
|
||||
station1 = station.Station(collected_plants_dict)
|
||||
cart1 = cart.Cart(amount_of_seeds_dict, collected_plants_dict, definitions.CART_DIRECTION_WEST, fertilizer_dict, definitions.CART_FUEL, definitions.CART_WATER_LEVEL, 0 * definitions.BLOCK_SIZE, 0 * definitions.BLOCK_SIZE)
|
||||
station1 = station.Station(collected_plants_dict_station)
|
||||
cart1 = cart.Cart(amount_of_seeds_dict, collected_plants_dict_cart, definitions.CART_DIRECTION_WEST, fertilizer_dict, definitions.CART_FUEL, definitions.CART_WATER_LEVEL, 0 * definitions.BLOCK_SIZE, 0 * definitions.BLOCK_SIZE)
|
||||
cart1_rect = pygame.Rect(cart1.get_x(), cart1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
||||
clock = pygame.time.Clock()
|
||||
tree = treelearn.treelearn() #tworzenie drzewa decyzyjnego
|
||||
@ -34,13 +37,18 @@ def main():
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
run = False
|
||||
map1.draw_window(cart1, cart1_rect)
|
||||
map1.draw_window(cart1, cart1_rect, station1)
|
||||
if not move_list: #jeżeli są jakieś ruchy do wykonania w move_list
|
||||
grow_flower_dandelion = True
|
||||
pygame.image.save(pygame.display.get_surface(), os.path.join('resources/neural_network/tiles/', 'screen.jpg')) #zrzut obecnego ekranu
|
||||
tiles = image_slicer.slice(os.path.join('resources/neural_network/tiles/', 'screen.jpg'), 100, save=False) #pocięcie ekranu na sto części
|
||||
tiles = image_slicer.slice(os.path.join('resources/neural_network/tiles/', 'screen.jpg'), row=definitions.HEIGHT_AMOUNT + 1, col=definitions.WIDTH_AMOUNT, save=False) #pocięcie ekranu na sto części
|
||||
image_slicer.save_tiles(tiles, directory=os.path.join('resources/neural_network/tiles/'), prefix='tile', format='png') #zapisanie części do folderu tiles
|
||||
os.remove('resources/neural_network/tiles/screen.jpg')
|
||||
for char in range(0, 10):
|
||||
if str(char) == "0":
|
||||
os.remove('resources/neural_network/tiles/tile_11_10.png')
|
||||
else:
|
||||
os.remove('resources/neural_network/tiles/tile_11_0' + str(char) + '.png')
|
||||
istate = graph.Istate(cart1.get_direction(), cart1.get_x() / definitions.BLOCK_SIZE, cart1.get_y() / definitions.BLOCK_SIZE) #stan początkowy wózka (jego orientacja oraz jego aktualne miejsce)
|
||||
if neuralnetwork.predfield(classes, istate, model) is not False: #jeżeli istnieje jakaś dojrzała roślina
|
||||
random_movement = False
|
||||
|
BIN
resources/font/Minecraft.ttf
Normal file
BIN
resources/images/beetroot.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
resources/images/carrot.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
resources/images/potato.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
resources/images/sponge_wet.png
Normal file
After Width: | Height: | Size: 876 B |
BIN
resources/images/wheat.png
Normal file
After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.7 KiB |