nawóz
This commit is contained in:
parent
a431a57049
commit
9ab7b66267
@ -4,7 +4,10 @@
|
|||||||
<list default="true" id="56453584-72bd-49f4-a39c-fccf91ab20c6" name="Default Changelist" comment="">
|
<list default="true" id="56453584-72bd-49f4-a39c-fccf91ab20c6" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/definitions.py" beforeDir="false" afterPath="$PROJECT_DIR$/definitions.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/definitions.py" beforeDir="false" afterPath="$PROJECT_DIR$/definitions.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$/py.py" beforeDir="false" afterPath="$PROJECT_DIR$/py.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/soil.py" beforeDir="false" afterPath="$PROJECT_DIR$/soil.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tractor.py" beforeDir="false" afterPath="$PROJECT_DIR$/tractor.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -86,6 +89,7 @@
|
|||||||
<workItem from="1616515878589" duration="110000" />
|
<workItem from="1616515878589" duration="110000" />
|
||||||
<workItem from="1616517453952" duration="124000" />
|
<workItem from="1616517453952" duration="124000" />
|
||||||
<workItem from="1616517732434" duration="704000" />
|
<workItem from="1616517732434" duration="704000" />
|
||||||
|
<workItem from="1616874983490" duration="2052000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@ -93,22 +97,22 @@
|
|||||||
<option name="version" value="1" />
|
<option name="version" value="1" />
|
||||||
</component>
|
</component>
|
||||||
<component name="WindowStateProjectService">
|
<component name="WindowStateProjectService">
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1616518442382">
|
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1616877053760">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
|
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1616877053760" />
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1616518442382">
|
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1616877053760">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
|
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1616877053760" />
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1616518442382">
|
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1616877053760">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
|
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1616877053760" />
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1616518442382">
|
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1616877053760">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
|
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616877053760" />
|
||||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1616326478876">
|
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1616326478876">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
@ -125,12 +129,12 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616326478875" />
|
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616326478875" />
|
||||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1616517731968">
|
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1616874983207">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1616517731968" />
|
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1616874983207" />
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/SmartTractor$py.coverage" NAME="py Coverage Results" MODIFIED="1616518408138" 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="1616876630669" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,6 +12,7 @@ WIDTH, HEIGHT = 1000, 1000
|
|||||||
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
||||||
TRACTOR = pygame.image.load(os.path.join('resources', 'tractor.png'))
|
TRACTOR = pygame.image.load(os.path.join('resources', 'tractor.png'))
|
||||||
TRACTOR = pygame.transform.scale(TRACTOR, (BLOCK_SIZE, BLOCK_SIZE))
|
TRACTOR = pygame.transform.scale(TRACTOR, (BLOCK_SIZE, BLOCK_SIZE))
|
||||||
|
TRACTOR_FERTILIZER = 2
|
||||||
WHEAT_GROW_TIME = 5
|
WHEAT_GROW_TIME = 5
|
||||||
WHEAT_MAXIMUM_STATE = 21
|
WHEAT_MAXIMUM_STATE = 21
|
||||||
WHEATSTAGE1 = pygame.image.load(os.path.join('resources', 'wheat_stage1.png'))
|
WHEATSTAGE1 = pygame.image.load(os.path.join('resources', 'wheat_stage1.png'))
|
||||||
|
7
fertilizer.py
Normal file
7
fertilizer.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class Fertilizer:
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
def get_name(self):
|
||||||
|
return self.name
|
||||||
|
def set_name(self, name):
|
||||||
|
self.name = name
|
7
plant.py
7
plant.py
@ -1,6 +1,11 @@
|
|||||||
class Plant:
|
class Plant:
|
||||||
def __init__(self, state):
|
def __init__(self, name, state):
|
||||||
|
self.name = name
|
||||||
self.state = state
|
self.state = state
|
||||||
|
def get_name(self):
|
||||||
|
return self.name
|
||||||
|
def set_name(self, name):
|
||||||
|
self.name = name
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
return self.state
|
return self.state
|
||||||
def set_state(self, state):
|
def set_state(self, state):
|
||||||
|
22
py.py
22
py.py
@ -12,8 +12,8 @@ def create_base_map():
|
|||||||
temp_map_field = []
|
temp_map_field = []
|
||||||
for j in range(10):
|
for j in range(10):
|
||||||
temp_rect = pygame.Rect(i * definitions.BLOCK_SIZE, j * definitions.BLOCK_SIZE, definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
temp_rect = pygame.Rect(i * definitions.BLOCK_SIZE, j * definitions.BLOCK_SIZE, definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
||||||
temp_soil = soil.Soil(False, False)
|
temp_soil = soil.Soil(None, False, False)
|
||||||
temp_plant = plant.Plant(0)
|
temp_plant = plant.Plant("wheat", 0)
|
||||||
temp_field = field.Field(temp_plant, temp_rect, temp_soil)
|
temp_field = field.Field(temp_plant, temp_rect, temp_soil)
|
||||||
temp_map_field.append(temp_field)
|
temp_map_field.append(temp_field)
|
||||||
fields.append(temp_map_field)
|
fields.append(temp_map_field)
|
||||||
@ -22,15 +22,15 @@ def fill_map():
|
|||||||
for j in range(10):
|
for j in range(10):
|
||||||
field = fields[i][j]
|
field = fields[i][j]
|
||||||
rect = field.get_rect()
|
rect = field.get_rect()
|
||||||
if field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME:
|
if field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME:
|
||||||
block = definitions.WHEATSTAGE1
|
block = definitions.WHEATSTAGE1
|
||||||
elif field.get_plant().get_state() > 1 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.WHEAT_GROW_TIME:
|
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 1 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.WHEAT_GROW_TIME:
|
||||||
block = definitions.WHEATSTAGE2
|
block = definitions.WHEATSTAGE2
|
||||||
elif field.get_plant().get_state() > 2 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.WHEAT_GROW_TIME:
|
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 2 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.WHEAT_GROW_TIME:
|
||||||
block = definitions.WHEATSTAGE3
|
block = definitions.WHEATSTAGE3
|
||||||
elif field.get_plant().get_state() > 3 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 4 * definitions.WHEAT_GROW_TIME:
|
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 3 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 4 * definitions.WHEAT_GROW_TIME:
|
||||||
block = definitions.WHEATSTAGE4
|
block = definitions.WHEATSTAGE4
|
||||||
elif field.get_plant().get_state() == 4 *definitions.WHEAT_GROW_TIME + 1:
|
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() == 4 *definitions.WHEAT_GROW_TIME + 1:
|
||||||
block = definitions.WHEATSTAGE5
|
block = definitions.WHEATSTAGE5
|
||||||
elif field.get_soil().get_state() is False:
|
elif field.get_soil().get_state() is False:
|
||||||
block = definitions.DIRT
|
block = definitions.DIRT
|
||||||
@ -48,8 +48,9 @@ def do_work(tractor1_rect):
|
|||||||
elif field.get_soil().get_state() is True and field.get_soil().get_water_level() is False:
|
elif field.get_soil().get_state() is True and field.get_soil().get_water_level() is False:
|
||||||
field.get_soil().set_water_level(True)
|
field.get_soil().set_water_level(True)
|
||||||
elif field.get_plant().get_state() == 0:
|
elif field.get_plant().get_state() == 0:
|
||||||
|
field.get_plant().set_name("wheat")
|
||||||
field.get_plant().set_state(1)
|
field.get_plant().set_state(1)
|
||||||
elif field.get_plant().get_state() == definitions.WHEAT_MAXIMUM_STATE:
|
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() == definitions.WHEAT_MAXIMUM_STATE:
|
||||||
field.get_plant().set_state(0)
|
field.get_plant().set_state(0)
|
||||||
field.get_soil().set_water_level(False)
|
field.get_soil().set_water_level(False)
|
||||||
field.get_soil().set_state(False)
|
field.get_soil().set_state(False)
|
||||||
@ -61,7 +62,7 @@ def grow_plants():
|
|||||||
for i in range(10):
|
for i in range(10):
|
||||||
for j in range(10):
|
for j in range(10):
|
||||||
field = fields[i][j]
|
field = fields[i][j]
|
||||||
if field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.WHEAT_MAXIMUM_STATE:
|
if field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.WHEAT_MAXIMUM_STATE:
|
||||||
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
||||||
def is_move_allowed(move, tractor1_rect):
|
def is_move_allowed(move, tractor1_rect):
|
||||||
if ((move == 1) and (tractor1_rect.y + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.HEIGHT)):
|
if ((move == 1) and (tractor1_rect.y + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.HEIGHT)):
|
||||||
@ -100,7 +101,8 @@ def tractor1_handle_movement(tractor1, tractor1_rect):
|
|||||||
loop = False
|
loop = False
|
||||||
def main():
|
def main():
|
||||||
create_base_map()
|
create_base_map()
|
||||||
tractor1 = tractor.Tractor(0, 0)
|
fertilizer_dict = {"beetroot": definitions.TRACTOR_FERTILIZER, "carrot": definitions.TRACTOR_FERTILIZER, "potato": definitions.TRACTOR_FERTILIZER, "wheat": definitions.TRACTOR_FERTILIZER}
|
||||||
|
tractor1 = tractor.Tractor(fertilizer_dict, 0, 0)
|
||||||
tractor1_rect = pygame.Rect(tractor1.get_x(), tractor1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
tractor1_rect = pygame.Rect(tractor1.get_x(), tractor1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
run = True
|
run = True
|
||||||
|
7
soil.py
7
soil.py
@ -1,7 +1,12 @@
|
|||||||
class Soil:
|
class Soil:
|
||||||
def __init__(self, state, water_level):
|
def __init__(self, fertilizer, state, water_level):
|
||||||
|
self.fertilizer = fertilizer
|
||||||
self.state = state
|
self.state = state
|
||||||
self.water_level = water_level
|
self.water_level = water_level
|
||||||
|
def get_fertilizer(self):
|
||||||
|
return self.fertilizer
|
||||||
|
def set_fertilizer(self, fertilizer):
|
||||||
|
self.fertilizer = fertilizer
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
return self.state
|
return self.state
|
||||||
def set_state(self, state):
|
def set_state(self, state):
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
import definitions
|
import definitions
|
||||||
class Tractor:
|
class Tractor:
|
||||||
def __init__(self, x, y):
|
def __init__(self, fertilizer, x, y):
|
||||||
|
self.fertilizer = fertilizer
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
def get_fertilizer(self):
|
||||||
|
return self.fertilizer
|
||||||
|
def set_fertilizer(self, fertilizer):
|
||||||
|
self.fertilizer = fertilizer
|
||||||
def get_x(self):
|
def get_x(self):
|
||||||
return self.x
|
return self.x
|
||||||
def set_x(self, x):
|
def set_x(self, x):
|
||||||
|
Loading…
Reference in New Issue
Block a user