Dodano dfs ver1 nie dziala

This commit is contained in:
Arkadiusz 2019-04-17 21:08:51 +01:00
parent a1f3a28daf
commit 0d08833189
4 changed files with 67 additions and 34 deletions

View File

@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="152ea650-8e02-4ed6-aa8c-04d44b275be4" 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$/game.py" beforeDir="false" afterPath="$PROJECT_DIR$/game.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/waiter.py" beforeDir="false" afterPath="$PROJECT_DIR$/waiter.py" afterDir="false" />
</list>
@ -23,11 +22,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/game.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1218">
<caret line="58" column="66" selection-start-line="58" selection-start-column="66" selection-end-line="58" selection-end-column="66" />
<state relative-caret-position="203">
<caret line="49" column="9" selection-start-line="49" selection-start-column="9" selection-end-line="49" selection-end-column="9" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
@ -47,8 +46,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="63">
<caret line="3" selection-start-line="3" selection-end-line="3" />
<state relative-caret-position="294">
<caret line="14" column="15" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
</state>
</provider>
</entry>
@ -74,11 +73,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="98">
<caret line="192" column="16" selection-start-line="192" selection-start-column="16" selection-end-line="192" selection-end-column="16" />
<state relative-caret-position="1022">
<caret line="246" column="42" lean-forward="true" selection-start-line="246" selection-start-column="42" selection-end-line="246" selection-end-column="42" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
@ -114,8 +113,8 @@
<option value="$PROJECT_DIR$/table.py" />
<option value="$PROJECT_DIR$/orderTable.py" />
<option value="$PROJECT_DIR$/pool.py" />
<option value="$PROJECT_DIR$/game.py" />
<option value="$PROJECT_DIR$/waiter.py" />
<option value="$PROJECT_DIR$/game.py" />
</list>
</option>
</component>
@ -384,13 +383,6 @@
<entry file="file://$PROJECT_DIR$/Images/tlo.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="63">
<caret line="3" selection-start-line="3" selection-end-line="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pool.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
@ -401,6 +393,13 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gridElement.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="14" column="59" lean-forward="true" selection-start-line="14" selection-start-column="59" selection-end-line="14" selection-end-column="59" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/orderTable.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
@ -408,10 +407,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gridElement.py">
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="14" column="59" lean-forward="true" selection-start-line="14" selection-start-column="59" selection-end-line="14" selection-end-column="59" />
<caret line="14" column="15" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
</state>
</provider>
</entry>
@ -422,25 +421,25 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/game.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1218">
<caret line="58" column="66" selection-start-line="58" selection-start-column="66" selection-end-line="58" selection-end-column="66" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="98">
<caret line="192" column="16" selection-start-line="192" selection-start-column="16" selection-end-line="192" selection-end-column="16" />
<state relative-caret-position="1022">
<caret line="246" column="42" lean-forward="true" selection-start-line="246" selection-start-column="42" selection-end-line="246" selection-end-column="42" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/game.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="203">
<caret line="49" column="9" selection-start-line="49" selection-start-column="9" selection-end-line="49" selection-end-column="9" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

Binary file not shown.

View File

@ -47,7 +47,7 @@ class Game(object):
if i == self.x-1:
self.grid.append(list(self.row))
self.row.clear()
#self.waiter.dfsFind(self, self.waiter.lastStep, 1)
while True:
for event in pygame.event.get():

View File

@ -206,8 +206,42 @@ class Waiter(object):
return self.stackMove
def dfsFind(self, game, currentOperation):
def dfsFind(self, game, currentOperation, idTable):
self.game = game
self.grid = game.grid
self.currentOperation = currentOperation
print("Sprawdzam czy stolik")
if self.isMoveInRange("Up"):
if self.grid[self.positionY - 1][self.positionX].type == "table":
if self.grid[self.positionY - 1][self.positionX].id == idTable:
return self.currentOperation
if self.isMoveInRange("Down"):
if self.grid[self.positionY + 1][self.positionX].type == "table":
if self.grid[self.positionY + 1][self.positionX].id == idTable:
return self.currentOperation
if self.isMoveInRange("Left"):
if self.grid[self.positionY][self.positionX - 1].type == "table":
if self.grid[self.positionY][self.positionX - 1].id == idTable:
return self.currentOperation
if self.isMoveInRange("Right"):
if self.grid[self.positionY][self.positionX + 1].type == "table":
if self.grid[self.positionY][self.positionX + 1].id == idTable:
return self.currentOperation
print("Sprawdzilem nie stolik")
steps = []
steps.append(self.checkPoss(self.game, self.currentOperation))
step = steps[-1]
if step == "Left":
self.moveLeft(self.game)
self.currentOperation.append("Left")
if step == "Right":
self.moveRight(self.game)
self.currentOperation.append("Right")
if step == "Up":
self.moveUp(self.game)
self.currentOperation.append("Up")
if step == "Down":
self.moveDown(self.game)
self.currentOperation.append("Down")
game.draw()
self.dfsFind(self.game, self.currentOperation, idTable)