Skip to content

Commit 431d5b0

Browse files
committed
SUBMITTED IT WOOOO
1 parent 53b8ef2 commit 431d5b0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

latex/main.pdf

500 Bytes
Binary file not shown.

latex/main.tex

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@
9191
\noindent Additionally, these have been already set up in the \verb|Main| class, so the simulation can be run by simply running
9292
the \verb|main()| method under it. Since the parameters of the simulation is read from the JSON file, it is necessary
9393
to have the \verb|simulation_data.json| file in the root directory of the project (the place where the \verb|Main.java|
94-
file can be found).
94+
file can be found), but this is already provided in the Jar file in the submission. Finally, the simulation uses an
95+
external package called \href{https://github.com/google/gson/}{Gson} to read the
96+
JSON file, and which is why the package is bundled in the Jar file in the submission.
9597

9698
\section{Tasks Lists and Implementation Details}
9799

@@ -218,7 +220,7 @@
218220

219221
\noindent \textbf{Quadtree Optimisation: } While not a visible feature, due to its complexity, it is worth discussing.
220222
A quadtree is utilised to store entities, instead of a list. This is done to efficiently handle entity proximity checks. Each frame,
221-
entities are added to the quadtree, and when they need to find nearby entities they query the tree. This is is a major upgrade
223+
entities are added to the quadtree, and when they need to find nearby entities, they query the tree. This is is a major upgrade
222224
to the naïve approach of $O(n^2)$ time-complexity, where every entity checks its distance to every other entity (1000 entities means
223225
1,000,000 calls, 60 times a second). Using the quadtree for every entity has an average complexity of $O(n \log n)$, since the
224226
quadtree organises entities by proximity. Overall, this greatly improves performance, making the experience of the simulation
@@ -232,7 +234,7 @@
232234
\section{Code Quality Considerations}
233235

234236
\subsection{Coupling and Responsibility-Driven Design}
235-
\noindent Coupling is minimized by separating all major functions into different classes. The class structure of the
237+
\noindent Coupling is minimised by separating all major functions into different classes. The class structure of the
236238
program starts with the \verb|Engine| class. The \verb|Engine| controls the main loop of the simulation, combining the actual
237239
simulation and the graphics together.
238240

@@ -241,7 +243,7 @@
241243
internal logic, meaning it has minimal coupling.
242244

243245
\noindent Graphics are handled by the \verb|Display| and the \verb|RenderPanel| classes. The \verb|RenderPanel| class
244-
extends the \verb|JPanel| class and is responsible for rendering the simulation, and since it has low coupling it is
246+
extends the \verb|JPanel| class and is responsible for rendering the simulation, and since it has low coupling, it is
245247
easy to change the \verb|RenderPanel| class to render the simulation on different mediums — a web browser, for example.
246248
Furthermore, the simulation is controlled by the
247249
\verb|Simulator| class. All entities are stored in a \verb|Field| class, which is created by a \verb|FieldBuilder| class to
@@ -277,10 +279,10 @@
277279
for the \verb|Environment| class are also created, the \verb|WeatherController| and the \verb|TimeController|.
278280
This massively increases cohesion as the different operations
279281
are split into different relevant sections, making the code much easier to understand. This also has the added benefit of making
280-
the \verb|Animal| and \verb|Environment| classes quite small, and improves responsibility driven design.
282+
the \verb|Animal| and \verb|Environment| classes quite small, and improves responsibility driven design and code readability.
281283

282284
\noindent The structure of \verb|Entity| and its subclasses also lends itself to high cohesion — its extremely clear what an
283-
\verb|Animal| should do, and what a \verb|Predator| and \verb|Prey| does differently while also inhreintly being subclasses of
285+
\verb|Animal| should do, and what a \verb|Predator| and \verb|Prey| does differently while also inherintly being subclasses of
284286
\verb|Animal|. This once again decreases code duplication and increases the cohesion of the code base.
285287

286288
\noindent

0 commit comments

Comments
 (0)