mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 19:47:32 +01:00
Running one directory (EADS) had already produced four bugs, so all of them
were run. 11 failed. Every one was real -- either in the coursework or in the
harness I had just written -- and the split was roughly even.
Coursework bugs:
- 15 .tex files use Polish ogonek characters with no fontenc, so pdflatex
dies with "Command \k unavailable in encoding OT1". Fixed where it was
actually needed, not blanket-applied.
- BSS had \documentclass{article}[12pt] -- options after the class name,
where they are not options at all.
- SDM's beamer deck had a stray } on an \item, which took out the frame.
- EOOP/Various/currency included "currency2.hpp"; the file is currency.hpp.
- ECRYPT_PROJECT had the SAME stdlib-shadowing bug as ECOTE: a package named
code/. Renamed to sieve/, and its 99 tests now run. With ECOTE's 26 that
is 125 tests that could not execute at all before today.
Harness bugs, which the run is what exposed:
- COURSE_ENTRY pointed at directories for PORR and ECRYPT_PROJECT, so python
looked for __main__.py and reported the wrong problem.
- main.py was auto-picked via find's first result. EARIN has six labs and
six main.py files, so that ran an arbitrary lab and called it the course.
Now only auto-picked when exactly one exists.
- Only the first requirements.txt was installed, which is why EARIN still
died on gymnasium after a venv was created for it. All of them now.
- The notebook probe accepted jupyter being on PATH. This machine's jupyter
is a pipx shim whose interpreter is gone, so "runnable" was a lie; it now
invokes jupyter --version and PBAD/twm_4 report blocked, honestly.
- Nothing ran a course's tests. Where a suite exists it is now the check,
which matters most for ECRYPT_PROJECT, whose program prompts on stdin and
cannot be run headlessly at all.
- Which directory pytest runs from is course-specific and unguessable, so
stubs pass --test-dir: ECOTE needs program/ for imports, ECRYPT_PROJECT
needs sieve/ because its fixtures open a CSV by relative path.
gates/known-incomplete.txt records the one file that genuinely cannot build:
EOOP/Various/set/set.cpp includes set.hpp, which `git log --all` shows has
never existed here. The course supplied it and only the .cpp was submitted.
That is a factual record with a stated check, not a lint allowlist -- and
fabricating the header would be inventing coursework.
Status is now 36 runnable / 5 no-code / 3 blocked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
101 lines
5.0 KiB
TeX
101 lines
5.0 KiB
TeX
\documentclass[12pt]{article}
|
|
\usepackage[utf8]{inputenc}
|
|
% T1 is required for Polish ogonek characters; without it pdflatex
|
|
% fails with "Command \k unavailable in encoding OT1".
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage{hyperref}
|
|
\usepackage{graphicx}
|
|
\usepackage{float}
|
|
|
|
\title{ECRYP Project - Sieve of Eratosthenes}
|
|
\author{Krzysztof Rudnicki 307585 \\ Bartłomiej Dybcio 303854}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
\section{Description of the used algorithm}
|
|
Sieve of Eratosthenes is used to find all prime numbers below certain limit Lets call this limit $n$ \\
|
|
It starts with number 2, which is the first prime number and marks all multiplies of this number (up to predefined limit) as composite (not prime), those numbers will be later ignored \\
|
|
Then it takes next available number (3) and does the same thing \\
|
|
This is repeated until there are no more numbers below the limit which are neither prime nor crossed out \\
|
|
Then we return the list of all non-crossed out (prime) numbers \\
|
|
We used more optimized version of this algorithm and cross out composites only up to $\sqrt{n}$ in the main loop \\
|
|
\begin{figure}[H]
|
|
|
|
\centering
|
|
\includegraphics{screenshoot/algorithm_description.png}
|
|
\caption{Sieve of erastosthenes example for numbers up to 120, prime numbers on the right, darker colors show prime numbers, lighter colors show numbers which were checked while checking whether given number was prime \href{https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes}{SOURCE} }
|
|
\end{figure}
|
|
\section{Functional description of the application}
|
|
First we define the limit, we name this limit as $num$ which will decide how many numbers we will check, either by user interface or we hard code it in \\
|
|
We define boolean list which will be used to distinguish between prime and composite numbers \\
|
|
We start with number 2 and assign it to variable named $p$ \\
|
|
Then we calculate the primes using Sieve of Eratosthenes using nested while loops \\
|
|
External loop goes through numbers smaller than $\sqrt(num)$, starting with current value of $p$ \\
|
|
It checks if the number we are currently was checked out by checking the value of boolean table \\
|
|
if it was not checked out it gets a new number which is the $p$ multiplied by 2, then it goes into inner loop \\
|
|
inner loop sets all multiplicities of $p$ as crossed out by setting their value in boolean table to false \\
|
|
then we increment the $p$ and the whole loop repeats until we run out of numbers \\
|
|
we return array of prime numbers to function which prints those numbers
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\includegraphics[width=\textwidth]
|
|
{screenshoot/program_use.png}
|
|
\caption{Example of full program use }
|
|
|
|
\end{figure}
|
|
|
|
\subsection{Input data format}
|
|
There is single input, variable named $num$ which is the upper limit of numbers to checked \\
|
|
It is a simple int variable, it cannot be less than 2 and has to be a whole number.
|
|
\subsection{Output text on console}
|
|
As an output we put out all input prompts which ask for an upper limit, and the list of prime numbers found by our algorithm.
|
|
\subsection{Format of output data}
|
|
Output data is a string
|
|
\subsection{Description of designed code structure}
|
|
There are three code blocks, sieve\_of\_eratosthenes, print\_sieve and main function executed at the beginning, main functions gets no arguments and outputs string consisting of prime numbers, print\_sieve function receives number which describes how many numbers should be checked in the sieve, similarly sieve\_of\_erastosthenes takes this number as an argument, and returns list of all prime numbers found by the sieve.
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\includegraphics[height=\textwidth]
|
|
{screenshoot/code_structure.pdf}
|
|
\caption{Flowchart of code flow }
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
\section{Tests}
|
|
We did three types of tests, positive tests which inputted prime numbers into the sieve and checked if the sieve correctly validated them as prime, negative tests which inputted composite numbers into the sieve and checked if the sieve correctly determined them to not be prime. \\
|
|
We know which numbers are prime and which are composite based on the reference value which source was given below. \\
|
|
We created two command line arguments:
|
|
\begin{itemize}
|
|
\item primes - which sets maximal number up to which we check correctness of our program in determining whether the number is prime
|
|
\item composites - which sets maximal number up to which we check correctness of our program in determining whether the number is composite
|
|
\end{itemize}
|
|
\subsection{Source of reference values}
|
|
All reference values were taken from: \href{http://www.naturalnumbers.org/primes.html}{http://www.naturalnumbers.org/primes.html}
|
|
|
|
\subsection{Correctness of results}
|
|
All of the tests passed successfully with upper limit as high as 100000
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\includegraphics[width=\textwidth]
|
|
{screenshoot/tests100.png}
|
|
\caption{Test results for up to 100 numbers}
|
|
|
|
\end{figure}
|
|
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\includegraphics[width=\textwidth]
|
|
{screenshoot/tests100000.png}
|
|
\caption{Test results for up to 100000 numbers}
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
\end{document} |