Compare commits

...

81 Commits

Author SHA1 Message Date
Maciej a4f822ad93 Merge branch 'main' of https://git.wmi.amu.edu.pl/s473601/Machine_learning_2023 into a-star-implementation 2023-05-14 09:51:58 +02:00
Tim Barvenov 3283eaa46d Merge pull request 'Add decision tree' (#20) from decision_tree into main
Reviewed-on: #20
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-05-12 22:23:28 +02:00
Veronika Polevara 8a05edf925 add decision tree 2023-05-11 19:34:08 +02:00
Maciej Wiklandt f20ac56cc0 Merge pull request 'Added BFS algorithm to search path using 3 actions: turn left/right, go straight' (#19) from rotation_actions into main
Reviewed-on: #19
Reviewed-by: Maciej Wiklandt <macwik@st.amu.edu.pl>
2023-05-04 21:32:51 +02:00
Eikthyrnir 2d4cc41157 refactoring 2023-05-02 00:02:00 +02:00
Eikthyrnir f4ad111371 refactoring 2023-05-01 23:59:15 +02:00
Eikthyrnir afdcac8b56 now the vacuum can only go straight and rotate left/right to change direction 2023-04-21 13:11:52 +02:00
Tim Barvenov c95ce82ac4 Merge pull request 'Next increment - AI movement' (#18) from Automatic-robot-movement into main
Reviewed-on: #18
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-04-21 10:14:31 +02:00
Mateusz Dokowicz ccefc6afbc AI move from position A to B 2023-04-20 03:38:55 +02:00
Mateusz Dokowicz f5003e93fe Config for cat 2023-04-20 00:15:00 +02:00
Pavel Bialko e972dcfd83 Merge pull request 'Vacuum_cleaning-ability' (#16) from Vacuum_cleaning-ability into main
Reviewed-on: #16
Reviewed-by: Nastassia Zhuravel <naszhu@st.amu.edu.pl>
2023-04-14 13:54:02 +02:00
Pavel 7dd2190c76 Added maximum mount of container_filling value, it's 100% - one pell it's 25%. 2023-04-14 00:25:35 +02:00
Pavel 029bcb1986 Added the Vacuum Doc Station, which can refresh vacuum container_filling level + add sprite of Doc Station + display Doc Station on screen(files) 2023-04-13 19:25:04 +02:00
Pavel 8ef3da8df0 Added the Vacuum Doc Station, which can refresh vacuum container_filling level + add sprite of Doc Station + display Doc Station on screen 2023-04-13 19:04:57 +02:00
Pavel 3b761e41ab Added the cleaning ability to vacuum and container_filling status now is visible. 2023-04-10 18:43:16 +02:00
Tim Barvenov 2929495348 Merge pull request 'added some properties' (#15) from Add-Properties into main
Reviewed-on: #15
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-03-30 19:26:53 +02:00
Mateusz Dokowicz 959ed6bfda added some properties 2023-03-30 18:45:52 +02:00
Mateusz Dokowicz 2c9500c2bf Merge pull request 'Redesigned project architecture to be a little bit more modular' (#12) from sandbox into main
Reviewed-on: #12
2023-03-30 18:29:26 +02:00
Mateusz Dokowicz f7b97c5f74 auto formatting 2023-03-30 18:27:51 +02:00
Mateusz Dokowicz 291e028a8a resolve endregion problem 2023-03-30 18:24:41 +02:00
Mateusz Dokowicz 047ef87bab Delete import non existing file 2023-03-30 18:18:46 +02:00
Eikthyrnir 83ef0fecad deleted old code 2023-03-29 12:22:05 +02:00
Eikthyrnir 03ece1218b refactoring 2023-03-29 11:27:59 +02:00
Eikthyrnir a0fe606c23 added cat and plants 2023-03-29 07:13:08 +02:00
Eikthyrnir 5b85d415e4 Merge branch 'main' into sandbox 2023-03-28 22:02:25 +02:00
Tim Barvenov 40a8322852 plants images added
Reviewed-on: #11
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-03-28 21:57:34 +02:00
countingthedots 5de48e2c3f plants images added 2023-03-28 21:48:52 +02:00
Eikthyrnir c54a99369e Merge branch 'main' into sandbox 2023-03-28 21:41:01 +02:00
Tim Barvenov adf4eaee00 Added static plants, fixed cat moving out of the world
Reviewed-on: #10
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-03-28 21:39:59 +02:00
countingthedots 77feab6a4e static plants added 2023-03-28 21:32:07 +02:00
Eikthyrnir 31dcf7b6dc Merge branch 'main' into sandbox 2023-03-28 21:12:47 +02:00
Eikthyrnir 28af8048b9 initial mix of Veronika and Mateusz code 2023-03-28 20:14:23 +02:00
Tim Barvenov 848e23d062 Added a cat that can move around a world
Reviewed-on: #9
Reviewed-by: Tim Barvenov <timbar@st.amu.edu.pl>
2023-03-28 20:11:08 +02:00
countingthedots 7358cb73fe unrequired cat image deleted 2023-03-28 19:47:46 +02:00
countingthedots 50a0eda8ef obrazy kota 2023-03-28 19:44:39 +02:00
countingthedots 5818a63e1e moving cat added 2023-03-28 19:36:57 +02:00
Maciej Wiklandt ad828cb7d1 Merge pull request 'Create-Array-for-Grid' (#8) from Create-Array-for-Grid into main 2023-03-23 15:35:53 +01:00
Mateusz Dokowicz 667d19084f Merge branch 'main' into Create-Array-for-Grid 2023-03-23 00:59:13 +01:00
Mateusz Dokowicz 586a94e0c0 working arrays and movement 2023-03-23 00:54:05 +01:00
Mateusz Dokowicz be307ebab5 bugFixes 2023-03-22 23:11:13 +01:00
Mateusz Dokowicz 4933c04bd8 upadte + array_to_window_position 2023-03-22 20:48:02 +01:00
Mateusz Dokowicz e55dbcccea error correction 2023-03-22 20:47:14 +01:00
Mateusz Dokowicz 7757843da8 formatting requirements 2023-03-22 20:46:05 +01:00
Mateusz Dokowicz 51a629285d Revert "Merge pull request 'Refactor and sprites' (#7) from refactor into main"
This reverts commit a65b07727b, reversing
changes made to 4ec034d548.
2023-03-21 21:15:08 +01:00
Veronika Polevara a65b07727b Merge pull request 'Refactor and sprites' (#7) from refactor into main
Reviewed-on: #7
2023-03-21 20:45:49 +01:00
Veronika Polevara 7809879c7c merge 2023-03-21 20:43:10 +01:00
Veronika Polevara ff3f344fca add sprites and refactor 2023-03-21 20:29:35 +01:00
Mateusz Dokowicz e37a889e1e Array Grid 2023-03-20 01:14:48 +01:00
Mateusz Dokowicz 101136b0b7 radius Fix 2023-03-19 22:00:10 +01:00
Nastassia Zhuravel 4ec034d548 Merge pull request 'Fixed radius value' (#6) from radiusFixed into main
Reviewed-on: #6
2023-03-19 20:05:12 +01:00
countingthedots 8d9c4146a4 Fixed radius value 2023-03-19 19:53:54 +01:00
Mateusz Dokowicz ef2e1a1fb7 Merge pull request 'optimization' (#5) from optimization into main
Reviewed-on: #5
2023-03-16 22:13:59 +01:00
Mateusz Dokowicz 2200cf15d7 typo 15->20 2023-03-16 22:08:47 +01:00
Mateusz Dokowicz 9b7bb1a62c rename movingCleaner to robot_movement 2023-03-16 21:55:05 +01:00
Mateusz Dokowicz a5e38a707b calculate radius prep 2023-03-16 21:50:27 +01:00
Mateusz Dokowicz 257f0f7d1d TODO calculate radius 2023-03-16 21:49:06 +01:00
Mateusz Dokowicz 3696636245 Code readability 2023-03-16 21:38:42 +01:00
Mateusz Dokowicz d080b04763 formatting and comments 2023-03-16 20:33:22 +01:00
Nastassia Zhuravel 9ac833550c Merge pull request 'Refactor' (#4) from Refactor into main
Reviewed-on: #4
2023-03-12 20:15:06 +01:00
countingthedots 9db0cc3cfd movement as a seperate function 2023-03-12 20:13:00 +01:00
countingthedots 63912b9b24 movement as a seperate function 2023-03-12 20:10:18 +01:00
countingthedots 997bd72a97 Merge branch 'main' of https://git.wmi.amu.edu.pl/s473601/Machine_learning_2023 2023-03-12 19:40:43 +01:00
Veronika Polevara 2ea0e3b27d refactor 1 2023-03-12 19:33:57 +01:00
Nastassia Zhuravel 9c4b811c98 Merge pull request 'Moving-circle' (#3) from Moving-circle into main
Reviewed-on: #3
2023-03-12 18:22:26 +01:00
countingthedots edc78b9103 Moving circle added 2023-03-12 18:19:28 +01:00
countingthedots 7eb0a8b7fa Moving circle added 2023-03-12 18:15:15 +01:00
countingthedots 6f31a587b9 Moving circle added 2023-03-12 18:11:31 +01:00
countingthedots 0580148281 Merge branch 'main' of https://git.wmi.amu.edu.pl/s473601/Machine_learning_2023 2023-03-12 17:14:53 +01:00
countingthedots 341e198749 Moving circle added 2023-03-12 17:11:06 +01:00
Mateusz Dokowicz 3aee864b8c Merge pull request 'pygame_wrap_class' (#1) from pygame_wrap_class into main
Reviewed-on: #1
2023-03-12 16:32:16 +01:00
Veronika Polevara 963f2da849 some changes 2023-03-12 16:22:51 +01:00
Mateusz Dokowicz 8714f2aa8f Merge branch 'main' into pygame_wrap_class 2023-03-12 14:46:26 +01:00
Pavel Bialko b9f443c424 Merge pull request 'Update Readme.md file' (#2) from s473601-patch-1 into main
Reviewed-on: #2
2023-03-12 14:41:30 +01:00
Pavel Bialko 58f85007f5 Update Readme 2023-03-12 14:37:33 +01:00
Veronika Polevara 645aa663e3 file naming changes 2023-03-12 14:09:55 +01:00
Veronika Polevara acce6f6bd1 merge main 2023-03-12 14:06:27 +01:00
Pavel Bialko 460e18fb06 Discription of the project.
First version of description in Polish and English languages.
2023-03-12 04:09:35 +01:00
Veronika Polevara 85281d93e8 wrap class start 2023-03-12 02:07:20 +01:00
Mateusz Dokowicz 2516befe86 Code Structure 2023-03-12 01:39:08 +01:00
Veronika Polevara 1ed6a272b8 add init pygame window 2023-03-11 19:31:43 +01:00
Veronika Polevara 00e08867e6 init repo 2023-03-11 18:20:07 +01:00
19 changed files with 236 additions and 7 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/PythEnv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (Machine_learning_2023)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Machine_learning_2023.iml" filepath="$PROJECT_DIR$/.idea/Machine_learning_2023.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -56,3 +56,61 @@ Summary:
The "Automatic cleaning robot" project is a simple yet educational programming project. Users are tasked with specifying the positions that the robot should clean, as well as the coordinates of obstacles. The robot, built using artificial intelligence, is responsible for avoiding obstacles, making decisions in case of random events, and cleaning the designated points. The project was written in Python with the use of artificial intelligence. The analysis of images is based on neural networks.
******
******
Dokumentacja projektu "Automatyczny robot sprzątający"
Wprowadzenie:
Projekt "Automatyczny robot sprzątający" jest projektem bazującym się na symulacji pracy robota sprzątającego w pomieszczeniu za pomocą sztucznej inteligencji. Robot ma za zadanie wyznaczać miejsca do sprzątania oraz uniknąć przeszkód oraz reagować na zdarzenia losowe. Projekt jest napisany w języku Python.
Instrukcja obsługi:
Uruchomienie projektu:
Aby uruchomić projekt należy uruchomić plik "main.py" za pomocą interpretera Python. Projektu wyświetli się w konsoli.Po uruchomieniu projektu na ekranie wyświetli się plansza o wymiarach NxN (default: 10x10). Robot "Cleaner" (oznaczony jako "R" na planszy) startuje z pozycji (0,0). użytkownik ma za zadanie wprowadzić pozycje do sprzątania, które są oznaczone na planszy jako litery "D". Możliwe pozycje to liczby od 0 do N-1.
Użytkownik wprowadza pozycje za pomocą terminala. Wprowadzenie koordynat odbywa się w następujący sposób:
Najpierw wprowadzamy numer wiersza, a następnie numer kolumny, oddzielając je spacją.
Przykładowo, jeśli chcemy wskazać pozycję (4,5) wpisujemy: "4 5".
Po wskazaniu pozycji do sprzątania, użytkownik musi uniknąć przeszkód, które są oznaczone na planszy jako znak "X". Robot nie może przejść przez przeszkody. Jeśli użytkownik wskazuje pozycję przeszkody, projektu zwróci błąd i będzie wymagała podania nowych współrzędnych.
Przebieg projektu:
Robot, zgodnie z zbudowaną mapą, musi obliczyć najkrótszą ścieżkę do sprzątania wszystkich pozycji oraz uniknąć przeszkód. Podczas sprzątania mogą wystąpić przypadkowe zdarzenia, na które robot będzie reagował. W tym celu, z pomocą sieci neuronowych, robot analizuje zdjęcie zdarzenia, aby wybrać najlepsze rozwiązania.
Zakończenie projektu:
Program kończy swoje działanie w momencie, gdy robot posprząta wszystkie przez użytkownika wybrane pola do sprzątania. Na zakończenie programu zostanie wyświetlona liczba wykonanych ruchów przez robota oraz podjęte decyzje w przypadku zaistnienia zdarzeń.
Możliwe modyfikacje:
Projekt zostanie napisany z myślą o możliwości łatwej modyfikacji. Można zmienić wymiary planszy, dodać lub usunąć przeszkody oraz ilość przypadkowych zdarzeń i pozycji do sprzątania. Wszystkie te zmiany można wprowadzić w pliku "config.py".
Podsumowanie:
Projekt "Automatyczny robot sprzątający" to prosty, ale edukacyjny projekt programistyczny. Użytkownik ma za zadanie wskazanie pozycji, które robot powinien posprzątać, a także koordynat przeszkody. Natomiast zadaniem robota, który został zbudowany przy użyciu sztucznej inteligencji, jest unikanie przeszkód, podejmowanie decyzji w przypadku wystąpienia przypadkowych zdarzeń oraz sprzątanie wyznaczonych punktów. Projekt został napisany w języku Python z wykorzystaniem sztucznej inteligencji. Analiza zdjęć jest oparta na sieciach neuronowych.
******
Documentation of the "Automatic Cleaning Robot" project
Introduction:
The "Automatic Cleaning Robot" project is based on simulating the work of a cleaning robot in a room using artificial intelligence. The robot is tasked with determining the areas to be cleaned, avoiding obstacles, and reacting to random events. The project is written in Python.
User Guide:
Starting the project:
To start the project, you need to run the "main.py" file using a Python interpreter. The project will be displayed on the console. Once the project is launched, a 10x10 board will be displayed on the screen. The "Cleaner" robot (marked as "R" on the board) starts from the position (0,0). The user needs to enter the positions to be cleaned, which are marked as the letter "D" on the board. The possible positions are numbers from 0 to 9.
The user enters the positions through the terminal. The entry of coordinates is done as follows:
First, we enter the row number, and then the column number, separating them with a space.
For example, if we want to indicate the position (4,5), we enter "4 5".
After indicating the positions to be cleaned, the user must avoid obstacles, which are marked on the board as the "X" symbol. The robot cannot pass through obstacles. If the user points to an obstacle position, the project will return an error and require new coordinates.
Project process:
Based on the built map, the robot must calculate the shortest path to clean all positions and avoid obstacles. Random events may occur during cleaning, to which the robot will react. To do this, with the help of neural networks, the robot analyzes the image of the event to choose the best solutions.
Project conclusion:
The program is ending when the robot cleans all the fields selected by the user. At the end of the program, the number of robot moves performed and the decisions made in case of events will be displayed.
Possible modifications:
The "Automatic cleaning robot" project has been designed with the possibility of easy modifications in mind. Users can change the dimensions of the board, add or remove obstacles, and adjust the number of random events and cleaning positions. All these changes can be made in the "config.py" file.
Summary:
The "Automatic cleaning robot" project is a simple yet educational programming project. Users are tasked with specifying the positions that the robot should clean, as well as the coordinates of obstacles. The robot, built using artificial intelligence, is responsible for avoiding obstacles, making decisions in case of random events, and cleaning the designated points. The project was written in Python with the use of artificial intelligence. The analysis of images is based on neural networks.
******

22
decisionTree/data.csv Normal file
View File

@ -0,0 +1,22 @@
1-2-3-4-5;1-green 2-yellow 3-orange 4-black 5-while 6-blue;in dB 0-100;0-24;0/1;in cm;in C;0/1
Size;Color;Sound;Time;Smell;Height;Temperature;ToRemove
1;2;0;16;1;10;25;1
2;1;0;12;0;50;24;0
2;3;30;13;1;38;38;0
1;4;0;7;1;5;27;1
1;2;0;16;1;10;25;1
2;1;0;12;0;50;24;0
2;3;30;13;1;38;38;0
1;4;0;7;1;5;27;1
1;2;0;16;1;10;25;1
2;1;0;12;0;50;24;0
2;3;30;13;1;38;38;0
1;4;0;7;1;5;27;1
1;2;0;16;1;10;25;1
2;1;0;12;0;50;24;0
2;3;30;13;1;38;38;0
1;4;0;7;1;5;27;1
1;2;0;16;1;10;25;1
2;1;0;12;0;50;24;0
2;3;30;13;1;38;38;0
1;4;0;7;1;5;27;1
1 1-2-3-4-5 1-green 2-yellow 3-orange 4-black 5-while 6-blue in dB 0-100 0-24 0/1 in cm in C 0/1
2 Size Color Sound Time Smell Height Temperature ToRemove
3 1 2 0 16 1 10 25 1
4 2 1 0 12 0 50 24 0
5 2 3 30 13 1 38 38 0
6 1 4 0 7 1 5 27 1
7 1 2 0 16 1 10 25 1
8 2 1 0 12 0 50 24 0
9 2 3 30 13 1 38 38 0
10 1 4 0 7 1 5 27 1
11 1 2 0 16 1 10 25 1
12 2 1 0 12 0 50 24 0
13 2 3 30 13 1 38 38 0
14 1 4 0 7 1 5 27 1
15 1 2 0 16 1 10 25 1
16 2 1 0 12 0 50 24 0
17 2 3 30 13 1 38 38 0
18 1 4 0 7 1 5 27 1
19 1 2 0 16 1 10 25 1
20 2 1 0 12 0 50 24 0
21 2 3 30 13 1 38 38 0
22 1 4 0 7 1 5 27 1

Binary file not shown.

9
decisionTree/evaluate.py Normal file
View File

@ -0,0 +1,9 @@
import joblib
def evaluate(data):
# Load the model
clf = joblib.load('decisionTree/decision_tree_model.pkl')
# Make a prediction
prediction = clf.predict(data)
return prediction

21
decisionTree/prepare.py Normal file
View File

@ -0,0 +1,21 @@
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn import metrics
import joblib
pima = pd.read_csv("data.csv", header=1, delimiter=';')
feature_cols = ['Size', 'Color', 'Sound', 'Time','Smell', 'Height','Temperature']
X = pima[feature_cols]
y = pima.ToRemove
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
clf = DecisionTreeClassifier()
clf = clf.fit(X_train,y_train)
joblib.dump(clf, 'decision_tree_model.pkl')
y_pred = clf.predict(X_test)
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))

View File

@ -13,3 +13,5 @@ class Cat(Entity):
self.busy = False
self.sleeping = False
self.direction = 0
self.props = [1,2,0,16,1,10,25]

View File

@ -0,0 +1,8 @@
from domain.entities.entity import Entity
from domain.world import World
class Earring(Entity):
def __init__(self, x: int, y: int):
super().__init__(x, y, "EARRING")
self.props = [2,1,0,12,0,50,24]

View File

@ -1,11 +1,11 @@
from domain.entities.entity import Entity
from domain.world import World
class Garbage(Entity):
def __init__(self, x: int, y: int):
super().__init__(x, y, "GARBAGE")
super().__init__(x, y, "PEEL")
self.wet = False
self.size = 0
self.props = [1,2,0,16,1,10,25]
# TODO GARBAGE: add more properties

View File

@ -35,6 +35,59 @@ class World:
def is_docking_station_at(self, x: int, y: int) -> bool:
return bool(self.doc_station.x == x and self.doc_station.y == y)
def accepted_move(self, checking_x, checking_y):
if (
checking_x > self.width - 1
or checking_y > self.height - 1
or checking_x < 0
or checking_y < 0
):
return False
if self.is_obstacle_at(checking_x, checking_y):
return False
from decisionTree.evaluate import evaluate
from domain.entities.entity import Entity
class World:
def __init__(self, width: int, height: int) -> object:
self.width = width
self.height = height
self.dust = [[[] for j in range(height)] for i in range(width)]
self.obstacles = [[[] for j in range(height)] for i in range(width)]
self.vacuum = None
self.cat = None
self.doc_station = None
def add_entity(self, entity: Entity):
if entity.type == "PEEL":
self.dust[entity.x][entity.y].append(entity)
elif entity.type == "EARRING":
self.dust[entity.x][entity.y].append(entity)
elif entity.type == "VACUUM":
self.vacuum = entity
elif entity.type == "DOC_STATION":
self.doc_station = entity
elif entity.type == "CAT":
self.cat = entity
self.obstacles[entity.x][entity.y].append(entity)
else:
self.obstacles[entity.x][entity.y].append(entity)
def is_obstacle_at(self, x: int, y: int) -> bool:
return bool(self.obstacles[x][y])
def is_garbage_at(self, x: int, y: int) -> bool:
if len(self.dust[x][y]) == 0:
return False
tmp = evaluate([self.dust[x][y][0].props])
return bool(tmp[0])
def is_docking_station_at(self, x: int, y: int) -> bool:
return bool(self.doc_station.x == x and self.doc_station.y == y)
def accepted_move(self, checking_x, checking_y):
if (
checking_x > self.width - 1
@ -48,5 +101,7 @@ class World:
return False
return True
def get_cost(self, x, y):
return self.costs[x][y]

11
main.py
View File

@ -8,6 +8,8 @@ from domain.commands.vacuum_move_command import VacuumMoveCommand
from domain.entities.cat import Cat
from domain.entities.entity import Entity
from domain.entities.vacuum import Vacuum
from domain.entities.garbage import Garbage
from domain.entities.earring import Earring
from domain.entities.docking_station import Doc_Station
from domain.world import World
from view.renderer import Renderer
@ -134,11 +136,11 @@ class Main:
def generate_world(tiles_x: int, tiles_y: int) -> World:
world = World(tiles_x, tiles_y)
for _ in range(35):
for _ in range(10):
temp_x = randint(0, tiles_x - 1)
temp_y = randint(0, tiles_y - 1)
world.add_entity(Entity(temp_x, temp_y, "PEEL"))
world.vacuum = Vacuum(0, 0)
world.add_entity(Garbage(temp_x, temp_y))
world.vacuum = Vacuum(1, 1)
world.doc_station = Doc_Station(9, 8)
if config.getboolean("APP", "cat"):
world.cat = Cat(7, 8)
@ -148,7 +150,8 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
world.add_entity(Entity(3, 4, "PLANT2"))
world.add_entity(Entity(8, 8, "PLANT2"))
world.add_entity(Entity(9, 3, "PLANT3"))
world.add_entity(Entity(4, 0, "PLANT2"))
world.add_entity(Earring(5, 5))
for x in range(world.width):
for y in range(world.height):

BIN
media/sprites/earrings.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -1,3 +1,6 @@
pygame
configparser
formaFormatting: Provider - black
pandas
scikit-learn
joblib
# formaFormatting: Provider - black

View File

@ -94,6 +94,13 @@ class Renderer:
self.tile_height + self.tile_height / 4,
),
),
"EARRING": pygame.transform.scale(
pygame.image.load("media/sprites/earrings.webp"),
(
self.tile_width + self.tile_width / 4,
self.tile_height + self.tile_height / 4,
),
),
}
self.cat_direction_sprite = {