create addShelf method in Field class
This commit is contained in:
parent
dfe2e50414
commit
8ec5e96e8c
@ -2,10 +2,9 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="828778c9-9d97-422f-a727-18ddbd059b85" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/shelf.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/wozek.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/wozek.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/field.py" beforeDir="false" afterPath="$PROJECT_DIR$/field.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/shelf.py" beforeDir="false" afterPath="$PROJECT_DIR$/shelf.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -123,8 +122,16 @@
|
||||
<workItem from="1589745409339" duration="739000" />
|
||||
<workItem from="1589752301424" duration="1007000" />
|
||||
<workItem from="1589753322316" duration="835000" />
|
||||
<workItem from="1589814601057" duration="822000" />
|
||||
<workItem from="1589814601057" duration="1397000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="create Shelf">
|
||||
<created>1589815443652</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1589815443652</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -143,6 +150,10 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="create Shelf" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="create Shelf" />
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589754127142" 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/wozek$main.coverage" NAME="main Coverage Results" MODIFIED="1589556038208" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
|
6
field.py
6
field.py
@ -1,4 +1,5 @@
|
||||
import pygame
|
||||
from shelf import Shelf
|
||||
|
||||
|
||||
class Field:
|
||||
@ -14,6 +15,7 @@ class Field:
|
||||
self.is_occupied_by_agent = is_occupied_by_agent
|
||||
self.cost_of_travel = cost_of_travel
|
||||
self.neighbors = []
|
||||
self.shelves = []
|
||||
|
||||
# Te parametry są potrzebne do algorytmu A*
|
||||
self.g = 0
|
||||
@ -42,3 +44,7 @@ class Field:
|
||||
self.neighbors.append(board[self.y - 1][self.x])
|
||||
if self.y < 9 and board[self.y + 1][self.x].is_shelf == False:
|
||||
self.neighbors.append(board[self.y + 1][self.x])
|
||||
|
||||
def addShelf(self):
|
||||
shelf = Shelf(len(self.shelves)+1)
|
||||
self.shelves.append(shelf)
|
Loading…
Reference in New Issue
Block a user