2
2
import time
3
3
from threading import *
4
4
import ExtraWidgits
5
+ import ExtraWidgits_for_Pathfinders
5
6
import StartProcess
6
7
import Rat_In_The_Maze
7
8
RunClock = True
@@ -37,8 +38,10 @@ def StartVisualization(self):
37
38
font = pygame .font .SysFont ('Comic Sans MS' , 23 )
38
39
self .win .blit (font .render ("Click on cells to create wall." , False , (255 , 255 , 255 )), (670 ,50 ))
39
40
self .win .blit (font .render ("Press Space to START" , False , (255 , 255 , 255 )),(700 ,80 ))
40
- AddMainMenuButton = ExtraWidgits .MainMenuButton (self .win ,700 ,300 )
41
+
42
+ AddMainMenuButton = ExtraWidgits_for_Pathfinders .MainMenuButton (self .win ,700 ,300 )
41
43
AddMainMenuButton .start ()
44
+
42
45
AddExitText = ExtraWidgits .ExitText (self .win ,725 ,250 )
43
46
AddExitText .start ()
44
47
self .CheckActions ()
@@ -112,6 +115,7 @@ def make_Wall(self,x,y):
112
115
return
113
116
self .maze [row ][col ]^= 1
114
117
self .print_maze ()
118
+
115
119
def print_maze (self ):
116
120
for y in range (self .n ):
117
121
if (not self .running ):
@@ -127,22 +131,28 @@ def print_maze(self):
127
131
self .win .blit (self .HOME , ((self .n - 1 ) * self .block ,(self .n - 1 ) * self .block ))
128
132
except :
129
133
pass
134
+
130
135
for i in range (self .n ):
131
136
if (not self .running ):
132
137
break
133
- #pygame.draw.rect(self.win,(0,0,0),(self.x_shift+i*self.block,self.y_shift+j*self.block,self.SIDE,10))
134
- #pygame.draw.rect(self.win,(0,0,0),(self.x_shift+i*self.block,self.y_shift+j*self.block,self.SIDE,10))
135
- pygame .draw .line (self .win ,(0 ,0 ,0 ),(0 ,i * self .block ),(self .SIDE ,i * self .block ),2 )
136
- pygame .draw .line (self .win ,(0 ,0 ,0 ),(i * self .block ,0 ),(i * self .block ,self .SIDE ),2 )
138
+
139
+ pygame .draw .line (self .win ,(150 ,150 ,150 ),(0 ,i * self .block ),(self .SIDE ,i * self .block ),2 )
140
+ pygame .draw .line (self .win ,(150 ,150 ,150 ),(i * self .block ,0 ),(i * self .block ,self .SIDE ),2 )
137
141
cur = [0 ,0 ]
142
+
138
143
for i in self .rat_pos [1 :]:
139
144
if (not self .running ):
140
145
break
141
146
pygame .draw .line (self .win , (255 , 0 , 0 ), (self .block // 2 + cur [0 ] * self .block , self .block // 2 + cur [1 ] * self .block ),
142
147
(self .block // 2 + i [0 ] * self .block ,self .block // 2 + i [1 ] * self .block ), 5 )
143
148
cur = i
144
- pygame .draw .line (self .win ,(255 ,0 ,0 ),(self .n * self .block ,0 ),(self .n * self .block ,self .SIDE ),5 )
149
+
150
+ pygame .draw .line (self .win ,(150 ,150 ,150 ),(self .n * self .block ,0 ),(self .n * self .block ,self .SIDE ),5 )
145
151
self .win .blit (self .RAT , (self .IMG_Pading + (self .rat_pos [- 1 ][0 ]) * self .block , self .IMG_Pading + (self .rat_pos [- 1 ][1 ]) * self .block ))
152
+
153
+ update_canvas = pygame .Rect (0 ,0 ,600 ,600 )
154
+ pygame .display .update (update_canvas )
155
+
146
156
def find_way (self ,x ,y ):
147
157
self .operations += 1
148
158
if (not self .running ):
0 commit comments