From 2a3e6b006a48cb1eb6b108a4974fbce8a546ca1f Mon Sep 17 00:00:00 2001 From: s473561 Date: Thu, 20 Apr 2023 23:16:34 +0200 Subject: [PATCH] modified the bfs search - prints path --- __pycache__/etykieta.cpython-311.pyc | Bin 0 -> 1302 bytes __pycache__/main.cpython-311.pyc | Bin 0 -> 4403 bytes __pycache__/paczka.cpython-311.pyc | Bin 0 -> 2703 bytes __pycache__/regal.cpython-311.pyc | Bin 0 -> 3257 bytes __pycache__/wozek.cpython-311.pyc | Bin 0 -> 3444 bytes __pycache__/wyszukiwanie.cpython-311.pyc | Bin 0 -> 4363 bytes __pycache__/wyszukiwanie1.cpython-311.pyc | Bin 0 -> 4324 bytes main.py | 109 ++++++++++------------ wozek.py | 5 +- wyszukiwanie.py | 32 ++++--- 10 files changed, 72 insertions(+), 74 deletions(-) create mode 100644 __pycache__/etykieta.cpython-311.pyc create mode 100644 __pycache__/main.cpython-311.pyc create mode 100644 __pycache__/paczka.cpython-311.pyc create mode 100644 __pycache__/regal.cpython-311.pyc create mode 100644 __pycache__/wozek.cpython-311.pyc create mode 100644 __pycache__/wyszukiwanie.cpython-311.pyc create mode 100644 __pycache__/wyszukiwanie1.cpython-311.pyc diff --git a/__pycache__/etykieta.cpython-311.pyc b/__pycache__/etykieta.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ddad8891b2c656548728b16cc764e440f69e5dc9 GIT binary patch literal 1302 zcmZ`(&1(}u6o0eXe6%)5Yd?cX1hMYHSWpn8R0=6lEVWQuF{F&!*=gN2+0>m4wIM3T2nsc@z#;|61)SuF2KT_yw!n()Y5;q<1IlR@nFT{XRO&Qqo%#$b_|)u0 zRs#+>VuAACf?UMXFe)Mw6W+$E%{`OFTi%Mra7S=AKOxkhs#Sra6i_vST01vXb=1Oc zs!`Nbq)*itYVEmjo_Eo<jtc0VSIt@K4nDKNw^H3uMc1HYG$g~laalx6( zJt1T4X~||>#)RkE&aymj3TE51ytc+&W(qV|_Ok5>Lz7x&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#i6x7V+&ZC#FJxgQ1L z<~cPh23q#XQtp#CAO5mozaZH!9FIFIrmEwCwPGz>wZ309>?@LeBL6UXgs_o~hofEj?l+x4-W8H{JfC_1NX9uGJimZc47zx@)!RS}j_h z8PNE}N85kC@;9+=4>j$fBH1<|dc2J&^SPGG(?*1CQO(N4@wltZRHD^O4_|p;uh`3w z;0?>)uT9qJ^G*7^r2d}J4ryY!PM>YkXC?aV3Ff$9Uj7ni#lSH=Q3@W>^9_2w8m-gI zO?p|Pms{@HN~{p(x)u1S`REQ0qI>aIQ+u)yIJ^uKmOP_l3sg8`9+)1IVwQS&+^7Veo@s)zUQ= z?87ae7;7_i+SjCg6773tLN>6vN>ndZnVO>y>-dhX;H&S*02A;H4F8Q+S6!?Ay0%oO z&o$|D5`C`2Fj{MecQov`;XR=pA7209`u$KTR17_VC9-iuFEr?dI=$4Smn0gjUHbC3 z1Z<+Gu)C0KibU{!i$uI`;Vd)=XK;q28aUnH%W9huF5?#UytDOxxm{9Etj^hmPcfO~ zQ@kkr0E?z9Cq|NKmJ?QRl~TXKWHOOvSm7dWv0^}!$%uR!jx+pi*3rR|y7#eRDL7jr zkx!BEV^9%(1liZ7*MM~=!Tm(I4pn?BWUY|5^#nn*kfore7P1x8)IxMYO?@p>5*qlO zprG{P-wCo74ExsiZTmpjGTTdMj?9Y<^CGNiv#)9P6$~xQc*%EUnQd5RrMVy0Ew45$ zuNI6a$gn?lgk~COMw(r%BYzY5CFE}zZTtBn<8;F~EqT6IH?A~|D+RLE0Z%p1RF$lw x`6il|(0tplMi9$w)R(`ZLnK|yHS``y?`e^y!utEK@4sG9Q(KS78E96W^&i19Z$1D3 literal 0 HcmV?d00001 diff --git a/__pycache__/paczka.cpython-311.pyc b/__pycache__/paczka.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43bec40fc68fd01dccf72a6e47e1d8089d3379d1 GIT binary patch literal 2703 zcmbtW&2JM&6rZ(sZO2{{0CFR$N{BP>48HJNc|^l%M#W|k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cHMX|dTC7IST3G7RXawnrE8WegC;}WBeaj}@ASW6kgw~#RcDBu3o`4i4yog73B zeq;>@6d!ObnON>L1a>NU?w)Pz=pA|<7USc>_z+Ot!Es!bc=PO6cZ-}{CvD^txuZC2 UBHu|4_Hq#YigUjmLSUQx9i~mM`2YX_ literal 0 HcmV?d00001 diff --git a/__pycache__/wozek.cpython-311.pyc b/__pycache__/wozek.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0edd47b50c410397fc1b14f89b6039c96742067d GIT binary patch literal 3444 zcmbVO(Qng67(XX=>LzKr(x!ANBMD_`Lkk0js9HgQ^Yg3IOecX!`? z_ucQl@4kE4(cwi<{(gCd|Dp|{KXJnqtN#i;^y$c!-j2tSd>*q9nz;lOCRgRvS+NrFjp~ zcD@a$m#0B@yH0(ZEeQ*pr4Z|NH~zc78_IcN2{E|eC`QYc=3Ovm8*H@jY*W$=W7d{o zbI_u!G1YHz2+adbX4#}IuKCN8FJQebdri<|&saj6?ai_l{{omTtAPlB8a7KMc1EF3 z#`f-v0eRb-&aktB@>wpgs70oLkvNr;X5(I+Sk#H4PA@Xt94pNVI$g9l&zz8+ol|wH zkml7n-IFWMvKc|A3{^TQW?5d3G6t#)Q)1Innw!thGm6SeOfJinSal&=D8>n$R0Q#^ zg0~fUo8&I0ZYzSUq{b(vrc&csE}s!3RY}dUa2IXG4gj^X~g2eo&+riUu@P?*e zCk!uuQ}8I9EC^D(O(!#OSaKgs)5$wxT9rS-tT%f{;H2UV9G{F`O~&CJcgfwD$HEG> zHxiM1;G>hg%oa*s6KBjH!V;H(0LFA!bJjO>;EC_CZ*BbP*PA`h!`0~7SL45ZQ$07K zMZPN2lT~_Bv#Q(+I(G2doQ(rCFmE8a2+TTC?I1ybWJ}n%7C;7!J`5N)$r+snSwhYk zCRVDAFoKiXPa^J0l-jQiW+Hd1c}$FoSc?a=xq~3@L@^S+Y~h` zL)__fhFxTobV*R~9wHWqK9=X1hH$CN#ImWYA7mSlZuIhHLDt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_fwmGmzXf<3Mjo?k)5~oZfHw zHZkLLG|S&!IZd0H_#!#tB$^iPQrm*u5573zrgGfrvYJ9y?_B+KEm1UZ^&D z_DQlj`r*@w>d0g@_Hixtap|+?eFtr7PuPXKW^LrmlP{_xA3Pna4*$B^H(BeOEKP6w z!`IE4f6z`o^N&>gBU^!B`HLIAGA+|B_}E}Acx0143yxKSWB(^}wsDEn3G|B?MsRSdxX(Rn+X71;mHH?FfIQrCWCNl$*j zy~PE$7>ft__27txo_9nH4Su=fZRFnYVp7w1oUqe?iwB(^ytR~ERyC9PrR>V86X6Ig ztLkZ(vI$^wx^qw$tQh91;s&(uGD~5l9Lj1dDP1$O8J%JM!E=HW%7CEDX#@ewqjfK0 zhg<)pD8`j6%fr7Ms0;H~luMTlmH?4oLN~Sml*se`LHmCt;n57S>EnCwDyS&0dqI~tm{Oj>%@a1l!N0x zp7`+>&rZ)&PS0%h4OPNJ+kpe$b>Hk>FWfP`koYM!Y!^1u)!5lu>@1XY!Ep}CQ(HZK z_D7YTariwSI=cD(U%$Tl^?C?D9Jw8_7pu{DEgG*x<6F_ejqcmscD@=tUW*>DM34Ws zewcLi@^#h+NqC?l^}CmR-0yU$*>qZ0^QmmcVCeU5op}sL{JO`a#%;2%7= 916: - wozek.x = 916 - if wozek.y <= 0: - wozek.y = 0 - elif wozek.x >= 916: - wozek.x = 916 + # idRegału, Długość regału podana w kratkach, Współrzędne od których ma być tworzony regał (wiersz,kolumna) - poziomo + # Współrzędne od (1,1) do (10,10) + regal.Regal(1, 1, 2, 2) + regal.Regal(2, 1, 2, 3) + regal.Regal(3, 1, 3, 2) + regal.Regal(4, 1, 3, 3) + + regal.Regal(5, 1, 8, 2) + regal.Regal(6, 1, 8, 3) + regal.Regal(7, 1, 9, 2) + regal.Regal(8, 1, 9, 3) - # Drawing - screen.fill((51, 51, 51)) # removes object trail - screen.blit(miejsce, (430, 400)) + regal.Regal(9, 1, 2, 8) + regal.Regal(10, 1, 2, 9) + regal.Regal(11, 1, 3, 8) + regal.Regal(12, 1, 3, 9) - # idRegału, Długość regału podana w kratkach, Współrzędne od których ma być tworzony regał (wiersz,kolumna) - poziomo - # Współrzędne od (1,1) do (10,10) - regal.Regal(1, 1, 2, 2) - regal.Regal(2, 1, 2, 3) - regal.Regal(3, 1, 3, 2) - regal.Regal(4, 1, 3, 3) + regal.Regal(13, 1, 8, 8) + regal.Regal(14, 1, 8, 9) + regal.Regal(15, 1, 9, 8) + regal.Regal(16, 1, 9, 9) - regal.Regal(5, 1, 8, 2) - regal.Regal(6, 1, 8, 3) - regal.Regal(7, 1, 9, 2) - regal.Regal(8, 1, 9, 3) + wozek.draw() - regal.Regal(9, 1, 2, 8) - regal.Regal(10, 1, 2, 9) - regal.Regal(11, 1, 3, 8) - regal.Regal(12, 1, 3, 9) - - regal.Regal(13, 1, 8, 8) - regal.Regal(14, 1, 8, 9) - regal.Regal(15, 1, 9, 8) - regal.Regal(16, 1, 9, 9) - - wozek.draw() - - pygame.display.flip() # updating frames + pygame.display.flip() # updating frames if __name__ == "__main__": main() + diff --git a/wozek.py b/wozek.py index a80f19c..880c081 100644 --- a/wozek.py +++ b/wozek.py @@ -1,7 +1,5 @@ import pygame - - # screen nie działa class Wozek(): @@ -51,7 +49,8 @@ class Wozek(): def __zainicjuj_stan_poczatkowy(self): from wyszukiwanie import Stan - self.obecnyStan = Stan(55, 55, 3) + # self.obecnyStan = Stan(55, 55, 3) + self.obecnyStan = Stan(0, 0, 3) # def ustaw_wozek_w_kierunku(self, kierunek): # TODO diff --git a/wyszukiwanie.py b/wyszukiwanie.py index 9c1e4ee..bdd5101 100644 --- a/wyszukiwanie.py +++ b/wyszukiwanie.py @@ -1,17 +1,25 @@ +class SearchSpace: + def __init__(self): + self.grid = [['1']*10 for _ in range(10)] # create a 10x10 grid of cells + for r, c in [(2,2), (2,3), (3,2), (3,3), (8,2), (8,3), (9,2), (9,3), + (2,8), (2,9), (3,8), (3,9), (8,8), (8,9), (9,8), (9,9)]: + self.grid[r][c] = 'X' # set the cells with a shelf to not passable + + def is_passable(self, x, y): + return 0 <= x < 10 and 0 <= y < 10 and self.grid[y][x] != 'X' + class Stan: def __init__(self, x, y, kierunek): self.x = x self.y = y self.kierunek = kierunek - class Wezel: def __init__(self, stan): self.stan = stan - -def poprzednik(wezel): - # gora -> prawo -> dol -> lewo | obrot w prawo +def poprzednik(wezel, search_space): + # gora -> prawo -> dol -> lewo | obrot w prawo # gora -> lewo -> dol -> prawo | obrot w lewo # 0 gora 1 prawo 2 dol 3 lewo y = wezel.stan.x @@ -37,23 +45,23 @@ def poprzednik(wezel): return wezly - -def wyszukiwanie_bfs(stan_poczatkowy, stan_docelowy): +def wyszukiwanie_bfs(stan_poczatkowy, stan_docelowy, search_space): pierwszy_wezel = Wezel(stan_poczatkowy) fringe = [pierwszy_wezel] - - odwiedzone = list() + + odwiedzone = set() while fringe: - # kolejka wezel = fringe.pop(0) if stan_docelowy.x == wezel.stan.x and stan_docelowy.y == wezel.stan.y: return odwiedzone - odwiedzone.append(wezel) + odwiedzone.add(wezel.stan) - for stan in poprzednik(wezel): - if wezel not in fringe and stan not in odwiedzone: + for stan in poprzednik(wezel, search_space): + if stan not in odwiedzone: nowy_wezel = Wezel(stan) fringe.append(nowy_wezel) + odwiedzone.add(stan) + return odwiedzone