From 30a9343c0863385c2441eba1d63da5a643b12ddd Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Sun, 10 May 2020 17:32:22 +0200 Subject: [PATCH 01/10] Delete README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 61a674b..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# WD2020 -Data visualisation classes zmiana 1 zmiana 222 zmiana 333 From ea893175feea64e493eabbe9d75d65de66dd0a54 Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Sun, 10 May 2020 17:41:55 +0200 Subject: [PATCH 02/10] Add files via upload --- owoce.txt | 10 +++++ robaczek.py | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 owoce.txt create mode 100644 robaczek.py diff --git a/owoce.txt b/owoce.txt new file mode 100644 index 0000000..b27adf3 --- /dev/null +++ b/owoce.txt @@ -0,0 +1,10 @@ +1,1, +2,2, +3,3, +4,4, +5,5, +6,6, +1,9, +3,8, +9,3, +7,4, \ No newline at end of file diff --git a/robaczek.py b/robaczek.py new file mode 100644 index 0000000..07ac2eb --- /dev/null +++ b/robaczek.py @@ -0,0 +1,123 @@ +import random + +class Objekt: + def __init__(self, x, y): + self.x = x + self.y = y + + def Pobierz_X(self): + return self.x + + def Pobierz_Y(self): + return self.y + + def Ruch_X(self, x): + self.x = x + + def Ruch_Y(self, y): + self.y = y + +class Robaczek(Objekt): + def __init__(self, x, y): + super().__init__(x, y) + self.predkosc = 1 + self.poziom = 1 + self.najedzenie = 0 + + def ZjedzOwoc(self, owoc, owoce): + self.najedzenie += owoc.PobierzJedzenie() + print('\n OOO! Zjadłeś właśnie owoc, który dał Ci - ' + str(owoc.PobierzJedzenie()) + ' EXP') + owoce.remove(owoc) + + def SprawdzPoziom(self): + if self.najedzenie >= 10: + self.najedzenie -= 10 + self.poziom += 1 + print(' Awansowałeś na LVL ', self.poziom) + +class Owoc(Objekt): + def __init__(self, x, y): + super().__init__(x, y) + self.jedzenie = random.randint(1, 5) + + def PobierzJedzenie(self): + return self.jedzenie + +def PobierzOwoce(): + lista = [] + with open('owoce.txt', 'r') as file: + linie = file.readlines() + for linia in linie: + aftersplit = linia.split(',') + owoc_nowy = Owoc(aftersplit[0], aftersplit[1]) + lista.append(owoc_nowy) + return lista + +def WypiszOwoce(owoce): + print("\n ----------------\n") + for x in range(len(owoce)): + print(" " + str(x + 1) + ". X: " + owoce[x].x + ' Y: ' + owoce[x].y + ' Moc: ' + str(owoce[x].jedzenie)) + print("\n ----------------") + +def Start(): + return random.randint(1, 10) + +def Sprawdz(robaczek, owoce): + for owoc in owoce: + if (int(robaczek.x) == int(owoc.x) and int(robaczek.y) == int(owoc.y)) is True: + robaczek.ZjedzOwoc(owoc, owoce) + robaczek.SprawdzPoziom() + +def move(x, y, predkosc): + print(u"\nAktualna pozycja - X: " + str(x) + " Y: " + str(y)) + way = ['w', 'a', 's', 'd'] + direction = input(u"Podaj kierunek, w który chcesz się udać: ") + if direction.lower() == way[0]: + if robaczek.y + int(predkosc) > 10: + print("Nie możesz iść dalej na północ, zawróć!") + else: + robaczek.Ruch_Y(robaczek.Pobierz_Y() + int(predkosc)) + Sprawdz(robaczek, owoce) + elif direction.lower() == way[1]: + if robaczek.x - int(predkosc) < 1: + print("Nie możesz iść dalej na zachód, zawróć!") + else: + robaczek.Ruch_X(robaczek.Pobierz_X() - int(predkosc)) + Sprawdz(robaczek, owoce) + elif direction.lower() == way[2]: + if robaczek.y - int(predkosc) < 1: + print("Nie możesz iść dalej na połódnie, zawróć!") + else: + robaczek.Ruch_Y(robaczek.Pobierz_Y() - int(predkosc)) + Sprawdz(robaczek, owoce) + elif direction.lower() == way[3]: + if robaczek.x + int(predkosc) > 10: + print("Nie możesz iść dalej na wschód, zawróć!") + else: + robaczek.Ruch_X(robaczek.Pobierz_X() + int(predkosc)) + Sprawdz(robaczek, owoce) + elif direction.lower() == 'info': + print("\n ----------------") + print('\n LVL: ' + str(robaczek.poziom) + '\n EXP: ' + str(robaczek.najedzenie)) + print("\n ----------------") + elif direction.lower() == "owoce": + WypiszOwoce(owoce) + +print("ROBACZEK") +owoce = PobierzOwoce() +WypiszOwoce(owoce) +robaczek = Robaczek(Start(), Start()) +print(u"\n Ruszasz się WASD") +predkosc = input(u"\n Domyślna i zalecana prędkość wynosi 1, jeżeli chcesz ją zmienić wpisz ją ") +try: + int(predkosc) + robaczek.predkosc = predkosc +except ValueError: + print(' Podałeś coś innego, trudno. To gramy po mojemu') +while len(owoce) is not 0: + move(robaczek.x, robaczek.y, robaczek.predkosc) +print("\n ----------------\n\n" + " KONIEC GRY - WYGRAŁEŚ\n\n" + " LVL - " + str(robaczek.poziom) + + "\n EXP - " + str(robaczek.najedzenie) + + "\n\n ----------------") \ No newline at end of file From 228aded4c885e10f3ad2ce54de658afdc5c2aeed Mon Sep 17 00:00:00 2001 From: mixvert Date: Sun, 10 May 2020 17:57:30 +0200 Subject: [PATCH 03/10] Aplikacja Robaczek --- .idea/.gitignore | 2 ++ .idea/Robaczek.iml | 8 ++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 30 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Robaczek.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/Robaczek.iml b/.idea/Robaczek.iml new file mode 100644 index 0000000..c444878 --- /dev/null +++ b/.idea/Robaczek.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2891565 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 5b3b514d182b5f8c948ce7895057909b9978fcdb Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Sun, 10 May 2020 17:58:12 +0200 Subject: [PATCH 04/10] Delete Robaczek.iml --- .idea/Robaczek.iml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/Robaczek.iml diff --git a/.idea/Robaczek.iml b/.idea/Robaczek.iml deleted file mode 100644 index c444878..0000000 --- a/.idea/Robaczek.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 7ed462a3322abe35e96d36b1a496e975a7184c5d Mon Sep 17 00:00:00 2001 From: mixvert Date: Sun, 10 May 2020 18:01:50 +0200 Subject: [PATCH 05/10] Aplikacja Robaczek --- owoce.txt | 18 +++++++++--------- robaczek.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/owoce.txt b/owoce.txt index b27adf3..3e64ef1 100644 --- a/owoce.txt +++ b/owoce.txt @@ -1,10 +1,10 @@ -1,1, -2,2, -3,3, -4,4, +6,2, +4,9, +1,5, +7,6, +10,3, +3,7, +2,8, 5,5, -6,6, -1,9, -3,8, -9,3, -7,4, \ No newline at end of file +5,2, +7,3, \ No newline at end of file diff --git a/robaczek.py b/robaczek.py index 07ac2eb..4878905 100644 --- a/robaczek.py +++ b/robaczek.py @@ -26,7 +26,7 @@ def __init__(self, x, y): def ZjedzOwoc(self, owoc, owoce): self.najedzenie += owoc.PobierzJedzenie() - print('\n OOO! Zjadłeś właśnie owoc, który dał Ci - ' + str(owoc.PobierzJedzenie()) + ' EXP') + print('\n OOO! Zjadłeś owoc, który dał Ci - ' + str(owoc.PobierzJedzenie()) + ' EXP') owoce.remove(owoc) def SprawdzPoziom(self): From 5403aae149df1a1db6a6aaa9cf881f5d5e22881c Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Tue, 12 May 2020 18:14:21 +0200 Subject: [PATCH 06/10] Delete profiles_settings.xml --- .idea/inspectionProfiles/profiles_settings.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file From 6c9537b657eddf893d60d15dbd4b4a6e10f0c196 Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Tue, 12 May 2020 18:14:28 +0200 Subject: [PATCH 07/10] Delete .gitignore --- .idea/.gitignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 5c98b42..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml \ No newline at end of file From b4efcda80ccfdbe50ac52a2bedb2f8921e7caa58 Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Tue, 12 May 2020 18:14:34 +0200 Subject: [PATCH 08/10] Delete modules.xml --- .idea/modules.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2891565..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From ae8d1ac0e93e2bfb13485420a0336907bc4e93af Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Tue, 12 May 2020 18:14:40 +0200 Subject: [PATCH 09/10] Delete vcs.xml --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 1e461a082d6dea75d82d13607ea384cff057d1d6 Mon Sep 17 00:00:00 2001 From: mixvert <58787186+mixvert@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:25:44 +0200 Subject: [PATCH 10/10] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6f8650 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# WD2020 +Data visualisation classes