From 510be39b90ecca83a77f7b7d011e99dbd1c92659 Mon Sep 17 00:00:00 2001 From: Marcin Dobrowolski Date: Mon, 8 Jun 2020 18:05:05 +0200 Subject: [PATCH] Marcin Dobrowolski subproject v2 --- main.py | 58 ++++++++-------- resources/images/guest-back.png | Bin 0 -> 1247 bytes resources/images/guest-front.png | Bin 0 -> 1330 bytes resources/images/guest-left.png | Bin 0 -> 1410 bytes resources/images/guest-right.png | Bin 0 -> 1403 bytes src/__pycache__/graphics.cpython-38.pyc | Bin 2025 -> 2874 bytes src/__pycache__/waiter.cpython-38.pyc | Bin 4544 -> 4826 bytes src/graphics.py | 26 +++++++- src/guest.py | 85 ++++++++++++++++++++++++ src/waiter.py | 11 ++- 10 files changed, 146 insertions(+), 34 deletions(-) create mode 100644 resources/images/guest-back.png create mode 100644 resources/images/guest-front.png create mode 100644 resources/images/guest-left.png create mode 100644 resources/images/guest-right.png create mode 100644 src/guest.py diff --git a/main.py b/main.py index 4f17296..0a1c713 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ from src.SubprojectMaksymilianKierski.PlateRecognition import use_model_to_predi # Marcin Dobrowolski from src.SubprojectMarcinDobrowolski.suggestionDecisionTree import * from src.SubprojectMarcinDobrowolski.utility import generateTestData, generateTestExample +from src.guest import * if __name__ == "__main__": # SETUP @@ -28,6 +29,8 @@ if __name__ == "__main__": # Marcin Dobrowolski suggestionTreeRoot = SuggestionTree.buildTree(trainingData) + newGuests = [] + actions = [] # Maksymilian go = 0 @@ -92,41 +95,22 @@ if __name__ == "__main__": # Marcin Dobrowolski if event.key == pygame.K_0: - generateTestData('testData.csv', 100) - testData = [] - with open('src/SubprojectMarcinDobrowolski/Data/testData.csv') as csv_file: - csvReader = csv.reader(csv_file, delimiter=',') - lineCount = 0 - - for row in csvReader: - example = [] - for column in row: - if column.isdigit(): - example.append(int(column)) - else: - example.append(column) - if lineCount > 0: - testData.append(example) - lineCount += 1 - - print('Processed lines: ', lineCount) - - print('Test examples predictions:') - for example in testData: - print('{} - {}'.format(example, SuggestionTree.classify( - example, suggestionTreeRoot).printLeaf())) + newGuests.append(Guest(graphics)) # Marcin Dobrowolski if event.key == pygame.K_1: - example = generateTestExample() + guest = newGuests[0] + goal = [0, 0] - print('Test example prediction: ') - print('{} - {}'.format(example, SuggestionTree.classify( - example, suggestionTreeRoot).printLeaf())) + if guest.cord[0] == 2 or guest.cord[1] == 9: + goal[0] = guest.cord[0] - 1 + goal[1] = guest.cord[1] + else: + goal[0] = guest.cord[0] + 1 + goal[1] = guest.cord[1] - # Marcin Dobrowolski - if event.key == pygame.K_2: - SuggestionTree.printTree(suggestionTreeRoot) + actions.append(('takeOrder', goal)) + print(actions) # AStar if event.key == pygame.K_r: @@ -144,10 +128,24 @@ if __name__ == "__main__": path = waiter.translatePath(path) # AStar + if path == '' and actions: + print('Goal: {}'.format(actions[0][1])) + path = waiter.findPath(actions[0][1]) + print('Path: {}'.format(path)) + path = waiter.translatePath(path) + print('Translated path: {}'.format(path)) + if path != '': nextStep = path[0] path = path[1:] waiter.travel(nextStep, graphics) + if path == '': + action = actions.pop(0) + if action[0] == 'takeOrder': + guest = newGuests.pop(0) + waiter.takeOrder(suggestionTreeRoot, guest) + graphics.clearGuest(guest) + tables.append(guest.cord) pygame.display.flip() clock.tick(graphics.fps) diff --git a/resources/images/guest-back.png b/resources/images/guest-back.png new file mode 100644 index 0000000000000000000000000000000000000000..6b35d60dc897a76f52643caa8c2a1ae62cd171cd GIT binary patch literal 1247 zcmV<51R(o~P)EX>4Tx04R}tkv&MmKp2MKrfQ{B94si}kfAzR5EXIMDionYs1;guFuC+cXws0R zxHt-~1qXi?s}3&Cx;nTDg5VE`lcSTOi%UeQG}3<3Qzvy53uO2K!0-6O#FyExDCulsZKsCkP40g-ry8KzCVPCT_~ z8=UuvqpT#W#OK7LCS8#Dk?V@bZ=8!R3p_JwX3}%SQDU*!#!4HrlBp3-630|cr+gvn zvC4UivsSLM<~{ifBYAy!iR-k6ki-HOAwh(KDmGAt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y&1ORLML zhI*E@)tRip6bQ$05&((SKY-?$5edK^%Llz!fcQl|u)S?}JpGuaiBhRFA0U2_A3P{L z)*+7gi7HVd0r89cBo%0Uu2-gFdwlR~PlJGb`1}Q%TW>rw6?DHWY+-Y<-*fZikls@A QN&o-=07*qoM6N<$g7U|Ub^rhX literal 0 HcmV?d00001 diff --git a/resources/images/guest-right.png b/resources/images/guest-right.png new file mode 100644 index 0000000000000000000000000000000000000000..0b73dde9a49790840db7d1356b309501039d36a7 GIT binary patch literal 1403 zcmV->1%&#EP)EX>4Tx04R}tkv&MmKp2MKrfQ{B94si}kfAzR5EXIMDionYs1;guFuC+cXws0R zxHt-~1qXi?s}3&Cx;nTDg5VE`lcSTOi%UeQG}3<3Qzvy53uO2K!0-6O#FyExDCulsZKsCkP40g-ry8KzCVPCT_~ z8=UuvqpT#W#OK7LCS8#Dk?V@bZ=8!R3p_JwX3}%SQDU*!#!4HrlBp3-630|cr+gvn zvC4UivsSLM<~{ifBYAy!iR-k6ki-HOAwh(KDmGAtjX3Q(DHhUnp78Mxx_*gV3b{7G z$T5!!G{~+W{11Nj)+$Vldr6T5(D~vxAHzUs7iiQR=lj@k8Ye*T8MxA0{z@H~{v^HD z(qczI?>2C8-O`jj;Bp5Tcrs*DcBLRKp-=$c&*+D00N;ahY_xr11^@s624YJ`L;(K){{a7>y{D4^000SaNLh0L z01FcU01FcV0GgZ_00007bV*G`2jm6@3J@P5cf&dW00VbPL_t(&-tAdEYuiv1Ju0T2 zWM>Eo)Tycj6lfq>vbMw^{Rrc={tu>ItSl}559%87Bc8y)UbVDa1&L6sK#UV&n*@|a z9V{ubEjjwKoHoAj2FdST={%i#@43&w%2u|rtV{%8MHph552w-sAxY8^%d+LL3p7n@ z)oQgf`?6(^rJF?vv7#6uWMN+?Hl3212UKi(lax+`ki@&eaU5(vB7pLXr_*zmgl2F4 zmy{U?NEv`g2m!}&slE&$1d=2jWflCX1bEtk|Ej6A0ba>?t3?PA>(vUn7w7+W`c-;;5Z$2a)ylEJlt6R?O0N%!qCinp=m4Fe(&ZJDUO(2_ zT%1MM-7b_)dxB;F&^$REPgvi8J{(P~VG4ARbjQ$q#GPqE>9ld(?Y01%W!mZz-2hjl z@u66-nkT0?{Pa0EmA-!$_?tc)K^=@BFeLyujw2cq_v{V;fhmaq8s2-MsoH6yUacg0 zpIlNP(=-Fn`1AW$R3EYEl%9mp4d2c&#t_~3%JMi!k|eM!3+#TxwPB!pagKVmA_8ax zfSaHY(GALuhbJ1|-T?hxq}q`<{jx0UR`1PHX(ArDB0Vv1d*e_KTiZKmo}4=IR0iO# z<+j;SiXe4W>c|mi1a*#1$47L-9o|C*A3xcAktDr3SET2r;i%F*5fGl|V@Y(bNMkLZ z59Oa_*=#$+C~|};&~ERN#7|-%k|a$?ifIXwxE|dn%~W@$33ZSzkna5h z)WHZ$fd<1ck?H$-Pf_&Y2)E|rY&o|q(XuSck@C*4CI56+NZIp!{SSTor>?caQ0mLq zZ`j>G0012B?Trg#1pizSfr%k8kSNk&cmLq2Vi)O|Uc}FA^&8uAi{R_w#`?2`??tq_ z^XkgnqUiZUhoY!*n$ONa8);Uoq?ktZZc&+FysA<*v)&$OQlZ002ov JPDHLkV1nV{jy3=Q literal 0 HcmV?d00001 diff --git a/src/__pycache__/graphics.cpython-38.pyc b/src/__pycache__/graphics.cpython-38.pyc index e6722a1f00689f7824a33f3680911a21d7887905..7162ce5add7f35a2212894dbf827875236d7f070 100644 GIT binary patch literal 2874 zcmc&#OOG2x5bmCr$KJK~nd}Cl0O3Fk#10Q31Q7}l6mhYTqKGg8Mzhmx?|5ftygg$! zYk5z}PvFSGD{Gn0UIU9_4gs%uH^bQO{Pq!)<1q8D8xXVJ5R)5N16$JeSeO zq-|e-2GW~scRF3cvve#%o^_+cU;tf+bBmt=-~lwXFDD*l#4{LW#tY(^TDNC0n>m1O zR%0&o4y&^U^fk7^R-t!U6ZUOM_mK!j`%##MbYTnRx1oKFyL=2NCqp_ja+A>=az;yJ zRFGLgRt5droL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zcmZ8g&rcIU6yDiio$W7LsEU9V0z?-h;h=;>#i$@8VvT|!sfn@OnU*bWw|Tn-k1Ck{9zO1*pCQ-%XJm*({cSQAHRV8cd9?)8KP0og z3Dm@dE{-6PB+4*5wdSnxO#892 zOo-usQ2VppD209mQ-K~F@-e&adeF2y+o|Ke7)AAFgB3j9=l@o7JEGW=OK^%$So{bQ zPhw=BY{?bbQ}$IcZjl3dUptTv1 z|E+a?7=chE zK&{xV6AMCO;Xkkt0}BJn#=wX-7XAXn!oquY1)TN1d-vV<-ralWZ0S?O-KbP-hGY5o zm#y(a;?BX<XWhb-g~8<+!rpm(g$3dJGoh!F0upp-nRC$DR8J$b*rf@?41 zo85jK$z6@o9S!mgv}drKP^YddAY@BZq}W!w!wo-L*-PX8s!a|Fo!MjPfY4wBYENzyCHykk0f ec_ft}=|7WY0yRol&B~oY(IL72N7XJae#dUK4 diff --git a/src/graphics.py b/src/graphics.py index e954cb5..a52c88a 100644 --- a/src/graphics.py +++ b/src/graphics.py @@ -21,7 +21,13 @@ class Graphics: 'chair_front': pygame.image.load(relative_path + 'chair-front.png'), 'chair_back': pygame.image.load(relative_path + 'chair-back.png'), 'chair_left': pygame.image.load(relative_path + 'chair-left.png'), - 'chair_right': pygame.image.load(relative_path + 'chair-right.png') + 'chair_right': pygame.image.load(relative_path + 'chair-right.png'), + # + 'guest_front': pygame.image.load(relative_path + 'guest-front.png'), + 'guest_back': pygame.image.load(relative_path + 'guest-back.png'), + 'guest_left': pygame.image.load(relative_path + 'guest-left.png'), + 'guest_right': pygame.image.load(relative_path + 'guest-right.png') + } self.fps = 2 self.block_size = 50 @@ -49,3 +55,21 @@ class Graphics: model = 'waiter_' + waiter.direction self.screen.blit( self.image[model], (waiter.X * self.block_size, waiter.Y * self.block_size)) + + def drawGuest(self, guest): + self.clear(guest.cord[0], guest.cord[1] - 1) + self.clear(guest.cord[0], guest.cord[1] + 1) + + self.screen.blit(self.image['guest_front'], + (guest.cord[0] * self.block_size, (guest.cord[1] - 1) * self.block_size)) + self.screen.blit(self.image['guest_back'], + (guest.cord[0] * self.block_size, (guest.cord[1] + 1) * self.block_size)) + + def clearGuest(self, guest): + self.clear(guest.cord[0], guest.cord[1] - 1) + self.clear(guest.cord[0], guest.cord[1] + 1) + + self.screen.blit( + self.image['chair_front'], (guest.cord[0] * self.block_size, (guest.cord[1] + 1) * self.block_size)) + self.screen.blit( + self.image['chair_back'], (guest.cord[0] * self.block_size, (guest.cord[1] - 1) * self.block_size)) diff --git a/src/guest.py b/src/guest.py new file mode 100644 index 0000000..7449228 --- /dev/null +++ b/src/guest.py @@ -0,0 +1,85 @@ +import pygame +import random + +from src.matrix import * + + +class Guest(pygame.sprite.Sprite): + def __init__(self, graphics): + pygame.sprite.Sprite.__init__(self) + self.cord = self.randomTable() + self.matrix = Matrix(graphics=graphics) + self.description = self.generateDescription() + graphics.drawGuest(self) + + def randomTable(self): + table = random.choice(tables) + tables.remove(table) + return table + + def generateDescription(self): + example = [] + category = random.randrange(0, 1) + size = random.randrange(0, 2) + if category == 0: + example.append('meat') + + if size == 0: + money = random.randrange(10, 60) + appetite = random.randrange(10, 55) + example.append('little') + example.append(money) + example.append(appetite) + + if size == 1: + money = random.randrange(20, 60) + appetite = random.randrange(10, 55) + if appetite > 40: + if money < 30: + money = random.randrange(30, 60) + example.append('regular') + example.append(money) + example.append(appetite) + + if size == 2: + money = random.randrange(20, 60) + appetite = random.randrange(10, 55) + if appetite > 25 and appetite <= 40: + money = random.randrange(30, 60) + if appetite > 40: + money = random.randrange(50, 60) + example.append('large') + example.append(money) + example.append(appetite) + + elif category == 1: + example.append('vege') + + if size == 0: + money = random.randrange(10, 60) + appetite = random.randrange(10, 55) + example.append('little') + example.append(money) + example.append(appetite) + + if size == 1: + money = random.randrange(20, 60) + appetite = random.randrange(10, 55) + example.append('regular,') + example.append(money) + example.append(appetite) + + if size == 2: + money = random.randrange(20, 60) + appetite = random.randrange(10, 40) + example.append('large,') + example.append(money) + example.append(appetite) + + return example + + +tables = [(2, 3), (2, 6), (2, 9), + (4, 4), (4, 8), + (9, 3), (9, 6), (9, 9), + (11, 4), (11, 8)] diff --git a/src/waiter.py b/src/waiter.py index 5795bd1..d2768e0 100644 --- a/src/waiter.py +++ b/src/waiter.py @@ -2,9 +2,11 @@ import pygame from .matrix import Matrix from .tile import Tile - +from src.SubprojectMarcinDobrowolski.suggestionDecisionTree import * # WAITER + + class Waiter(pygame.sprite.Sprite): def __init__(self, graphics): pygame.sprite.Sprite.__init__(self) @@ -13,7 +15,6 @@ class Waiter(pygame.sprite.Sprite): self.frame = 0 self.matrix = Matrix(graphics=graphics) self.direction = 'E' - self.tile = Tile(self, self.X, self.Y) # Borders def move(self, x, y, graphics): @@ -52,6 +53,10 @@ class Waiter(pygame.sprite.Sprite): self.move(-1, 0, graphics) # print(self.X, self.Y) + def takeOrder(self, tree, guest): + print('{} - {}'.format(guest.description, SuggestionTree.classify( + guest.description, tree).printLeaf())) + # AStar def findPath(self, goal): @@ -242,7 +247,7 @@ class Waiter(pygame.sprite.Sprite): graphics.clear(self.X, self.Y) self.update('L', graphics) graphics.update(self) - + def Node(self): node = [self.X, self.Y] return node