# DarthDemono's Notes for ELTE > A blog Website: https://elte.darthdemono.com ## Contents ### Sync Your NEPTUN Calendar to Your Phone's Home Screen Follow this tutorial to display your class schedule directly on your phone's home screen using a calendar widget. Date: 2026-02-07 URL: https://elte.darthdemono.com/General/Tutorials/Sync-Your-NEPTUN-Calendar-to-Your-Phone's-Home-Screen Tags: NEPTUN, Tutorial Sync Your NEPTUN Calendar to Your Phone’s Home Screen Follow this tutorial to display your class schedule directly on your phone’s home screen using a calendar widget. Steps 1. Get Your Calendar Subscription Link Log into Neptun. (If needed, refer to NEPTUN 5 Guides for help.) Go to Calendar Click Calendar Management > Copy Subscription Link. 2. Install ICSX5 Download and install the ICSX5 app from the official release: GitHub Releases page: github.com/bitfireAT/icsx5/releases Direct APK link (v2.4.3): github.com/bitfireAT/icsx5/releases/download/v2.4.3/icsx5-92-2.4.3-standard-release.apk 3. Configure ICSX5 After installation: Allow access to your calendar. Disable battery restrictions for the app. Ensure permissions are not paused when the app is inactive. 4. Add Your Calendar Open ICSX5. Tap the ”+” button. Select Subscribe to URL > Paste Subscription Link. Paste the Subscription Link you copied from Neptun. Tap Save. 5. Set Up Google Calendar Open Google Calendar. Go to Settings > Manage Accounts. Select Non-Google Accounts > Calendar Subscriptions. Turn the subscription On. 6. Add Widget to Home Screen Long-press your home screen and select Widgets. Find the Google Calendar widget. Choose your preferred widget size and style. Place it on your home screen. Now your schedule will always be visible right from your home screen. --- ### ELTE BSc CS Curriculum list This is simply a MD / HTML version of the Computer Science BSc ELTE Curriculum, so that students can have an easier time using it and making notes / plans based on it. Date: 2026-01-25 URL: https://elte.darthdemono.com/ELTE/ELTE-BSc-CS-Curriculum-list Tags: IK-PROGINF-NBEN, BSc, CS, ELTE, Curriculum ELTE Curriculum taken from Computer Science BSc 2018 (in English, for Foreign Students) This is simply a MD / HTML version of the ELTE BSc CS Curriculum 2018, so that students can have an easier time using it and making notes / plans based on it. I added a prerequisite tree / flowchart as well. There might be inaccuracies or mistakes so confirm with the main linked pdf just to be on the safe side in case of making some infallible plan. But, for the most part, everything here is taken from an official PDF or webpage. Subject CodeSubjectLPrLabConAssessmentCreditRec. SemesterPrerequisite1st Semester2nd Semester3rd Semester4th Semester5th Semester6th SemesterCompulsory SubjectsIP-18fSZGREGComputer systems2021XCP512+0+2+1IP-18fPROGEGProgramming2031XCP612+0+3+1IP-18fIMPROGEGImperative programming2030XCP512+0+3+0IP-18fFUNPEGFunctional programming2021XE512+0+2+1IP-18fMATAGBasic Mathematics0400CP410+4+0+0IP-18fTMKGLearning Methodology0100P110+1+0+0IP-18fIVMEGBusiness fundamentals1200XP311+2+0+0IP-18fPNVEGProgramming languages2022XCP62IP-18fIMPROGEG2+0+2+2IP-18fOEPREGEGObject-oriented programming2031XCP62IP-18fPROGEG2+0+3+1IP-18fWF1EGWeb development1020XCP32IP-18fSZGREG (weak)1+0+2+0IP-18fAA1EAlgorithms and data structures I2000E22IP-18fAA1G (weak)2+0+0+0IP-18fAA1GAlgorithms and data structures I0201P32IP-18fMATAG, IP-18fIMPROGEG0+2+0+1IP-18fDM1EDiscrete mathematics I2000E22IP-18fDM1G (weak)2+0+0+0IP-18fDM1GDiscrete mathematics I0201CP32IP-18fMATAG0+2+0+1IP-18fAN1EAnalysis I2000E22IP-18fAN1G (weak)2+0+0+0IP-18fAN1GAnalysis I0201P32IP-18fMATAG0+2+0+1IP-18fAA2EAlgorithms and data structures II2000E23IP-18fAA2G (weak)2+0+0+0IP-18fAA2GAlgorithms and data structures II0201P33IP-18fAA1E0+2+0+1IP-18fWPEGWeb programming1021XCP43IP-18fWF1EG1+0+2+1IP-18fPROGTEGProgramming technology2021XCP53IP-18fOEPROGEG2+0+2+1IP-18fAN2EAnalysis II2000E23IP-18fAN2G (weak)2+0+0+0IP-18fAN2GAnalysis II0201P33IP-18fAN1E0+2+0+1IP-18fDMAGApplication of discrete models0021P33IP-18fDM1E0+0+2+1IP-18fOPREGOperating systems1011XP34IP-18fSZGREG1+0+1+1IP-18fAB1EDatabases I2000E24IP-18fAB1G (weak)2+0+0+0IP-18fAB1GDatabases I0020P24IP-18fAA1E0+0+2+0IP-18fSZTEGSoftware technology2021XCP54IP-18fPROGTEG2+0+2+1IP-18fSZEAE1EFundamentals of theory of computation I2000E24IP-18fSZEAE1G (weak)2+0+0+0IP-18fSZEAE1GFundamentals of theory of computation I0201P34IP-18fDM1E0+2+0+1IP-18fNM1ENumerical methods2000E24IP-18fNM1G (weak)2+0+0+0IP-18fNM1GNumerical methods0201P34IP-18fAN2E0+2+0+1IP-18fKPROGEGConcurrent programming1011XCP35IP-18fPNVEG1+0+1+1IP-18fTKHETelecommunication networks2000E25IP-18fTKHG (weak)2+0+0+0IP-18fTKHGTelecommunication networks0021P35IP-18fOEPROGEG0+0+2+1IP-18fMIAEArtificial intelligence2001E352+0+0+1IP-18fAB2EDatabases II2000E25IP-18fAB2G (weak)2+0+0+0IP-18fAB2GDatabases II0021P35IP-18fAB1E0+0+2+1IP-18fSZEAE2EFundamentals of theory of computation II2000E25IP-18fSZEAE2G (weak)2+0+0+0IP-18fSZEAE2GFundamentals of theory of computation II0201P35IP-18fSZEAE1E0+2+0+1IP-18fVSZGProbability and statistics0021P35IP-18fAN2E0+0+2+1Compulsories1272930222224Compulsory ElectivesIP-18fKVKBRECryptography and security2000E24,6IP-18fKVKBG (weak)2+0+0+02+0+0+0IP-18fKVKBGCryptography and security0021P34,6IP-18fDMAG0+0+2+10+0+2+1IP-18fKVBGTEIntroduction to machine learning2001E33IP-18fMATAG2+0+0+1IP-18fKVPREEProgramming theory2000E23,5IP-18fKVPREG (weak)2+0+0+02+0+0+0IP-18fKVPREGProgramming theory0201P33,5IP-18fMATAG0+2+0+10+2+0+1IP-18fKVPRJGTools of software projects0201CP35IP-18fPNVEG0+2+0+1IP-18fKVFPPECompilers2001E35IP-18fKVPPG (weak)2+0+0+1IP-18fKVPPGCompilers0020P25IP-18fOEPROGEG0+0+2+0IP-18fKVADAADA2021XP55,6IP-18fIMPROGEG2+0+2+12+0+2+1IP-18fKVPVEGPython2021XE53,4,5,62+0+2+12+0+2+12+0+2+12+0+2+1IP-18fKVIADSEApplied Data Science2000E23,52+0+0+02+0+0+0IP-24fKVSZKBIZTECybersecurity basic2002E42IP-18fWF1EG (weak)2+0+0+2IP-24fKVSZGEComputer graphics2001E33,5IP-24fKVSZGG (weak)2+0+0+12+0+0+1IP-24fKVSZGGComputer graphics0021P33,5IP-18fMATAG, IP-18fIMPROGEG0+0+2+10+0+2+1IP-24fKVKHSZGGIntermediate Computer Graphics0021P34,6IP-24fKVSZGG0+0+2+10+0+2+1IP-24fKVNFIATEGNative cloud computing applications2021XE54,5,6IP-18fKVPYEG2+0+2+12+0+2+12+0+2+1IP-24fKVHWPEGAdvanced web programming2021PG54,6IP-18fWPEG2+0+2+12+0+2+1Compulsory electives239068SummaryCompulsories + compulsory electives15029303122308Electives1082IP-24fsZDThesis consultation2020Summa credit in semester293031303030Summa credit180 Descriptions: L: Lecture hours per week Pr: Practice hours per week Lab: Laboratory hours per week Con: Consultation hours per week Assessment: P: Practice grade E: Exam C: Practice with continuous assessment (at least 5 independent tests/assessments) X: Mixed subject (lecture + practice) End of subject code: EG: Lecture + Practice under same code E: Lecture only G: Practice only ELTE IK. Computer Science BSc 2018 (in English, for Foreign Students). Digital. ELTE IK, 2025. www.inf.elte.hu/en/dstore/document/225452/PTI_BSc_angol_h%C3%A1l%C3%B3_honlapra%202019%20jan-m%C3%A1rcius.pdf. Difference between Strong and Weak Prerequisite A prerequisite is a preliminary requirement of a subject that, if it is not fulfilled, you cannot proceed on the subject that is built on it (follow-up subject). We distinguish two kinds of prerequisites: strong prerequisites and weak prerequisites. The strong prerequisiteThe weak prerequisiteStrong prerequisites are prerequisites without which the the follow-up subject cannot be taken in the next semester, and the follow-up subject can only be registered for after the prerequisite subject has been fulfilled.Weak prerequisites are those prerequisites where the prerequisite and the follow-up subject can be taken in the same semester, but the follow-up subject can only be fulfilled after the prerequisite has been fulfilled. If you do not fulfill the weak prerequisite, the follow-up subject’s grade will automatically be failed/unfulfilled (even if you had passed from the follow-up subject’s exam!) ELTE IK. “The Prerequisites.” Digital. In ELTE IK Student Guide, 35–37. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227164/Essential%20student%20guide.pdf. Difference between Compulsory, Compulsory elective and Free elective (optional) courses CompulsoryCompulsory electiveFree elective (optional)These courses provide indispensable knowledge to become a successful professional in your chosen field. You will not be able to graduate without completing these courses.These courses allow students to gain additional knowledge in specific fields, giving them a choice of usually 5-8 courses/study field to suit their interests and to boost their future employment prospects. These courses are categorised into elective course groups (called units) in the following study fields:These courses can relate to all sorts of study fields. Each curriculum contains a certain number of credits assigned to such courses. They are mandatory to complete to graduate but the selection is wide: students can either choose courses from other ELTE GTK programmes than their own, or even any courses offered by the University.A subject is compulsory if – based on the training and graduation requirements, – its completion is necessary for all students in order to obtain the diploma, and all subjects that are defined as such by the curriculum. The form of the compulsory subject is a class-lecture and/or group work (seminar, practice).Completing compulsory elective subjects are compulsory for students by choosing them from the thematic list offered by the current university schedule at the time.Completing elective subject is compulsory for students through the free subject choosing prescribed by the training and graduation requirements. Students may choose from the whole university’s full offered subject selection. In the BSC programme you have to complete 180 credits:Compulsory subjects 127 creditsCompulsory elective subjects 23 creditsElective subjects 10 creditsThesis Consultation 20 credits ELTE Faculty of Economics. “Courses,” December 14, 2025. gtk.elte.hu/en/studies/courses. ELTE IK. “Understanding the Curriculum for BSc Students.” Digital. In ELTE IK Student Guide, 23. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227164/Essential%20student%20guide.pdf. ELTE Faculty of Informatics. “Curriculum,” December 9, 2025. www.inf.elte.hu/en/curriculum. ELTE IK. The Curriculum. Digital. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227188/The%20curriculum.pdf. Prerequisite Flowchart (With Compulsory Elective + Weak Prerequisite) flowchart LR %% ================================================== %% Semester 1 %% ================================================== subgraph S1["Semester 1"] MAT["Basic Mathematics<br/>IP-18fMATAG Pr"] PROG["Programming<br/>IP-18fPROGEG L+Pr"] IMP["Imperative Programming<br/>IP-18fIMPROGEG L+Pr"] CS["Computer Systems<br/>IP-18fSZGREG L+Pr"] LM["Learning Methodology<br/>IP-18fTMKG Pr"] BUS["Business Fundamentals<br/>IP-18fIVMEG L+Pr"] FUNP["Functional Programming<br/>IP-18fFUNPEG L+Pr"] end %% ================================================== %% Semester 2 %% ================================================== subgraph S2["Semester 2"] PNY["Programming Languages<br/>IP-18fPNYEG L+Pr"] OOP["Object-Oriented Programming<br/>IP-18fOEPROGEG L+Pr"] WEB1["Web Development<br/>IP-18fWF1EG L+Pr"] AA1["Algorithms & Data Structures I<br/>IP-18fAA1G Pr"] DM1["Discrete Mathematics I<br/>IP-18fDM1G Pr"] AN1["Analysis I<br/>IP-18fAN1G Pr"] CYBER["Cybersecurity Basics<br/>IP-24fKVSZKBIZTE L+Pr"] end %% ================================================== %% Semester 3 %% ================================================== subgraph S3["Semester 3"] AA2["Algorithms & Data Structures II<br/>IP-18fAA2G Pr"] WPROG["Web Programming<br/>IP-18fWPEG L+Pr"] PROGT["Programming Technology<br/>IP-18fPROGTEG L+Pr"] AN2["Analysis II<br/>IP-18fAN2G Pr"] DMAPP["Application of Discrete Models<br/>IP-18fDMAG Pr"] ML["Intro to Machine Learning<br/>IP-18fKVBGTE L+Pr"] PY["Python<br/>IP-18fKVPYEG L+Pr"] GPU["GPU Programming<br/>IP-18fKVGPUEG L+Pr"] end %% ================================================== %% Semester 4 %% ================================================== subgraph S4["Semester 4"] OS["Operating Systems<br/>IP-18fOPREG L+Pr"] DB1["Databases I<br/>IP-18fAB1G Pr"] ST["Software Technology<br/>IP-18fSZTG Pr"] TOC1["Theory of Computation I<br/>IP-18fSZEA1G Pr"] NUM["Numerical Methods<br/>IP-18fNM1G Pr"] CRYPTO["Cryptography & Security<br/>IP-18fKVKRBG Pr"] end %% ================================================== %% Semester 5 %% ================================================== subgraph S5["Semester 5"] CONC["Concurrent Programming<br/>IP-18fKPROGEG L+Pr"] NET["Telecommunication Networks<br/>IP-18fTKHG Pr"] AI["Artificial Intelligence<br/>IP-18fMIAE L+Pr"] DB2["Databases II<br/>IP-18fAB2G Pr"] TOC2["Theory of Computation II<br/>IP-18fSZEA2G Pr"] STAT["Probability & Statistics<br/>IP-18fVSZG Pr"] PTH["Programming Theory<br/>IP-18fKVPREG Pr"] TOOLS["Tools of Software Projects<br/>IP-18KVPRJG Pr"] COMP["Compilers<br/>IP-18fKVFPG Pr"] end %% ================================================== %% Strong prerequisites (PDF-exact) %% ================================================== IMP --> PNY PROG --> OOP CS --> WEB1 MAT --> AA1 MAT --> DM1 MAT --> AN1 AA1 --> AA2 WEB1 --> WPROG OOP --> PROGT AN1 --> AN2 DM1 --> DMAPP CS --> OS AA1 --> DB1 PROGT --> ST DM1 --> TOC1 AN2 --> NUM PNY --> CONC OOP --> NET DB1 --> DB2 TOC1 --> TOC2 AN2 --> STAT %% ================================================== %% Weak prerequisites (PDF-marked only) %% ================================================== AN2 -.-> STAT CS -.-> WEB1 WEB1 -.-> CYBER %% ================================================== %% Elective prerequisites %% ================================================== MAT --> ML MAT --> GPU MAT --> PTH DMAPP --> CRYPTO PNY --> TOOLS OOP --> COMP IMP --> PY References ELTE IK. Computer Science BSc 2018 (in English, for Foreign Students). Digital. ELTE IK, 2025. www.inf.elte.hu/en/dstore/document/225452/PTI_BSc_angol_h%C3%A1l%C3%B3_honlapra%202019%20jan-m%C3%A1rcius.pdf. ELTE IK. “The Prerequisites.” Digital. In ELTE IK Student Guide, 35–37. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227164/Essential%20student%20guide.pdf. ELTE Faculty of Economics. “Courses,” December 14, 2025. gtk.elte.hu/en/studies/courses. ELTE IK. “Understanding the Curriculum for BSc Students.” Digital. In ELTE IK Student Guide, 23. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227164/Essential%20student%20guide.pdf. ELTE Faculty of Informatics. “Curriculum,” December 9, 2025. www.inf.elte.hu/en/curriculum. ELTE IK. The Curriculum. Digital. ELTE IK, 2024. www.inf.elte.hu/dstore/document/227188/The%20curriculum.pdf. --- ### eduroam Ethernet Fix This is a fix for this issue me and my roommates face when sometimes we cannot connect to eduroam via ethernet: SimpleSAML_Error_Error: UNHANDLEDEXCEPTION Date: 2026-01-23 URL: https://elte.darthdemono.com/General/Tutorials/eduroam-Ethernet-Fix Tags: eduroam, Tutorial eduroam Ethernet Fix This is a fix for this issue me and my roommates face when sometimes we cannot connect to eduroam via ethernet. Unfortunately, this is not a permanent fix, that can only be done by the responsible authorities. SimpleSAML_Error_Error: UNHANDLEDEXCEPTION Backtrace: 1 www/_include.php:17 (SimpleSAML_exception_handler) 0 [builtin] (N/A) Caused by: SimpleSAML_Error_Exception: Received an assertion that is valid in the future. Check clock synchronization on IdP and SP. Backtrace: 3 modules/saml/lib/Message.php:660 (sspmod_saml_Message::processAssertion) 2 modules/saml/lib/Message.php:613 (sspmod_saml_Message::processResponse) 1 modules/saml/www/sp/saml2-acs.php:129 (require) 0 www/module.php:135 (N/A) Solution For some reason, if the PC clock is off by 30 seconds with the authentication servers, this error shows up. The only way (known to me) is to match the times of the authentication server and the PC. PC Time Synchronization Over Wi-Fi Connect to eduroam Wi‑Fi, or turn on a hotspot and connect to your phone. For Windows: go to Settings → Time & Language → Date & Time → Sync now. You can choose any of the time servers below and click Synchronize: pool.ntp.org hu.pool.ntp.org time.iszt.hu Manual If, for some reason, you do not have a Wi‑Fi card and the only way you can connect to the internet is via Ethernet (like my PC), you need to align the time manually by looking at your phone’s clock. --- ### NEPTUN 5 Guides Guides from other universities for NEPTUN 5 Date: 2026-01-22 URL: https://elte.darthdemono.com/General/NEPTUN-5-Guides Tags: NEPTUN NEPTUN 5 Guides NOTE: I have no authority to publish any form of NEPTUN guides and therefore I cannot be held liable for any inconsistencies or misinformation. All I am doing is I am guiding you to NEPTUN Guides for NEPTUN 5, published by other universities. Context What is NEPTUN? The Neptun Education System is the electronic system at ELTE which makes the administration of your studies easier and faster. You can take your lectures and exams, follow the results of your courses and financial matters, and communicate with your fellows and professors via Neptun. What is NEPTUN 5? It is the newest version of NEPTUN with the newest interface. Why do we not have guides?? Because of the recency of this newer interface, not all universities published a guide for this newer interface including ELTE. That is why I compiled some sources from other universities. University of Debrecen Neptun Student Web Guide (2024) Neptun Student Web Interface Guide (2025) Study processes YouTube Playlist Term Registration Submit requests Registration of Subjects Exam registration Record financial item Student Card request How to view grades and exam results University of Pécs First steps --- ### Computer systems L+Pr DarthDemono’s Notes for Computer Systems L+Pr / IP-18fSZGREG How Computers Work CPU Cycle Storage hierarchy Network Fundamentals Networks evolved from ARPANET → TCP/IP (1983). Date: 2026-01-22 URL: https://elte.darthdemono.com/Computer-systems-L+Pr/ Tags: IP-18fSZGREG, BSc, CS, ELTE DarthDemono’s Notes for Computer Systems L+Pr / IP-18fSZGREG How Computers Work CPU Cycle Storage hierarchy Network Fundamentals Networks evolved from ARPANET → TCP/IP (1983). SSH replaces insecure telnet/FTP (unencrypted). Command: ssh {username}@server ComSys Server Access SSH ssh {neptun}@comsys.inf.elte.hu (e.g., ssh LS1234@comsys.inf.elte.hu) Password: your Neptun password You’re in /afs/inf.elte.hu/user/L/LS/LS1234/. cd public to access your documents which are also publicly available Essential Editors vim (powerful, modal): vim file.sh # i=insert, esc=:wq=save&quit, :q!=quit no save, dd=delete line, yy=copy line, p=paste nano (beginner-friendly): nano file.sh # Ctrl+O=save, Ctrl+X=exit man vim, man nano for help. Linux Commands from Lectures CommandPurposeExampleslsList directory (-l=details, -a=hidden)ls -la (lists all files (including hidden) with details and permissions)pwdPrint working directorypwd → /afs/inf.elte.hu/user/L/LS/LS1234/cd / mkdir / rmdirNavigate / create / remove dirscd .., mkdir comsys, rmdir emptycp / mv / rm / lnCopy / move / delete / linkcp file1 file2, mv old new, rm -r dir, ln source targetchmodChange permissions (rwx, 644=owner rw)chmod +x script.sh (makes file exexutable), chmod 755 file (grants the owner read, write, and execute permissions)chown / chgrpChange owner/groupsudo chown user:group filepasswdChange passwordpasswdwho / whoamiLogged-in users / current userwho, whoami → LS1234psProcessesps aux → Lists all active processestopLive processes/prioritiestop (q=quit)findSearch filesfind . -name "*.sh"cat / head / tailView filescat file (shows file), head -5 file (shows first 5 lines), tail -5 file (shows last 5 lines)grepFilter lines (regex)grep "error" file, grep -r "TODO" .wcWord/line/char countwc -l file (shows file lined count)manShows command detailsman nano (shows details about nano) Running Executables chmod Make executable: chmod +x myscript.sh # makes any files 'executable' Run: ./myscript.sh # './' -> current directory Source source myscript.sh File Operations Zip/Compress: zip -r homework.zip homework/ # ZIP format tar czvf homework.tar.gz homework/ # GZipped TAR gzip file.txt # .txt → .txt.gz Move: mv source dest/ # Rename/move file/dir mv file1 file2 dir/ # Multiple files Remove: rm file # File (no recycle bin!) rm -r dir/ # Recursive directory rm -rf dir/ # Force, no prompt (dangerous!) Exam Samples Midterm Endterm Course command usage examples list→filter→transform→aggregate: ls -l *.sh | grep "May" | awk '{print $9}' | wc -l PowerShell equivalent: ls *.ps1 | Where { $_.LastWriteTime.Month -eq 5 } | Select Name | Measure --- ### Midterm Create the below-given tasks in Bash and upload the solutions to Canvas. You have altogether 60 minutes for the work and the upload. There is extra 5 minutes, but each minute delay will cause minus 2 points from the points sum. Each task values 5 points if it they are perfect. No points for solutions with syntax errors. Date: 2026-01-22 URL: https://elte.darthdemono.com/Computer-systems-L+Pr/Midterm/ Tags: IP-18fSZGREG, Sample, Solution, Bash Midterm Sample ALL TASKS ARE OBLIGATORY Create the below-given tasks in Bash and upload the solutions to Canvas. You have altogether 60 minutes for the work and the upload. There is extra 5 minutes, but each minute delay will cause minus 2 points from the points sum. Each task values 5 points if it they are perfect. No points for solutions with syntax errors. Task 1 Task Create a Bash Script to evaluate the sum of even numbers stored in a file. Take the file as a parameter. Numbers in the file are below: 8 2 3 4 Output: 14 Solution #!/bin/bash file="$1" sum=0 if [[ ! -f "$file" ]]; then echo "Error: File not found" exit 1 fi while read -r num; do if (( num % 2 == 0 )); then (( sum += num )) fi done < "$file" echo "$sum" Task 2 Task Create a Bash Script that adds the numbers of two columns and multiplies them by the numbers of the third column. Take the file as a parameter. Data in the file are below: 1 2 3 4 5 6 7 8 9 Output: 9 # (1+2)*3 54 # (4+5)*6 135 # (7+8)*9 Solution #!/bin/bash file="$1" if [[ ! -f "$file" ]]; then echo "Error: File not found" exit 1 fi while read -r col1 col2 col3; do sum=$(( col1 + col2 )) result=$(( sum * col3 )) printf "%d\n" "$result" done < "$file" Task 3 Task Create a Bash Script that check if the numbers is Armstrong or not. Take a number as parameter. Input: 153 Output: True #1^3+3^3+5^3=153 Solution #!/bin/bash num="$1" original="$num" power=3 # For 3-digit numbers temp="$num" sum=0 ## Calculate sum of cubes while (( temp > 0 )); do digit=$(( temp % 10 )) (( sum += digit ** power )) (( temp /= 10 )) done if (( sum == original )); then echo "True #${original}^3+5^3+3^3=${original}" else echo "False" fi Task 4 Task Create a Bash Script to determine the maximum value among three numbers. Take three numbers from keyboard as variables. Solution #!/bin/bash echo "Enter first number: " read -r num1 echo "Enter second number: " read -r num2 echo "Enter third number: " read -r num3 max=$num1 if (( num2 > max )); then max=$num2 fi if (( num3 > max )); then max=$num3 fi echo "Maximum value: $max" --- ### Endterm Create the below-given tasks in PowerShell and upload the solutions to Canvas. You have altogether 60 minutes for the work and the upload. There is extra 5 minutes, but each minute delay will cause minus 2 points from the points sum. Each task values 5 points if it they are perfect. No points for solutions with syntax errors. Date: 2026-01-22 URL: https://elte.darthdemono.com/Computer-systems-L+Pr/Endterm/ Tags: IP-18fSZGREG, Sample, Solution, Powershell Endterm Sample ALL TASKS ARE OBLIGATORY Create the below-given tasks in PowerShell and upload the solutions to Canvas. You have altogether 60 minutes for the work and the upload. There is extra 5 minutes, but each minute delay will cause minus 2 points from the points sum. Each task values 5 points if it they are perfect. No points for solutions with syntax errors. Task 1 Task Create a PS script (named 1.ps1), which reads in numbers from the command line. Write out the number of the numbers! It should work as a filter command too. .\1.ps1 apple tree green # => 3 Solution $items = @() if ($MyInvocation.ExpectingInput) { $items += @($input) } else { $items += $args } $items.Count Task 2 Task Create a PS script (named 2.ps1), which gets some numbers from the command line and writes out those, which are dividable by 7. .\2.ps1 1174 21 5 #=> 7 21 Solution ForEach ($num in $args) { if ( $num % 7 -eq 0) { Write-Output $num } } Task 3 Task Create a PS script (named 3.ps1), which gets a filename from the command line. Check the file existence, if there is any problem, read it from keyboard. The text file should contain a number in each line. Write out each number, which starts with 5. Solution param([string]$file) if (-not (Test-Path $file)) { $file=Read-Host "Please give file: "} Get-Content $file | ForEach-Object {$num = [int]$_ if($num.ToString().StartsWith('5')){Write-Output $Num}} Task 4 Task Create a PS script (named 4.ps1), which gets a filename from the command line. The text file contains several words / line. The result should be those lines which are longer than 3 words. Solution param([string]$file) if (-not (Test-Path $file)) { $file=Read-Host "Please give file: "} Get-Content $file | ForEach-Object {     $words = $_.Split(" ")     if ($words.Count -gt 3){Write-Output $_} } --- ### Solution Solution to particles Date: 2026-01-22 URL: https://elte.darthdemono.com/Imperative-programming-L+Pr/particles/Solution Tags: IP-18fIMPROGEG, Sample, Solution Solution particles.c: #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include "terminal_draw.h" typedef struct { int x; int y; int dx; int dy; Color color; } Particle; void draw_border(int width, int height) { for (int x = 0; x < width; ++x) { draw_char(x, 0, '-', BLUE); draw_char(x, height - 1, '-', BLUE); } for (int y = 1; y < height - 1; ++y) { draw_char(0, y, '|', BLUE); draw_char(width - 1, y, '|', BLUE); } } int random_in_range(int min, int max) { if (min > max) { int temp = min; min = max; max = temp; } int range = max - min + 1; return min + (rand() % range); } Particle random_particle(int width, int height) { Particle p; p.x = random_in_range(1, width - 2); p.y = random_in_range(1, height - 2); p.dx = random_in_range(-1, 1); p.dy = random_in_range(-1, 1); p.color = (Color)random_in_range(BLACK, WHITE); return p; } void draw_particles(Particle *particles, int count) { for (int i = 0; i < count; ++i) { draw_char(particles[i].x, particles[i].y, '*', particles[i].color); } } void move_particles(Particle *particles, int count, int width, int height) { for (int i = 0; i < count; ++i) { particles[i].x += particles[i].dx; particles[i].y += particles[i].dy; if (particles[i].x <= 0) { particles[i].x = 1; particles[i].dx = -particles[i].dx; } else if (particles[i].x >= width - 1) { particles[i].x = width - 2; particles[i].dx = -particles[i].dx; } if (particles[i].y <= 0) { particles[i].y = 1; particles[i].dy = -particles[i].dy; } else if (particles[i].y >= height - 1) { particles[i].y = height - 2; particles[i].dy = -particles[i].dy; } } } bool is_colliding(Particle *particles, int count, int index) { if (index < 0 || index >= count) { return false; } for (int i = 0; i < count; ++i) { if (i != index && particles[i].x == particles[index].x && particles[i].y == particles[index].y) { return true; } } return false; } void change_colors(Particle *particles, int count) { for (int i = 0; i < count; ++i) { if (is_colliding(particles, count, i)) { particles[i].color = (Color)random_in_range(BLACK, WHITE); } } } int main(void) { srand((unsigned int)time(NULL)); int width, height; get_screen_size(&width, &height); int num_particles; printf("Enter the number of particles: "); if (scanf("%d", &num_particles) != 1 || num_particles <= 0) { printf("Invalid input.\n"); return 1; } Particle *particles = malloc((size_t)num_particles * sizeof(Particle)); if (particles == NULL) { printf("Memory allocation failed.\n"); return 1; } for (int i = 0; i < num_particles; ++i) { particles[i] = random_particle(width, height); } for (int step = 0; step < 100; ++step) { clear_screen(); draw_border(width, height); draw_particles(particles, num_particles); move_particles(particles, num_particles, width, height); change_colors(particles, num_particles); sleep_ms(300); } free(particles); particles = NULL; return 0; } --- ### Solution Solution to canvas Date: 2026-01-22 URL: https://elte.darthdemono.com/Imperative-programming-L+Pr/canvas/Solution Tags: IP-18fIMPROGEG, Sample, Solution Canvas Solution canvas.c: #include "canvas.h" #include <stdio.h> #include <stdlib.h> static Canvas make_empty_canvas(void) { Canvas c; c.width = 0; c.height = 0; c.pixels = NULL; return c; } Canvas init_canvas(int width, int height) { Canvas c; int y; c.width = 0; c.height = 0; c.pixels = NULL; if (width <= 0 || height <= 0) { return c; } c.pixels = malloc(height * sizeof(Pixel *)); for (y = 0; y < height; ++y) { c.pixels[y] = malloc(width * sizeof(Pixel)); if (!c.pixels[y]) { int i; for (i = 0; i < y; ++i) { free(c.pixels[i]); } free(c.pixels); c.pixels = NULL; return make_empty_canvas(); } } c.width = width; c.height = height; return c; } Canvas load_asset(const char *filename) { Canvas c = make_empty_canvas(); FILE *f = fopen(filename, "r"); int w, h; int x, y; if (!f) { return c; } if (fscanf(f, "%d %d", &w, &h) != 2) { fclose(f); return c; } c = init_canvas(w, h); if (!c.pixels) { fclose(f); return c; } for (y = 0; y < c.height; ++y) { for (x = 0; x < c.width; ++x) { int r, g, b; if (fscanf(f, "%d %d %d", &r, &g, &b) != 3) { /* on bad input just free and return empty */ free_canvas(c); fclose(f); return make_empty_canvas(); } c.pixels[y][x].r = (unsigned char)r; c.pixels[y][x].g = (unsigned char)g; c.pixels[y][x].b = (unsigned char)b; } } fclose(f); return c; } void free_canvas(Canvas c) { int y; if (!c.pixels) { return; } for (y = 0; y < c.height; ++y) { free(c.pixels[y]); } free(c.pixels); } void invert_colors(Canvas *c) { int x, y; if (!c || !c->pixels) { return; } for (y = 0; y < c->height; ++y) { for (x = 0; x < c->width; ++x) { Pixel *p = &c->pixels[y][x]; p->r = 255 - p->r; p->g = 255 - p->g; p->b = 255 - p->b; } } } Canvas get_brightest_canvas(Canvas canvases[], int size) { int i, x, y; double best_brightness = -1.0; Canvas best = make_empty_canvas(); if (!canvases || size <= 0) { return best; } for (i = 0; i < size; ++i) { Canvas c = canvases[i]; long sum = 0; long count; if (!c.pixels || c.width <= 0 || c.height <= 0) { continue; } for (y = 0; y < c.height; ++y) { for (x = 0; x < c.width; ++x) { Pixel p = c.pixels[y][x]; sum += p.r + p.g + p.b; } } count = (long)c.width * (long)c.height * 3L; if (count == 0) { continue; } double avg = (double)sum / (double)count; if (avg > best_brightness) { best_brightness = avg; best = c; } } return best; } canvas.h: #ifndef CANVAS_H #define CANVAS_H typedef struct { unsigned char r; unsigned char g; unsigned char b; } Pixel; typedef struct { int width; int height; Pixel **pixels; /* pixels[y][x] */ } Canvas; Canvas init_canvas(int width, int height); Canvas load_asset(const char *filename); void free_canvas(Canvas c); void invert_colors(Canvas *c); Canvas get_brightest_canvas(Canvas canvases[], int size); #endif main.c: #include <stdio.h> #include <stdlib.h> #include "canvas.h" void print_canvas(Canvas c){ printf("\n--- Canvas (%dx%d) ---\n", c.width, c.height); for (int y = 0; y < c.height; y++){ for (int x = 0; x < c.width; x++){ Pixel p = c.pixels[y][x]; printf("\033[38;2;%d;%d;%dm", p.r, p.g, p.b); printf("@@"); printf("\033[0m"); } printf("\n"); } printf("---------------------\n"); } Canvas* load_all_canvases(){ int capacity = 4; Canvas *canvas_array = malloc(capacity * sizeof(Canvas)); Canvas c = load_asset("assets/cat.txt"); canvas_array[0] = c; c = load_asset("assets/dog.txt"); canvas_array[1] = c; c = load_asset("assets/fish.txt"); canvas_array[2] = c; c = load_asset("assets/star.txt"); canvas_array[3] = c; return canvas_array; } int main() { int choice = 0; Canvas *canvases = load_all_canvases(); for (;;) { printf("\n=== Menu ===\n"); printf("1) Print an image\n"); printf("2) Invert an image\n"); printf("3) Get the brightest image\n"); printf("4) Exit\n"); printf("Your choice: "); scanf("%d", &choice); if (choice == 4) { for (int i = 0; i < 4; i++) { free_canvas(canvases[i]); } free(canvases); break; } if (!canvases) { printf("No images are loaded. Put images in ./assets and restart.\n"); continue; } switch (choice) { case 1: { printf("Which image do you want to print?\n"); printf("0 : Cat\n"); printf("1 : Dog\n"); printf("2 : Fish\n"); printf("3 : Star\n"); printf("Your choice: "); scanf("%d", &choice); if (choice < 0 || choice > 3) { printf("Invalid choice, please try again!\n"); break; } print_canvas(canvases[choice]); break; } case 2: { printf("Which image do you want to invert?\n"); printf("0 : Cat\n"); printf("1 : Dog\n"); printf("2 : Fish\n"); printf("3 : Star\n"); printf("Your choice: "); scanf("%d", &choice); if (choice < 0 || choice > 3) { printf("Invalid choice, please try again!\n"); break; } invert_colors(&canvases[choice]); print_canvas(canvases[choice]); break; } case 3: { Canvas brightest = get_brightest_canvas(canvases, 4); print_canvas(brightest); break; } default: printf("Wrong choice, please try again!\n"); break; } } return 0; } --- ### canvas Create a lightweight graphics engine that can handle images entirely in memory. Date: 2026-01-22 URL: https://elte.darthdemono.com/Imperative-programming-L+Pr/canvas/ Tags: IP-18fIMPROGEG, Sample Canvas Create a lightweight graphics engine that can handle images entirely in memory. Because the hardware is limited, you cannot use standard fixed-size 2D arrays (like pixel[100][100]). Instead, you must build a system that allocates memory dynamically based on the exact width and height required at runtime. You also need to implement a file parser to load assets from disk into this in-memory representation. The rendering of the loaded images will be done by the provided main.c file. Download the Canvas folder, and write your code inside this folder. Upon finishing the exam upload a zip file of this folder. You must split your code into three files: canvas.h: All structure definitions, constants, and function declarations. canvas.c: The implementation of all functions. main.c: This file is provided for you already inside the canvas folder. The file consists of the functions print_canvas() and another function to load all the assets (images). There is a menu program to test the solution. NOTE: Don’t edit this file if it is not needed. assets: cat.txt dog.txt fish.txt star.txt Solution: Solution NOTE: In the exam only assets and main.c will be provided, you must create canvas.c and canvas.h yourself. The Header File canvas.h (5 Points) Define a struct named Pixel containing three unsigned char members: r, g, b. Define a struct (or typedef) named Canvas. It must contain: int width int height Pixel **pixels - It can alternatively be a 2-dimensional array for less points. See the details at init_canvas() function below. Make sure to use the header guards. Create function declarations as described below. The Implementation File canvas.c Separate the program to 2 compilation units, joined with the header file: main.c, canvas.c, canvas.h. (4 points) Create the following functions: Canvas init_canvas(int width, int height) (10 Points) Declare a Canvas object. Allocate memory for the “image” (using the Pixel struct, the height, and the width). Return the initialized Canvas. If the memory allocation was not successful, then return an empty canvas with a size of 0x0. Make sure to avoid memory leak. (4 points) To represent the image, use an array-of-arrays layout: a Pixel** where each element (Pixel*) points to a row containing width pixels. In other words, you allocate: One array of Pixel* elements: pointers for each row (“height” number of elements represented vertically) For each separate row, an array of Pixel values of size “width” (represented horizontally) The following figure represents a 3x3 image: Pixel** width ^ ┌────────────┐ <─────────────────────────────> │ │ │ ┌─────────┬─────────┬─────────┐ │ │ Pixel* p ──┼──> │ (r,g,b) │ (r,g,b) │ (r,g,b) │ Pixel[3] │ │ │ └─────────┴─────────┴─────────┘ h │ ├────────────┤ e │ │ │ ┌─────────┬─────────┬─────────┐ i │ │ Pixel* p ──┼──> │ (r,g,b) │ (r,g,b) │ (r,g,b) │ Pixel[3] g │ │ │ └─────────┴─────────┴─────────┘ h │ ├────────────┤ t │ │ │ ┌─────────┬─────────┬─────────┐ │ │ Pixel* p ──┼──> │ (r,g,b) │ (r,g,b) │ (r,g,b) │ Pixel[3] │ │ │ └─────────┴─────────┴─────────┘ v └────────────┘ Alternative solution: You may want to represent the canvas as a 2-dimensional array with the size of 10x10. In this case you’ll be able to read only cat.txt and dog.txt. However, using this representation, the points for dynamic memory allocation can’t be scored. Canvas load_asset(const char *filename) (10 Points) The first line will represent (Width, Height). Call init_canvas() to create an empty canvas with the width and height values read from the file. The rest of the lines in the file are a Width x Height matrix, where every element of the matrix consists of 3 numbers that represent a Pixel (r, g, and b). Read this matrix and save it in the pixels field of the canvas. Return the filled canvas. void free_canvas(Canvas c) (5 Points) Free the Pixels and the Canvas objects. void invert_colors(Canvas* c) (10 Points) Iterate over the entire image (the pixels field) of a Canvas. Invert every pixel. The inversion formula is: new_color = 255 - old_color. Do this for r, g, and b components. Canvas get_brightest_canvas(Canvas canvases[], int size) (12 Points) Return the brightest image (Canvas) from the array canvases. The brightest canvas is the canvas in which the average brightness is the highest. The average brightness of a canvas is: ∑(r+g+b)/(total number of pixels * 3) Requirements For solving the task, only cppreference.com/ can be used. No electric device is allowed besides the lab machine. All electric device must be in your bag and your bag must be besides the wall of the room. When we find an electric device on you, or ask to empty pockets and you’re not willing to, then it results the failure of the subject. We are using IP address monitoring. If any other account is involved than yours, then it results the failure of the sibject. The submitted code must compile. In case of compiler error the solution scores 0 points. Strive for nice and elegant coding conventions. Use proper indentation, and avopy copy-paste codes. If the task doesn’t specify requirements on the way of solution, then it can be done arbitrarily. --- ### particles In this task, you have to draw particles that move in a random direction on the screen and bounce back at the edge of the screen. If two particles collide (i.e., end up in the same position), they change their color. However, they do not change direction in the event of a collision. Date: 2026-01-22 URL: https://elte.darthdemono.com/Imperative-programming-L+Pr/particles/ Tags: IP-18fIMPROGEG, Sample Console drawing To solve this task, the terminal_draw.h library module is available, which provides services for console drawing. The module contains the following elements: typedef enum Color { BLACK = 30, RED = 31, GREEN = 32, YELLOW = 33, BLUE = 34, MAGENTA = 35, CYAN = 36, WHITE = 37 } Color; void clear_screen(): This function clears the entire contents of the terminal window. void get_screen_size(int* width, int* height): This function sets the values ​​of the variables referenced by the specified pointers to the number of characters that can be printed in one row and one column, respectively, based on the size of the terminal window. void draw_char(int x, int y, char c, Color color): The function prints the specified character in the specified color at the (x, y) coordinate. The point (0, 0) indicates the upper left corner of the window. sleep_ms(int milliseconds): Suspends the program for the specified milliseconds. Solution: Solution Particle movement In this task, you have to draw particles that move in a random direction on the screen and bounce back at the edge of the screen. If two particles collide (i.e., end up in the same position), they change their color. However, they do not change direction in the event of a collision. To solve this problem, create the following types and operations: struct Particle: A structure representing a particle that stores the x and y coordinates as well as the direction of the particle’s movement. The direction is indicated by the variables dx and dy, whose possible values ​​are -1, 0, 1. For example, if the value of dx is 1, the particle moves one position to the right at each step. Or if the value of dy is -1, it moves up one position. The particle also has a color. This is encoded by a variable of type Color, which can be accessed from terminal_draw.h. (3 points) draw_border(): It receives the width and height of the screen as a parameter, and draws a frame of the corresponding size in blue as follows (5 points): ----------- | | | | | | ----------- (Note: In Windows terminals there are some glitches sometimes related to the screen size. You could try printing a fixed size 10x20 board during the development) random_in_range(): This function receives an interval as a parameter, and then returns a random integer falling within this interval. The rand() function declared in stdlib.h is available for this, which returns a non-negative random number. (3 points) random_particle(): This function receives the width and height of the screen as a parameter, and then creates a particle falling into this window. The position and direction of the particle are random. When generating the direction of movement, consider the instructions in the struct Particle section. (5 points) draw_particles(): This function takes an array of particles and the size of the array as a parameter. The function draws all the particles in the array as '*' characters at the appropriate position with the color of the particle. (5 points) move_particles(): This function also takes the array of particles with its size, as well as the width and height of the screen. The function’s task is to move the particles in the direction specified by their dx and dy data members. If the particle hits a wall, it bounces off the wall at a 45 degree angle. For example, if the particle is moving upwards (i.e. dy was -1) and the particle reaches the upper wall, it starts downwards, so dy is changed to 1. (7 points) is_colliding(): This function takes the array of particles and its size as a parameter. The function also takes an integer. If the coordinate of the particle at this index in the array is the same as the coordinate of any other particle, the function returns true, otherwise it returns false. (7 points) change_colors(): This function receives the array of particles and its size as parameters. If the position of a particle is the same as the position of another particle, its color will change. (6 points) At the beginning of the main program, ask the user for an integer, then create an array in heap memory that can hold so many particles. Fill the array with randomly generated particles. (5 points) In the rest of the program, create a loop that performs the following steps in each iteration: (4 points) Clear screen Draw border Draw particles Move particles Check for particle collisions (with color change) Wait 300ms The loop should perform 100 iterations, then the program should end. Expectations for the program No auxiliary tools should be used for the solution, except for the C reference (cppreference.com). The final version of the program must be functional. Compile and run! Code that does not compile is worth 0 points! Do not use global variables! Only macros are allowed! Strive for nice, clear coding, use indentation, avoid code repetition! Don’t take up unnecessary memory, --- ### Imperative Programming L+Pr This course is not about problem solving. It is about understanding C as a language, how programs are compiled, and how the machine executes them. You are expected to understand what you write, why it works, and why it sometimes does not. Date: 2026-01-21 URL: https://elte.darthdemono.com/Imperative-programming-L+Pr/ Tags: C, BSc, CS, ELTE, IP-18fIMPROGEG, Programming DarthDemono’s Notes for Imperative Programming L+Pr / IP-18fIMPROGEG This course is not about problem solving. It is about understanding C as a language, how programs are compiled, and how the machine executes them. You are expected to understand what you write, why it works, and why it sometimes does not. Course code: IP-18fIMPROGEG Credits: 5 Setup (what you install + how you work) Windows (MSYS2 + GCC + VSCode) Install MSYS2 Update and install required packages (use any shell): pacman -Syu pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make Add to %Path% Use VSCode as the editor (my recommendation, you can use vim or nano if you want) Install the C/C++ extension Make sure VSCode uses the MSYS2 gcc Linux (native, WSL, or server) Install gcc sudo apt update sudo apt install gcc vim build-essential Editors: vim nano VSCode (remote or local) Note: In Comsys server you are expected to use vim/nano and gcc will be pre-installed Compilation rules The instructor compiles using: gcc -g -fsanitize="address,undefined" -fno-omit-frame-pointer -W -Wall -Wextra -pedantic -Werror *.c This: enables runtime checks catches undefined behavior treats warnings as errors Windows limitation -fsanitize does not work on Windows. For local Windows practice, use: gcc -g -fno-omit-frame-pointer -W -Wall -Wextra -pedantic -Werror *.c Final verification To be sure your code is correct, compile on: WSL or the comsys server or a Linux VPS If it fails there, it is not correct, even if it “works on Windows”. End goal of the course By the end, you should be able to: Compile clean C code Use pointers safely Manage dynamic memory allocation correctly with malloc Design and manipulate struct-based data structures Avoid undefined behavior Input and Output data correctly Understand ‘run-time’ and ‘compile-time’ processes Samples Some samples for what to expect for Exams particles canvas Lecturers / Instructors Recommendations Books The C programming Language By Brian W. Kernighan and Dennis M. Ritchie. --- ### DarthDemono's Notes for ELTE BSc in CS Well, hello there! My name is Jubair Hasan (Joy), AKA DarthDemono. I’m a second semester student of ELTE Computer Science BSc. These course notes cover my coursework across multiple semesters, with grades of 4/5 or higher in most courses. Missing courses either proved too straightforward for note-taking, demanded no documentation, or reflect my own struggles where the notes wouldn't benefit others. All content draws from my personal study process rather than direct professor materials, so reach out to instructors for official resources, and contact me directly to flag any inaccuracies. Date: 2026-01-20 URL: https://elte.darthdemono.com/ Tags: IK-PROGINF-NBEN, BSc, CS, Universities/ELTE, World/Countries/Hungary DarthDemono’s Notes for Eötvös Loránd University (ELTE) BSc in CS Well, hello there! My name is Jubair Hasan (Joy), AKA DarthDemono. I’m a second semester student of ELTE Computer Science BSc. These course notes cover my coursework across multiple semesters, with grades of 4/5 or higher in most courses. Missing courses either proved too straightforward for note-taking, demanded no documentation, or reflect my own struggles where the notes wouldn’t benefit others. All content draws from my personal study process rather than direct professor materials, so reach out to instructors for official resources, and contact me directly to flag any inaccuracies. Usage Notes Files that linked to each other will appear blue. Any links ending with an extension is downloadable. For Example: program.cs of Programming L+Pr. Even if it shows an Error 404 when hovering. That is a feature for previewing pages not files. Both folders and files inside folders are web pages, so don’t think they are made for segmentation only. Course Registration Table Subject codeSubject nameCreditSemesterNotesIP-18fSZGREGComputer systems L+Pr51YesBXI-HUNLANG-SH1Hungarian Language and Culture I (SH)41YesIP-18fPROGEGProgramming L+Pr61YesIP-18fMATAGBasic Mathematics41NoIP-18fTMKGLearning Methodology Pr11NoIP-18fIMPROGEGImperative programming L+Pr51YesIP-18fFUNPEGFunctional programming L+Pr61YesIP-18fIVMEGBusiness fundamentals L+Pr31No Other Notes NEPTUN 5 Guides eduroam Ethernet Fix ELTE BSc CS Curriculum list Sync Your NEPTUN Calendar to Your Phone’s Home Screen Quotes I liked Programming is a vast subject; it really takes time to master it. Until then, you will find something new on a daily basis. Of course, we try to keep you in a walled garden during the semester, but the exam cannot be just a repetition of what you did before. We give you the tools, but you have to be able to use them: by analyzing the problem, isolating its parts, solving them one by one, putting them together, and finally hunting down the errors in it. We practiced each of these in the limited time we had, and you will practice them even more in the upcoming years. And forget ChatGPT. You’ve had enough of that already. When preparing for the exam, don’t use it. Use your notes, use my notes, but don’t ask a machine. It is one or two orders of magnitude harder to create something on your own than to fool yourself into thinking that understanding what ChatGPT says is enough. It isn’t. You won’t be able to replicate it on your own when all you have is Visual Studio with syntax highlighting. It can feel extremely lonely at the beginning, and you don’t want that during the exam. Instructor Dávid Németh Csóka --- ### Hungarian Language and Culture I These are my notes for Hungarian Vocabulary for the Hungarian Language and Culture I Course Date: 2026-01-20 URL: https://elte.darthdemono.com/Hungarian-Language-and-Culture-I/ Tags: Hungarian, Vocabulary, Universities/ELTE, World/Countries/Hungary Hungarian Vocabulary Notes These are my notes for Hungarian Vocabulary for the Hungarian Language and Culture I Course. These words are more relevant to the coursework compared to other words in Hungarian due to how the course is structured. Foods / Drinks Apple – alma Strawberry – eper Cucumber – uborka Fish – hal Mushroom – gomba Coffee – kávé Juice – gyümölcslé Sugar – cukor Oil – olaj Chocolate – csoki Sandwich – szendvics Mineral water – ásványvíz Cheese – sajt Cheesy – sajtos Ham – sonka Places Office – iroda School – iskola University – egyetem Street – utca Road – út House – ház Place – hely Bank – bank Square – tér City – város Room – szoba Classroom – tanterem Dormitory – kollégium Cinema / Movie theater – mozi Shop – bolt Buffet – büfé Adjectives Good – jó jól = adverb (“well”) Sleepy – álmos Happy – boldog Slow – lassú Bitter – keserű Sweet – édes Expensive – drága Beautiful – gyönyörű Blue – kék Deep – mély Windy – szeles (szél = wind) Cloudy – felhős (felhő = cloud) Cold – hideg Sunny – napos (nap = sun) Fast – gyors Cheap – olcsó Big – nagy Small – kicsi Refreshing – üdítő Round – kerek Common Questions How are you? – Hogy vagy? Are you a student? – Diák vagy? Yes, I’m a student. – Igen, diák vagyok. Are you Hungarian? – Magyar vagy? No, I’m not Hungarian. – Nem, nem vagyok magyar. What language do you speak? – Milyen nyelven beszélsz? Who? – Ki? What? – Mi? Where? – Hol? What is the book like? – Milyen a könyv? What’s the weather today? – Milyen idő van ma? How much does it cost? – Mennyibe kerül? Key Verbs To be – van / lenni Hungarian often omits the verb van in present tense statements. I am – (Én) vagyok You are – (Te) vagy He / She is – (Ő) van Example: Én diák vagyok → Diák vagyok (subject can be omitted) To speak – beszélni I speak – (Én) beszélek You speak – (Te) beszélsz He / She speaks – (Ő) beszél Example: Grúzul beszélek – I speak Georgian Random Words Window – ablak Stand – áll Life – élet Bicycle – bicikli Wide – széles Call – hív Time / Clock – óra Glass – üveg Sit – ül Violin – hegedű Guitar – gitár Nothing – semmi Student – diák This – ez That – az Board – tábla Chair – szék Table – asztal Door – ajtó Lamp – lámpa Book – könyv Notebook – füzet Pen – toll Pencil – ceruza Weather – időjárás Car – autó Snail – csiga Bag – táska Human – ember Bus – busz Bus stop – megálló Cabinet / Closet – szekrény Coat – kabát Basket – kosár Professions Doctor – orvos Teacher – tanár Student – diák Businessman – üzletember Waiter – pincér Chef – szakács Policeman – rendőr Mechanic – autószerelő Economist – közgazdász Lawyer – jogász Postman – postás Salesperson – eladó Animals / Nature Stork – gólya Mouse – egér Flower – virág Stone – kő Horse – ló Elephant – elefánt Cat – macska Common Phrases Sziasztok – Hello / goodbye (plural) Szia – Hello / goodbye (singular) Viszlát – Goodbye Jó reggelt kívánok – Good morning (≈ 6–9) Jó napot kívánok – Good day (≈ 9–18) Jó estét kívánok – Good evening (≈ 18–22) Jó éjszakát – Good night Köszönöm / Köszönöm szépen – Thank you / Thank you very much Szívesen / Nagyon szívesen – You’re welcome Nincs mit – No problem Igen – Yes Nem – No És – And Nem értem – I don’t understand (érteni) Nem tudom – I don’t know (tudni) Minden világos? – Is everything clear? Kérdés – Question Válasz – Answer Következő – Next Bocsánat – Sorry (formal) Bocsi – Sorry (informal) Biztos? – Are you sure? Vowel Harmony Rules (Hungarian) Vowel Types Front (magas): E, É, I, Í, Ö, Ő, Ü, Ű Back (mély): A, Á, O, Ó, U, Ú Mixed: Words containing both types Speaking a Language (-ul / -ül) Front → -ül Back → -ul Mixed → usually -ul Examples: magyar → magyarul francia → franciául grúz → grúzul In / At a Place (-ban / -ben) Front → -ben Back → -ban Mixed → -ban Examples: iskolában – in school városban – in the city --- ### Programming L+Pr This class isn’t “just C# coding”. It’s basically training the same solution in multiple forms, in order to train your programming skills. The goal is that when you see a task, you can translate it into a *patterned* solution, not freestyle it every time AKA Analogous programming Date: 2026-01-19 URL: https://elte.darthdemono.com/Programming-L+Pr/ Tags: Csharp, Programming, Specifikacio, ProgrammingPatterns, BSc, CS, Universities/ELTE, IP-18fPROGEG DarthDemono’s Notes for Programming L+Pr / IP-18fPROGEG This class isn’t “just C# coding”. It’s basically training the same solution in multiple forms, in order to train your programming skills. The goal is that when you see a task, you can translate it into a patterned solution, not freestyle it every time AKA Analogous programming. Course code: IP-18fPROGEG Credits: 6 When analogies are used with programming by example (PBE), the result is a new end-user programming paradigm combining the elegance of PBE to create programs with the power of analogies to reuse programs. The combination of PBE with analogies is called programming by analogous examples (PBAE). (Repenning & Perrone, 2001) Setup (what you install + what you create) You’ll write everything as a C# console program. 1) Install tools Install Visual Studio Community (Windows). Install .NET (if VS installer doesn’t already include it, install the latest supported .NET SDK/runtime from Microsoft). In VS, make sure the C# workload is enabled. 2) Create a project correctly Open Visual Studio → Create a new project Choose: C# Console App Important: select “Do not use top-level statements” This keeps your program structure consistent (classic Main, predictable file layout), which matters for learning + submissions. The 4–5 things you’re actually learning You’re expected to get comfortable with these: C# code in Visual Studio Specification tool: progalap.elte.hu/specifikacio/# Structogram tool: progalap.elte.hu/stuki/ Reduction tables / pattern tables Patterns in all three forms: spec + structogram + code That last part is the real theme: the class wants you to recognize a pattern and express it in: a formalish specification (pre/post), a clean algorithm (structogram), and the actual C# implementation. How the “patterns” idea works Instead of inventing a new solution style per task, you learn reusable patterns like: counting summation search (exists / first match) min/max selection filtering/copying/transforming Then you “reduce” a problem into one (or a combination) of these patterns. Once you can do that, tasks become mechanical: pick pattern → fill in condition/expression → implement. My honest experience (what’s hard vs easy) For me, specification was the toughest part. The official spec documentation was in Hungarian, so I made this: Specifikacio. Structogram is honestly easy once you get the symbols and structure—what matters is keeping it consistent with your specification. In C#, the only parts that consistently feel annoying are: 2D arrays structs (especially when input/output format gets strict) Console I/O: the thing that silently ruins points A lot of my mistakes weren’t “logic mistakes”, they’re input parsing / output formatting mistakes. For arrays, you’ll commonly see two formats: Format A: each element on a new line Example array [1,2,3,4,5] as console input: 1 2 3 4 5 Format B: space-separated on one line (harder) 1 2 3 4 5 You need to be comfortable handling both, because the “space-separated” one requires splitting and indexing correctly. Example Project This is an example project of what you should expect from your C# Classes. References Repenning, A., & Perrone, C. (2001). Chapter 18 - Programming by analogous examples. In H. Lieberman (Ed.), Your wish is my command (pp. 351–318). Morgan Kaufmann. doi.org/10.1016/B978-155860688-3/50019-1 --- ### Functional programming L+Pr This class isn’t “just writing Haskell syntax”. It’s basically training a different way of thinking. Date: 2025-12-28 URL: https://elte.darthdemono.com/Functional-programming-L+Pr/ Tags: Haskell, FunctionalProgramming, ELTE, IP-18fFUNPEG, BSc, CS, Universities/ELTE, World/Countries/Hungary DarthDemono’s Notes for Functional programming L+Pr / IP-18fFUNPEG This course attempts to teach a completely different form of programming compared to what we Course code: IP-18fFUNPEG Credits: 6 Setup (what you install + what you run) You’ll use GHC (the Haskell compiler) and usually run files either by interpreting them or compiling them. 1) Install GHC using GHCup (proper tutorial) GHCup is the standard toolchain manager for Haskell: it can install and manage GHC, cabal, and optionally stack/HLS. You can follow the official guidelines A) Windows (native) Create a folder where GHCup will live (pick a drive with space), e.g.: C:\ghcup\bin Run this PowerShell script Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; try { & ([ScriptBlock]::Create((Invoke-WebRequest www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -Interactive -DisableCurl } catch { Write-Error $_ } Open a terminal and run the basic installs (recommended flow from the official instructions): Install a recommended GHC and set it active: ghcup install ghc Install cabal: ghcup install cabal latest (Optional) install stack: ghcup install stack latest (Optional) install Haskell Language Server: ghcup install hls latest B) Linux / macOS (and WSL) Run the official bootstrap script (interactive installer): curl --proto '=https' --tlsv1.2 -sSf get-ghcup.haskell.org | sh The installer may offer to update your shell PATH automatically; accept if you want it to “just work” in new terminals. Open a new terminal window (or reload your shell config) so your PATH changes take effect. C) Verify everything works (all platforms) Run: ghc --version runghc --version cabal --version If these commands return proper versions, the toolchain is installed correctly. D) Quick sanity test (hello world) Create Main.hs: main :: IO () main = putStrLn "Hello Haskell" Run it: runghc Main.hs If it prints Hello Haskell, you’re ready for labs. Syllabus (what you actually learn) Topics you need to learn: Defining functions, guards, recursion, elementary types Syntax, reduction steps, normal form, lazy vs eager evaluation Standard functions, predefined operators Data structures: lists, tuples, records, arrays List processing: definitions, generators, patterns, recursion Types: simple, algebraic, composite, trees Algorithms: search, sort, traverse Higher-order functions: map, filter, iterate, fold Tuples, list comprehensions, equivalences Sorting, merging Infinite lists Algebraic types, trees, ADTs Recursions What to target List Comprehension: once List Comprehension clicks, half the course becomes easier. Recursion Haskell Learning Resources These resources from the Functional Programming syllabus provide curated materials for Haskell study, ranging from beginner guides to advanced topics. Beginner Tutorials Discourse: Best Haskell Materials 2024 – Community-curated top resources. Haskell Books Index – 77+ books tagged by level and topic. code.world (9 resources) & code.world/haskell (29 hands-on sites). Haskell Wiki & Wikibooks Haskell – Core references (not identical). Core Concepts Numeric Types in Haskell. Typeclassopedia – Type classes explained. Strictness & Laziness. Advanced & Tools Haskell Ecosystem Overview. GHC User Guide, Cabal Docs, Stack Docs – “Secret knowledge for wizards.” Prelude Docs & Base Package. Industry & Optimization Haskell in Industry & Haskellcosm. HS-Opt Handbook – Optimization (12 resources). Haskell Foundation Projects & Podcast. Research & Guides FP Complete Syllabus & Learn Path. Sunsetting “What I Wish I Knew” & Sources. Functional Pearls & PCPH. Haskell Learning Guide List Operations Sort high to low import Data.List (sortOn) import Data.Ord (Down(..)) sortDown :: [Int] -> [Int] sortDown xs = sortOn Down xs main = print (sortDown [2,3,4,6]) -- [6,4,3,2] Sort low to high import Data.List (sort) sortUp :: [Int] -> [Int] sortUp xs = sort xs main = print (sortUp [2,3,4,6]) -- [2,3,4,6] Return odd indices (1,3,5…) oddIndices :: [a] -> [a] oddIndices xs = [ x | (i, x) <- zip [0..] xs, odd i ] main = print (oddIndices [2,3,4,6]) -- [3,6] Return even indices (0,2,4…) evenIndices :: [a] -> [a] evenIndices xs = [ x | (i, x) <- zip [0..] xs, even i ] main = print (evenIndices [2,3,4,6]) -- [2,4] Adjacent pairs (overlapping) adjacentPairs :: [a] -> [(a,a)] adjacentPairs xs = zip xs (tail xs) main = print (adjacentPairs [2,3,4,6]) -- [(2,3),(3,4),(4,6)] Non-overlapping pairs pairs2 :: [a] -> [(a,a)] pairs2 (x:y:rest) = (x,y) : pairs2 rest pairs2 _ = [] main = print (pairs2 [2,3,4,6]) -- [(2,3),(4,6)] All prefixes allPrefixes :: [a] -> [[a]] allPrefixes xs = [ take i xs | i <- [1 .. length xs] ] main = print (allPrefixes [2,3,4,6]) -- [[2],[2,3],[2,3,4],[2,3,4,6]] Int to List import Data.Char (digitToInt) intToDigits :: Int -> [Int] intToDigits n = map digitToInt (show (abs n)) main = print (intToDigits 1234) -- [1,2,3,4] List Comprehensions Filter with condition filterDivisible :: [(Int,Int)] -> [(Int,Int)] filterDivisible pairs = [ (a,b) | (a,b) <- pairs, a `rem` b == 0 ] main = print (filterDivisible [(6,3),(4,2),(5,2)]) -- [(6,3),(4,2)] Multiple generators + guards multiGen :: [Int] -> [(Int,Int)] multiGen ys = [ (a,b) | (i,a) <- zip [0..] ys , (j,b) <- zip [0..] ys , i < j , a `rem` b == 0 ] main = print (multiGen [2,3,4,6]) -- [(4,2),(6,2),(6,3)] Cartesian product cartesian :: [Int] -> [Int] -> [(Int,Int)] cartesian xs ys = [ (x,y) | x <- xs, y <- ys ] main = print (cartesian [1..3] [4..6]) -- [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)] Higher-Order Functions Map with index mapWithIndex :: (Int -> a -> b) -> [a] -> [b] mapWithIndex f xs = [ f i x | (i,x) <- zip [0..] xs ] main = print (mapWithIndex (+) [10,20,30]) -- [10,21,32] Filter then map (selectiveMap) selectiveMap :: (a -> Bool) -> (a -> a) -> [a] -> [a] selectiveMap p f xs = [ if p x then f x else x | x <- xs ] main = print (selectiveMap even (*2) [1,2,3,4]) -- [1,4,3,8] Common Patterns Attach indices attachIndices :: [a] -> [(Int,a)] attachIndices xs = zip [0..] xs main = print (attachIndices [2,3,4,6]) -- [(0,2),(1,3),(2,4),(3,6)] All unique pairs (i < j) uniquePairs :: [a] -> [(a,a)] uniquePairs ys = [ (a,b) | (i,a) <- zip [0..] ys , (j,b) <- zip [0..] ys , i < j ] main = print (uniquePairs [2,3,4]) -- [(2,3),(2,4),(3,4)] Divisible pairs import Data.List (sortOn) import Data.Ord (Down(..)) divisiblePairs :: [Int] -> [(Int,Int)] divisiblePairs xs = [ (a,b) | (i,a) <- zip [0..] ys , (j,b) <- zip [0..] ys , i < j , a `rem` b == 0 ] where ys = sortOn Down xs main = print (divisiblePairs [2,3,4,6]) -- [(6,3),(6,2),(4,2)] Matrix sum of squared differences ssd :: [[Int]] -> [[Int]] -> Int ssd xs ys = sum [ (a-b)^2 | (rowX,rowY) <- zip xs ys , (a,b) <- zip rowX rowY ] main = print (ssd [[1,2],[3,4]] [[2,2],[1,5]]) -- 6 Midterm / Endterm Patterns Count odd digits countOdds :: Int -> Int countOdds n = length $ filter odd digits where digits = map (read . (:[])) (show (abs n)) main = print (countOdds 135246) -- 3 Common elements (unique) import Data.List (nub) commonElements :: Eq a => [a] -> [a] -> [a] commonElements xs ys = nub [ x | x <- xs, x `elem` ys ] main = print (commonElements [1,2,2,3,4] [2,4,4,5]) -- [2,4] Remove numbers divisible by 5 removeDiv5 :: [Int] -> [Int] removeDiv5 = filter (\x -> x `mod` 5 /= 0) main = print (removeDiv5 [5,10,12,15,17]) -- [12,17] Arithmetic sequence arithmeticSequence :: Int -> Int -> Int -> [Int] arithmeticSequence a d n = take n $ iterate (+d) a main = print (arithmeticSequence 2 3 5) -- [2,5,8,11,14] Count vowels (case-insensitive) countVowels :: String -> Int countVowels = length . filter (`elem` "aeiouAEIOU") main = print (countVowels "Education") -- 5 Prime check isPrime :: Int -> Bool isPrime x = divisors x == [1,x] where divisors n = filter (`divides` n) [1..n] divides d n = n `rem` d == 0 main = print (isPrime 29) -- True Replace with occurrence count replaceWithOccurrence :: [Int] -> [Int] replaceWithOccurrence xs = map (\x -> count x xs) xs where count y = length . filter (== y) main = print (replaceWithOccurrence [1,2,2,3]) -- [1,2,2,1] Decimal to Binary toBinary :: Int -> String toBinary 0 = "0" toBinary k = reverse (helper k) where helper 0 = [] helper y = let (q,r) = y `divMod` 2 in (if r == 0 then '0' else '1') : helper q main = print (toBinary 13) -- "1101" Perfect numbers perfectNumbers :: Int -> [Int] perfectNumbers n = [ x | x <- [2..n] , sum (init (divisors x)) == x ] where divisors k = [ d | d <- [1..k], k `rem` d == 0 ] main = print (perfectNumbers 500) -- [6,28,496] Student averages import Data.List (genericLength) averageScores :: [(String,[Double])] -> [(String,Double)] averageScores = map (\(name,scores) -> (name, sum scores / genericLength scores)) main = print (averageScores [("Alice",[80,90]),("Bob",[70,85,75])]) -- [("Alice",85.0),("Bob",76.66666666666667)] Numeric helpers Dot product of two lists dotProd :: [Int] -> [Int] -> Int dotProd xs ys = sum [ x * y | (x,y) <- zip xs ys ] main = print (dotProd [1,2,3] [4,5,6]) -- 32 Average of a list (generic numeric) avg :: (Real a, Fractional b) => [a] -> b avg xs = realToFrac (sum xs) / fromIntegral (length xs) main = print (avg [1,2,3,4] :: Double) -- 2.5 Parallel list comprehensions Elementwise v1 + v2 * v3 {-### LANGUAGE ParallelListComp #-} mulAddA :: [Int] -> [Int] -> [Int] -> [Int] mulAddA v1 v2 v3 = [ a + b * c | a <- v1 | b <- v2 | c <- v3 ] main = print (mulAddA [1,2] [3,4] [5,6]) -- [16,26] Elementwise product and safe division {-### LANGUAGE ParallelListComp #-} elementWise :: [Double] -> [Double] -> ([Double],[Double]) elementWise xs ys = (products, divisions) where products = [ x * y | x <- xs | y <- ys ] divisions = [ if y == 0 then 0 else x / y | x <- xs | y <- ys ] main = print (elementWise [4,6] [2,0]) -- ([8.0,0.0],[2.0,0.0]) Tuples and Booleans Combine tuples with Int and Bool processTuples :: [(Int,Bool)] -> [(Int,Bool)] -> Int processTuples xs ys = sum [ if b1 && b2 then a1 + a2 else a1 - a2 | (a1,b1) <- xs | (a2,b2) <- ys ] main = print (processTuples [(5,True),(3,False)] [(2,True),(1,True)]) -- 5 Records and updates data Univ = Univ { uniName :: String , uniID :: Int } deriving (Show,Eq) data Student = Student { neptunID :: Int , studentName :: String , uni :: Univ , grades :: [Int] } deriving Show Rename a university (by uniID) renameUniversity :: Univ -> String -> [Student] -> [Student] renameUniversity target newName = map (\s -> if uniID (uni s) == uniID target then s { uni = (uni s) { uniName = newName } } else s) main = let u1 = Univ "ELTE" 1 u2 = Univ "BME" 2 sts = [ Student 1 "Alice" u1 [90,95] , Student 2 "Bob" u2 [70,80] ] in print (renameUniversity u1 "ELTE Budapest" sts) Outstanding students (>90) outstandingStudents :: [Student] -> [String] outstandingStudents sts = [ studentName s | s <- sts, any (>90) (grades s) ] main = let u = Univ "ELTE" 1 sts = [ Student 1 "Alice" u [88,92] , Student 2 "Bob" u [70,80] ] in print (outstandingStudents sts) -- ["Alice"] Trees Binary tree and subtree swap data Tree a = Node a (Tree a) (Tree a) | Leaf deriving Show swapSubTree :: Tree a -> Tree a swapSubTree Leaf = Leaf swapSubTree (Node x l r) = Node x (swapSubTree r) (swapSubTree l) main = let t = Node 1 (Node 2 Leaf Leaf) (Node 3 Leaf Leaf) in print (swapSubTree t) -- Node 1 (Node 3 Leaf Leaf) (Node 2 Leaf Leaf) Expression trees to infix string data ExpressionTree a = Operand a | Operator String (ExpressionTree a) (ExpressionTree a) deriving Show evaluate :: ExpressionTree String -> String evaluate (Operand x) = x evaluate (Operator op l r) = "(" ++ evaluate l ++ op ++ evaluate r ++ ")" main = let expr = Operator "+" (Operand "3") (Operator "*" (Operand "4") (Operand "5")) in print (evaluate expr) -- "(3+(4*5))" Algebraic data types and pattern matching data Color = Red | Blue | Yellow | Purple | Orange | Green deriving (Show,Eq) combineColors :: Color -> Color -> Color combineColors Red Blue = Purple combineColors Blue Red = Purple combineColors Red Yellow = Orange combineColors Yellow Red = Orange combineColors Blue Yellow = Green combineColors Yellow Blue = Green combineColors c1 c2 | c1 == c2 = c1 | otherwise = error "Unsupported combo" main = print (combineColors Red Blue) -- Purple Type Class Instances data Team = Team { teamName :: String , teamID :: Int } data Player = Player { playerID :: Int , playerName :: String , playerTeam :: Team , playerScores :: [Int] } Custom Show instance for Team instance Show Team where show t = "Team teamName " ++ show (teamName t) ++ ", teamID " ++ show (teamID t) main = let t = Team "Red Dragons" 1 in print t -- Team teamName "Red Dragons", teamID 1 Custom Show instance for Player instance Show Player where show p = "Player ID " ++ show (playerID p) ++ ", Name " ++ playerName p ++ ", Team " ++ show (playerTeam p) ++ ", Scores " ++ show (playerScores p) main = let t = Team "Red Dragons" 1 p = Player 10 "Alice" t [20,30,40] in print p -- Player ID 10, Name Alice, Team Team teamName "Red Dragons", teamID 1, Scores [20,30,40] Custom Eq instance for Player Rule: Two players are equal if: Their total score is the same They belong to different teams instance Eq Player where p1 == p2 = sum (playerScores p1) == sum (playerScores p2) && teamID (playerTeam p1) /= teamID (playerTeam p2) main = let t1 = Team "Red Dragons" 1 t2 = Team "Blue Wolves" 2 p1 = Player 1 "Alice" t1 [30,30] p2 = Player 2 "Bob" t2 [60] in print (p1 == p2) -- True --- ### Planetary surveys This is an example project of what you should expect from your C# Classes. Date: 2025-11-24 URL: https://elte.darthdemono.com/Programming-L+Pr/Example-Project/ Tags: ProgrammingPatterns, Csharp, Universities/ELTE, World/Countries/Hungary, Programming, Project, IP-18fPROGEG Programming L+Pr Example Project: Planetary surveys Task Description It is the far future, and humanity is exploring the stars. We have collected data from space probes surveying the atmospheric composition of distant planets and we are looking for worlds with an atmosphere that could enable colonization. The atmosphere of a planet can be considered livable if the oxygen levels are between 19 and 24 percent and the nitrogen levels are between 76 and 81 percent and no dangerous elements are present in a concentration that is greater than 0.5 percent. Write a program that calculates how many of the planets surveyed have a livable atmosphere! Input The first line of the standard input contains the count of planets surveyed (1≤n≤100) and the count of dangerous elements observed on each of the planets (1≤m≤10). The next n lines contain observed levels of oxygen (1≤ox≤99) as a natural number, the observed levels of nitrogen (1≤nt≤99) as a natural number and the levels of m count of dangerous elements observed (0≤d≤2) as real numbers. The levels of all the elements in the atmosphere must add up to 100. Output The first line of the standard output should contain the count of observed planets that have a livable atmosphere. Example Input 5 3 5 94 0.5 0 0.5 22 76 0.5 1 0.5 21 79 0 0 0 61 35 2 1.5 0.5 23 76 0.5 0 0.5 Output 2 Code File: Program.cs Code: // Specification: progalap.elte.hu/specifikacio/v1/ // Algorithm: progalap.elte.hu/stuki/v1/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CP2_task7 { internal class Program { static void Main(string[] args) { int n, m, ox, nt, livableCnt = 0; double d = 0.00; bool acceptableOxygen, acceptableNitrogen, isDangerous = false; string[] parts, firstLine = {""}; firstLine = Console.ReadLine().Split(); int.TryParse(firstLine[0], out n); int.TryParse(firstLine[1], out m); for (int i = 0; i < n; i++) { isDangerous = false; parts = Console.ReadLine().Split(); int.TryParse(parts[0], out ox); int.TryParse(parts[1], out nt); acceptableOxygen = (ox >= 19 && ox <= 24); acceptableNitrogen = (nt >= 76 && nt <= 81); for (int j = 0; j < m; j++) { double.TryParse(parts[2 + j], out d); if (d > 0.5) { isDangerous = true; } } if (acceptableOxygen && acceptableNitrogen && !isDangerous){ livableCnt++; } } Console.WriteLine(livableCnt); } } } Stuctogram / Algorithm Algorithm: progalap.elte.hu/stuki/v1/ Specifickacio Specification: progalap.elte.hu/specifikacio/v1/ Specification In: n ∈ N, m ∈ N, ox ∈ N[1..n], nt ∈ N[1..n], d ∈ R[1..n, 1..m] Out: livableCount ∈ N Pre: (1 <= n <= 100) and (1 <= m <= 10) and (∀i ∈ [1..n]: (1 <= ox[i] <= 99)) and (∀i ∈ [1..n]: (1 <= nt[i] <= 99)) and (∀i ∈ [1..n]: (∀j ∈ [1..m]: (0.0 <= d[i,j] <= 2.0))) and (∀i ∈ [1..n]: (ox[i] + nt[i] + (SUM(j=1..m, d[i,j])) = 100)) Post: livableCount = COUNT( i=1..n, (19 <= ox[i]) and (ox[i] <= 24) and (76 <= nt[i]) and (nt[i] <= 81) and (FORALL(j=1..m, d[i,j] <= 0.5))) Test Data n: 5 m: 3 ox: [5, 22, 21, 61, 23] nt: [94, 76, 79, 35, 76] livableCount: 2 d: - [0.5, 0.0, 0.5] - [0.5, 1.0, 0.5] - [0.0, 0.0, 0.0] - [2.0, 1.5, 0.5] - [0.5, 0.0, 0.5] --- ### Specification This is basically a specification for ELTE's Specification Editor Date: 2025-10-23 URL: https://elte.darthdemono.com/Programming-L+Pr/Specifikacio/ Tags: ProgrammingPatterns, Specifikacio, Documentation, BSc, CS, Universities/ELTE, IP-18fPROGEG Specification for ELTE’s Specification This is basically a specification for ELTE’s Specification Editor Input Data Description In: The input section defines the program’s data declarations, specifying variable names and their associated sets or types. These declarations follow specific syntax and naming rules: Elementary Sets and Declaration Syntax Format: variable_name ∈ Set Variable names start with a lowercase letter Set/type names (e.g., N, Z, R, L, S, C, K) start with uppercase Multiple declarations separated by commas Common elementary sets: N: natural numbers Z: integers R: real numbers L: logical (Boolean) values S: strings/texts C: character set Example: a ∈ N , b ∈ Z , name ∈ S Intervals Defined with square brackets and two dots: [start..end] Both ends inclusive, represent ranges of values for variables Examples: [1..3] , [0..] for open-ended intervals Indexed Sequences and Arrays Collections of elements of the same type indexed over a range Syntax: x ∈ N[1..n] means x is an array of natural numbers indexed from 1 to n Arrays considered members of the set of all such sequences over the specified index domain Index referencing with brackets: x[i] Index ranges can be positive, negative, or open-ended (e.g., -1..1 , 1..) Functions to query array length and bounds: length(x): length of the array start(x): start” index end(x): end index Arrays may be initialized with values, e.g., x6 ∈ N[] = [^5][^1][^2] Index bounds can be expressions, e.g., x7 ∈ N[2+3..n*2] Matrices Two-dimensional arrays indexed by two ranges Syntax: m ∈ Z[rows, columns] e.g., m1 ∈ Z[1..8, 1..8] Access elements with m[row, col] or nested indexing m[row][col] (both understood contextually) Open-ended or zero-based indexing possible, e.g., m3 ∈ Z[0.., 0..] Initial values can be specified with nested lists, e.g., m5 ∈ Z[-1..1,-1..1] = [ [2, 1, 2], [1, 0, 1], [2, 1, 1] ] Records (Structures, Objects) Compound data aggregating values of different types into named fields Represented as direct product sets of field name and set pairs Record names start with a uppercase letter Example: R=(a:S x b:N) Arrays of records are accessed like this: `words∈R[1..n] Fields accessed by dot notation, e.g., r1.name , r1.grade Parentheses allow grouping record types, e.g. (name: S x grade: N) Complex records can include multiple logical fields or records as tuples Unique Set Names (Type Aliases) Sets and types can be aliased with new uppercase names for clarity Syntax: NewSetName = ExistingSet Aliasing can form chains, e.g.: Mark = FromOneToFive FromOneToFive = [1..5] Used for clearer descriptions of complex or repetitive data types Examples: Student = (name: S x grade: N) StudentArray = Student2[] Student2 = (name: S x grades: Grade[]) Scripting Language Syntax Rules for Declarations Use lowercase initial letter for variables Use uppercase initial letter for sets/types Multiple declarations separated by commas ( ,) Membership indicated by either ∈ or eleme Indexed arrays and matrices use bracket notation for indices Initial values assigned with = , using list [ ] or nested lists for arrays/matrices Auxiliary Data Description Auxiliary data are intermediary variables used during computation or output preparation. Declared like input variables, in the Aux: section Must be included in the submitted data Follows the same syntax as inputs, e.g., sa ∈ N Output Data Description Out: Output variables declared similarly to inputs Example: ki ∈ L , y ∈ N[] Function Definitions Functions are defined similarly to their mathematical form: Syntax template: Fn: function_name : domain -> codomain, function_definition Domain and codomain are sets Body supports arithmetic expressions, tuple constructions Examples: Doubling: Fn: f: N -> N, f(p) = p * 2 Sum of two integers: Fn: add: Z x Z -> Z, add(a,b) = a + b Swap tuple: Fn: swap: Z x Z -> Z x Z, swap(a,b) = (b,a) Function accessing outer variable: Fn: f2 : Z -> Z, f2(p) = p + n Field access function: Fn: grade: Student -> N, grade(h) = h.grade Array element function: Fn: index: N[] x N -> N, index(x,i) = x[i] Preconditions for Input Data Preconditions are logical formulas that must hold for the input for the program to be validly executed. Logical operators: and or not Comparison operators: = , < , > , <= , >= Quantifiers supported: ∀ (For all) ∃ (There exists) Complex nested expressions with parentheses allowed Examples: Pre: true and not false and 3=3 and n>0 and ... (simplest always true precondition) Array and interval quantifications: ∀i ∈ [1..3]: i > 0 ∃i ∈ [1..n]: x[i] < 3 Matrix quantifiers support nested row and column quantifications Records and tuples fields can be accessed by name/index in logic Postconditions Postconditions specify output requirements depending on input Must mention all declared variables (input and output) Use the same logical notation as preconditions Example trivial postcondition: Post: true Frequently use quantifiers for expressing existential or universal conditions Pre built functions f(i) is a value-producing function evaluated at index i (e.g., array element, or some expression computed from arrays/records at i). A(i) is a boolean condition (predicate) evaluated at index i that decides whether i “qualifies” (true/false). 1. Summation (SUM) Explanation: Calculates the sum of values of a function (or array elements) over an index interval. In: b ∈ Z, e ∈ Z Out: s ∈ H Pre: b ≤ e Post: s = SUM(i = b..e, f(i)) 2. Counting (COUNT) Explanation: Counts how many indices in an interval satisfy a given condition. In: b ∈ Z, e ∈ Z Out: cnt ∈ N Pre: b ≤ e Post: cnt = COUNT(i = b..e, A(i)) 3. Maximum Selection (MAX) Explanation: Finds the index and value of the maximum element of a function/array over an interval. In: b ∈ Z, e ∈ Z Out: maxind ∈ Z, maxval ∈ H Pre: b ≤ e Post: (maxind, maxval) = MAX(i = b..e, f(i)) 4. Minimum Selection (MIN) Explanation: Like MAX, but for the minimum element. In: b ∈ Z, e ∈ Z Out: minind ∈ Z, minval ∈ H Pre: b ≤ e Post: (minind, minval) = MIN(i = b..e, f(i)) 5. Copy (COPY) Explanation: Creates a sequence by mapping a function over an interval. In: b ∈ Z, e ∈ Z Out: y ∈ H[1..e-b+1] Pre: b ≤ e Post: y = COPY(i = b..e, f(i)) 6. Multiple Item Selection (MIS) Explanation: Collects the values f(i) for which condition A(i) holds, and returns the count too. In: b ∈ Z, e ∈ Z Out: cnt ∈ N, y ∈ H[1..cnt] Pre: b ≤ e Post: (cnt, y) = MIS(i = b..e, A(i), f(i)) 7. Search (SEARCH) Explanation: Finds the first index in an interval where a condition holds; returns an existence flag and the index. In: b ∈ Z, e ∈ Z Out: exists ∈ L, ind ∈ Z Pre: b ≤ e Post: (exists, ind) = SEARCH(i = b..e, A(i)) 8. Decision (EXISTS) Explanation: Decides whether there exists an index in the interval where a condition holds. In: b ∈ Z, e ∈ Z Out: exists ∈ L Pre: b ≤ e Post: exists = EXISTS(i = b..e, A(i)) 9. Decision all (FORALL) Explanation: Decides whether a condition holds for all indices in the interval. In: b ∈ Z, e ∈ Z Out: all ∈ L Pre: b ≤ e Post: all = FORALL(i = b..e, A(i)) 10. Conditional Maximum (CONDMAX) Explanation: Finds maximum value (and its index) among those elements that satisfy an additional condition. In: b ∈ Z, e ∈ Z Out: exists ∈ L, maxind ∈ Z, maxval ∈ H Pre: b ≤ e Post: (exists, maxind, maxval) = CONDMAX(i = b..e, f(i), A(i)) 11. Conditional Minimum (CONDMIN) Explanation: Like CONDMAX, but selects the minimum under the condition. In: b ∈ Z, e ∈ Z Out: exists ∈ L, minind ∈ Z, minval ∈ H Pre: b ≤ e Post: (exists, minind, minval) = CONDMIN(i = b..e, f(i), A(i)) 12. Select (SELECT) Explanation: Returns the leftmost index ≥b where the condition becomes true, assuming such an index exists. In: b ∈ Z, e ∈ Z Out: ind ∈ Z Pre: ∃ i ∈ [b..e] : A(i) Post: ind = SELECT(i ≥ b, A(i)) Usage and Evaluation Write full specification with sections: Input, Auxiliary, Output, Pre, Post, Functions Specification editor supports Ctrl+Space for base structure generation Input data can be provided in JSON or YAML format matching declared structures “Evaluate” button runs stepwise validation and program simulation (good for debugging) Example Specification and Usage Task Ratbert counted how many times each keyword appears in a code. List the keywords whose counts are greater than the largest count of any keyword that comes before them in the list. 1’st example input: number of keywords: 5 keywords. wordHow many times…program1if10else5while20do12 Specification In: n∈N, words∈Te[1..n],Te=(a:S x b:N) Out: outp∈S[1..] Fn: attr: N->L,     attr(i)=(MAX(j=1..i-1,words[j].b).maxval<words[i].b) Pre: - Post: (,outp)=MIS(i=1..n,attr(i),words[i].a) Example Input Data (YAML):  n: 5  words:    - a: program      b: 1    - a: if      b: 10    - a: else      b: 5    - a: while      b: 20    - a: ado      b: 12  outp:    - "if"    - "while" Reduction table Pattern (MAX)Specific problemb..e1..i-1f(j)words[j].bmaxind, maxval, MAX(j=1..i-1, words[j].b).maxvalPattern (MIS)Specific problemb..e1..nA(i)attr(i)f(i)words[i].acnt, y[1..cnt], outp[1..] ---