From bf0f1a43623c2af9206e5802d4887d6e2fc2a8e1 Mon Sep 17 00:00:00 2001 From: s464931 Date: Wed, 11 May 2022 17:32:28 +0200 Subject: [PATCH] =?UTF-8?q?Drzewo=20decyzyjne=20-=20decyzja,=20czy=20osoba?= =?UTF-8?q?=20ma=20natychmast=20opu=C5=9Bci=C4=87=20magazyn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ikony/bieg.png | Bin 0 -> 694 bytes Ikony/osoba2.png | Bin 0 -> 377 bytes dataset.csv | 39 +++++++++++++++++++++++++++++++++++++ enumy_i_slowniki.py | 14 +++++++++++--- krata.py | 7 ++++++- main.py | 46 +++++++++++++++++++++++++++++++++++++++++++- rescue.py | 41 +++++++++++++++++++++++++++++++++++++++ stale.py | 5 +++++ stan_nastepnik.py | 2 +- 9 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 Ikony/bieg.png create mode 100644 Ikony/osoba2.png create mode 100644 dataset.csv create mode 100644 rescue.py diff --git a/Ikony/bieg.png b/Ikony/bieg.png new file mode 100644 index 0000000000000000000000000000000000000000..11244966ad3748eab9191ed77eec8234653d4d71 GIT binary patch literal 694 zcmV;n0!jUeP)RH3VAbjK3E1UBHpu~CQX><`Ja8R20rVu! zt0N0`A&NVAmfr)61Iw7@)%bzzKz%+%RW<>&1w`wh@ts_9>F zAGbw)IgF;B!xZ2BpUUwPFc?Bs#{-J*_;H|VkvB(nb10P~7E+I+++*0Slcqm?`DZQ? z8c5_{waE8cfUZGH#v>)a2HXa|8}ggTbo0g+gNW|#ubML62c~kymXZExP1A?;^rk29 z3RoY^&XRq=N6bZ>52t3PM!Fx`4ZKHRK$`$>U3qLm_VzK-?eR{e&(Rgp@Fh0_d@xAp zVjL+bW(U&u>vBhY6fox?AIBBt8e4%GP2Rim_1z123vAb1XEWIs|0O)Ukqu*4#3Jw% znfE3xDd#*Z&AJ4-$abG+gBm$HuNnE(I) literal 0 HcmV?d00001 diff --git a/Ikony/osoba2.png b/Ikony/osoba2.png new file mode 100644 index 0000000000000000000000000000000000000000..461e5f11e722aace7fa689bac7b67649e3dc35ee GIT binary patch literal 377 zcmV-<0fzpGP)OZg=^7xRK1FBD<=>SP_t-gf_5gB zHDS6XZyEISgvu`!5q-TA-~TPJCkw@p3OVQcz6SsRXxnyK7O4>lK*XXb{4}jKB1$qv zLS5G#ztCDM$y6k`_5iSL+wpK+*UOoIKh#Po$?GDax~`9hP18s+MKd(dv)0;AE6dV3 zC&?5E5fLI 21: + z.append(0) # zimne pomieszczenie + else: + z.append(1) # normalne pomieszczenie + z.extend(random.choices([1, 2], weights=[7, 3], k=1)) # poziom kurzu, 2 to największy/najbardziej niebezpieczny + z.extend(random.choices([1, 2], weights=[4, 6], k=1)) # poziom oświetlenia, 2 to najlepsze oświetlenie + if (0<=osoba.wiersz or osoba.wiersz<=13) and (17<=osoba.kolumna or osoba.kolumna<=19): #obok szafki z niebezpiecznymi towarami + z.append(1) + else: + z.append(0) + columns = ['plec', 'wiek', 'czas_w_pom', 'temp_w_pom', 'poziom_kurzu', 'poziom_oswietlenia', 'niebezp_towary'] + z1 = pd.DataFrame([z],columns=columns) + z_pred = clf.predict(z1) + #print(z) + #print(z_pred) + return (z_pred) \ No newline at end of file diff --git a/stale.py b/stale.py index 845f87d..95c578e 100644 --- a/stale.py +++ b/stale.py @@ -1,3 +1,6 @@ +import os +import pygame + FPS = 20 # # SZEROKOSC_OKNA = 1500 @@ -23,6 +26,8 @@ CZARNY = (0, 0, 0) CIEMNY_BRAZOWY1 = (60, 19, 33) ZOLTY1 = (231, 213, 69) NIEBIESKI1 = (65, 125, 225) +IKONA=pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'osoba2.png')), + (BOK_AGENTA1, BOK_AGENTA1)) ### ### diff --git a/stan_nastepnik.py b/stan_nastepnik.py index 24e9616..8ab3308 100644 --- a/stan_nastepnik.py +++ b/stan_nastepnik.py @@ -70,7 +70,7 @@ def pole_w_granicach_kraty(pole: PoleKraty): def mozna_wjechac_na_pole(pole: PoleKraty): - if pole.krata.krata[pole.wiersz][pole.kolumna] != ZawartoscPola.SCIANA: + if pole.krata.krata[pole.wiersz][pole.kolumna] != ZawartoscPola.SCIANA and pole.krata.krata[pole.wiersz][pole.kolumna] != ZawartoscPola.SCIANA2 and pole.krata.krata[pole.wiersz][pole.kolumna] != ZawartoscPola.OSOBA: return True else: return False